Results 1 to 2 of 2
Thread: JTable entry modification
- 09-19-2011, 04:58 PM #1
Member
- Join Date
- Oct 2010
- Posts
- 25
- Rep Power
- 0
JTable entry modification
Hi,
I have a Jtable and some values in it. and I displayed it. Once after displaying this Jtable, I have a Jcombobox below this Jtable and If I select this combobox to a different value, I should be able to display some other values from a string array on the same Jtable. Is it possible to do this without creating a new Jtable?
Or do I need to recreate this JTable with the new values and close the old Jtable.
Thanks in Advance
Regards
- 09-19-2011, 05:17 PM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,608
- Rep Power
- 5
Re: JTable entry modification
Create a custom TableModel (the AbstractTableModel and DefaultTableModel classes are handy to do so - just override/implement the appropriate methods). You can then have logic in the getValueAt method to return the appropriate value based upon what the user selection is. When the item in the ComboBox is selected, call the fireTableDataChanged method. The following link has information for how to accomplish this.
How to Use Tables (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)
Similar Threads
-
Modification in XML file
By anurag_1226 in forum Java SoftwareReplies: 1Last Post: 04-10-2010, 06:53 PM -
n00b: jTable gui modification
By ankitmcgill in forum New To JavaReplies: 1Last Post: 03-15-2009, 06:34 PM -
help with concurrent modification exception
By jdgallag in forum New To JavaReplies: 1Last Post: 11-30-2008, 09:19 PM -
Inventory Program modification help
By badness in forum Java AppletsReplies: 1Last Post: 01-17-2008, 05:24 AM -
Getting modification and expiration date of content
By Java Tip in forum Java TipReplies: 0Last Post: 11-26-2007, 01:20 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks