Results 1 to 2 of 2
  1. #1
    lemontree45 is offline Member
    Join Date
    Oct 2010
    Rep Power

    Default JTable entry modification


    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


  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Rep Power

    Default 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

  1. Modification in XML file
    By anurag_1226 in forum Java Software
    Replies: 1
    Last Post: 04-10-2010, 06:53 PM
  2. n00b: jTable gui modification
    By ankitmcgill in forum New To Java
    Replies: 1
    Last Post: 03-15-2009, 07:34 PM
  3. help with concurrent modification exception
    By jdgallag in forum New To Java
    Replies: 1
    Last Post: 11-30-2008, 10:19 PM
  4. Inventory Program modification help
    By badness in forum Java Applets
    Replies: 1
    Last Post: 01-17-2008, 06:24 AM
  5. Replies: 0
    Last Post: 11-26-2007, 02:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts