File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "need help in JTable.." Watch "need help in JTable.." New topic
Author

need help in JTable..

fiddy chan
Greenhorn

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
Greenhorn

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);
setEditable(false);
thanks alot for ur reply.. thanks..
 
 
subject: need help in JTable..