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.


>> REGISTER NOW TO START POSTING


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

Results 1 to 2 of 2

Thread: adding rows to coloumns. Netbeans

  1. #1
    Junior Member
    Join Date
    Nov 2008
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default adding rows to coloumns. Netbeans

    Dear sir,

    I am making simple GUI application in Netbeans6.5.

    I want to add row through code during run time of program.

    I have one jtable and one jbutton on the frame .

    If i press jbutton then there should be addition of one row in the jtable for this i have added the following code in jbutton action performed function

    Jtable.addRowSelectionInterval(0,jtable.getRowCoun t()-1);

    But i am not able to achieve the task . the number of rows same as that were in the beginning i.e. number of rows are not increasing on pressing the jbutton

    Also i have refreshed the jframe for that but still it doesn't work

    Please tell me the solution for that.

    regards
    gaurav


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: adding rows to coloumns

    Hello haygaurav,

    Sorry for the late reply.

    The row must be added to the TableModel, not the JTable as you are attempting.
    add row in jTable use Netbeans. - Java

    Appending a Row to a JTable Component (Java Developers Almanac Example)

    I hope these links help to solve your problem.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

Similar Threads

  1. Java program to do Matrix operation
    By saladfingers73 in forum Collections and Generics
    Replies: 5
    Last Post: March 7th, 2012, 09:17 AM
  2. Adding to Array from JavaSpace problem
    By rtumatt in forum Collections and Generics
    Replies: 2
    Last Post: September 15th, 2011, 07:11 AM
  3. Adding to Array from JavaSpace problem
    By rtumatt in forum Collections and Generics
    Replies: 3
    Last Post: January 5th, 2010, 07:19 PM
  4. Need a loop for rows and columns
    By Ceasar in forum Loops & Control Statements
    Replies: 8
    Last Post: October 9th, 2009, 05:47 PM
  5. Netbeans help
    By [Kyle] in forum Java IDEs
    Replies: 2
    Last Post: September 20th, 2009, 06:32 PM