• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

DefaultTableModel

 
Ranch Hand
Posts: 33
C++ Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!!
 
Sheriff
Posts: 28360
99
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Success - thank you very much!!
 
Hey, I'm supposed to be the guide! Wait up! No fair! You have the tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic