aspose file tools
The moose likes Swing / AWT / SWT and the fly likes JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable" Watch "JTable" New topic


Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
could you kindly tell me how to do this. i have created a JTable with 100 rows and 5 columnc. what i want to do is i want to name the five columns. A,B,C....... appears now. i know i can use another constructor but the thing is i want to specify the number of rows in the same time. i would appriciate if you write down the code if you can.
thank you very much

SCJP 1.4, SCMAD 1.0<br />SCWCD, SCBCD (in progress)
Greg Charles

Joined: Oct 01, 2001
Posts: 2867

JTable is a very flexible class, but that flexibility makes it a bit hard to use. The easiest way to get column names is to use the JTable(Object[][] rowData, Object[] columnNames) constructor. There are many other ways. In some cases, you will create your own TableColumnModel and add each column manually.
I agree. Here's the link:
subject: JTable