This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JTable in JPanel is automatically disabled Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable in JPanel is automatically disabled" Watch "JTable in JPanel is automatically disabled" New topic
Author

JTable in JPanel is automatically disabled

Akansha Kumar
Greenhorn

Joined: Dec 15, 2006
Posts: 2
I have a swing based application.Here there is JPanel in which there is a JTable , table1 with n rows and 1 column. Each cell of table1 contains another JPanel. The JPanel again contains JTable table2. The problem is after cell rendering the JTables table1 and table2 are visible but are disabled. I mean the scroll doesn't work...the editing functionalituy isn't wroking. Is there any solution to this,?
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Is there anyway you can provide a stripped down version of your code that we can execute and play around with so we can duplicate? Aside from that it sounds like horrible UXP to me. What are you trying to do. Maybe there is a better solution.


GenRocket - Experts at Building Test Data
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 862
Originally posted by Akansha Kumar:
I have a swing based application.Here there is JPanel in which there is a JTable , table1 with n rows and 1 column. Each cell of table1 contains another JPanel.


JTables can't really contain components such as JPanels. They contain values which, when needed, are painted by cell renderers.

At best you can set up cell renderers (and cell editors) to give the illusion that the table cells contain panels. (This is also what's going on when JTable cell appear to contain JComboBoxes or JCheckBoxes.) It sounds like you might be better off not using JTable.


bitguru blog
 
wood burning stoves
 
subject: JTable in JPanel is automatically disabled
 
Similar Threads
Multiple components in cell of a JTable
JTable
JCheckBox and JTable
JTable to Jtable Drag and Drop
Switch Selection between 2 JTable?