wood burning stoves
The moose likes Swing / AWT / SWT and the fly likes need help in JTable.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "need help in JTable.." Watch "need help in JTable.." New topic

need help in JTable..

fiddy chan

Joined: Apr 14, 2004
Posts: 12
How to display a JTable in a frame and set the JTable as read-only Table?
pls help me.. i seriously need help for that to complete my project.. thanks alot..
Dhanush Dharsh
Ranch Hand

Joined: Oct 30, 2000
Posts: 33
Hi Fiddy,
You can use a JScrollPane to display a table. Put the JTable in a JScrollPane and put tha JScrollPane into a JFrame.
Coming to non-editable JTable, I am afraid you have to create your own table model for that. Look below for a simple example.

DefaultTableModel is a very simplistic model with little flexibility, the flexibility comes from being able to plug in your own table model.
Hope this helps.
Chris Jebaraj
Ranch Hand

Joined: Sep 19, 2003
Posts: 34
How about making the JTable's setEditable(false)??? Will it work? i guess so. Pls try out and let us know.

JebaRaj.<br /> MCP, SCJP 1.5 <br />----------------------------<br /> THOUGH TIMES TEACH TRUST. <br />----------------------------
fiddy chan

Joined: Apr 14, 2004
Posts: 12
this is where i out the "setEditable(false);
but it didn't work. error occured. it can be resolve.
is there another method?
JTable table = new JTable(expenseList, colExpense);
JScrollPane scrollPane = new JScrollPane(table);
thanks alot for ur reply.. thanks..
I agree. Here's the link: http://aspose.com/file-tools
subject: need help in JTable..
It's not a secret anymore!