Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Add or remove a row on a jtable with Netbeans 6.0

  1. #1
    Junior Member
    Join Date
    Jul 2010
    Thanked 0 Times in 0 Posts

    Default Add or remove a row on a jtable with Netbeans 6.0

    Hello people. Im as using Netbeans 6.0. I created a form with a few combo boxes, radio buttons, labels, button, and a jtable. What im doing is im reading data out of a table in mysql and then i populate the jtable with the data. How it works is the person selects one of the 3 radio buttons, then they click on button to view the results for that selected option. The problem comes in when a long list is being (the "Year" option is selected)displayed and the person chooses another option that brings back a shorter list(the "Week" option is selected). Then the long list remains in the table. Could anyone please help me with a solution?

  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Thanked 833 Times in 772 Posts
    Blog Entries

    Default Re: Add or remove a row on a jtable with Netbeans 6.0

    If you post some sample code that reproduces the problem it would help tremendously. I'd suggest writing your own TableModel (perhaps an extension from DefaultTableModel) if you have not already. Regardless, any changes to the back-end of the model (eg the data being displayed) should be accompanied by calling one of the appropriate 'fire..' methods on the table model (see AbstractTableModel), the most general being fireTableDataChanged().

Similar Threads

  1. Replies: 1
    Last Post: March 15th, 2010, 10:03 PM
  2. How to remove the in-between spaces in a String? Please help.
    By marksquall in forum Java Theory & Questions
    Replies: 2
    Last Post: February 4th, 2010, 04:19 PM
  3. JTable in JScrollPane
    By alwayslearner in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: January 29th, 2010, 11:42 AM
  4. How to remove letters
    By noobish in forum Java Theory & Questions
    Replies: 13
    Last Post: October 3rd, 2009, 10:36 PM
  5. Remove from array after a period of time
    By Marty in forum Collections and Generics
    Replies: 1
    Last Post: September 1st, 2009, 07:57 AM