Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

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: 27375
88
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!!
 
Today you are you, that is turer than true. There is no one alive who is youer than you! - Seuss. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic