简体   繁体   中英

jtable ( adding new row)

I am trying to implement a GUI for my tool by using Swing plugin.

I have a jtable for every job and all the properties of the jobs are read by a csv file. However if I want to create my special job ( in order to do it, I created another jframe which includes the properties of job like speed,property..

User can use either the default jobs or if he wants to add special his job, he clicks NewJob button and new frame will open and he chooses all properties of it. All of these I implemented.

However, I want to add this new job in the table, below to the other default jobs and write all the properties of it in csv file. How can I do this? Advance thanks for all help.

Because of the confidentiality issues, I could not share my codes.

I created another jframe...

Don't use a JFrame. Use a modal JDialog for child windows.

I want to add this new job in the table

Then you need to update the TableModel.

Use the addRow(...) method of the DefaultTableModel to dynamically add data to the TableModel.

and write all the properties of it in csv file.

You create two loops, one for the rows and the other for the columns and your write out all the data in the TableMdoel to a file.

Since you won't share your code we can't give you a specific solution, only general advice.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM