This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Allow user to add new rows in JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Allow user to add new rows in JTable" Watch "Allow user to add new rows in JTable" New topic
Author

Allow user to add new rows in JTable

Ali Mardhani
Greenhorn

Joined: Apr 03, 2005
Posts: 1
Hi There,

I wish to allow user to add new rows to JTable. I can not find any documentation to achieve that. Here is part of my code:

// create a table
String[] columnNames = {"Age", "Blood Sugar"};
Object [][] data = {{new Integer(50), new Float(10.11) }};
TableModel myData = new DefaultTableModel(data,columnNames);
JTable table = new JTable(myData);
JScrollPane scrollPane = new JScrollPane(table);

// add table to the container
frame.add(table, BorderLayout.CENTER);

// show table
frame.setVisible(true);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Allow user to add new rows in JTable