0

Hi have a JTable which each cell is a JPanel (using cell renderer)

The content of the cells is not shown until I click somewhere in the JTable to get focus.. (When I used JTextArea instead of JPanel for each cell it worked well)

I tried to use updateUI() in some places but it didn't help..

What is the problem? Thanks!

kleopatra
  • 51,061
  • 28
  • 99
  • 211
DudiD
  • 215
  • 2
  • 7
  • 16
  • 1
    Please edit your question to include an [sscce](http://sscce.org/) that exhibits the problem you describe. – trashgod Jun 14 '12 at 05:36
  • 1
    can only emphasize @trashgod 's comment - without it's _impossible_ to help. BTW: calling updateUI is _always_ wrong - if its random calling appears to solve a particular problem, something is severely wrong ... – kleopatra Aug 17 '12 at 15:55

2 Answers2

0

Try

table.repaint();
table.revalidate();
0

To get functioning controls in a panel, you'll need not just a TableCellRenderer but also a CellEditor, as seen in this example. As @kleopatra comments, updateUI() should not be required.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045