• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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!!
 
Marshal
Posts: 28237
95
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!!
 
Wait for it ... wait .... wait .... NOW! Pafiffle! A perfect tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic