This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

add new row into JTable  RSS feed

 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have searched api of JTable.
there is a method addRowSelectionInterval()

is that the method to add new row into JTable?
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. You seem to have missed learning the concept of the "selection", which is what that method adds rows to. The "selection" is a subset of the cells that the user has selected, normally by clicking on them. Usually the JTable identifies those cells to the user by displaying them in a contrasting colour.

And anyway you were looking in the wrong place. You don't add rows to a JTable. You add rows to the table model, which then signals the JTable to redraw itself. Check out DefaultTableModel, for example, and you will find some insertRow() methods.
 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how about addRow(..)?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!