This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

DefaultTableModel  RSS feed

 
Joe Pettit
Ranch Hand
Posts: 33
C++ Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to get a jtable to display information stored in an array which is populated by reading a text file:



The getAssNames method is then called here:



I'm trying to get the jTable to have 5 columns: date, class name, assignment name, complete? and notes. I see that the DefaultTableModel requires either an Object[] and an int as args or Object[][] and Object[] - can you guys explain this a bit more for me? So far I have the table displaying all of the values from the tokenizedAssNames array as column names.

Thanks!!
 
Paul Clapham
Sheriff
Posts: 22472
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You just want to know how to set the column names? That's right at the start of How to Use Tables.

(Off topic: are you seriously calling a variable "assName"? I find myself giggling every time I see it.)
 
Joe Pettit
Ranch Hand
Posts: 33
C++ Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:You just want to know how to set the column names? That's right at the start of How to Use Tables.

(Off topic: are you seriously calling a variable "assName"? I find myself giggling every time I see it.)


Hahaha - yes, what can I say, I'm too lazy to type assignmentName each time! I'll take a look at that, thank you Paul!
 
Joe Pettit
Ranch Hand
Posts: 33
C++ Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Success - thank you very much!!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!