Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JFrame re-sizing, what methods are called?

 
Harold Lime
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got a bit of a problem, I'm using a transparent JTable, when I change the data on it I can still see the old value that was in the cell before.

The only way I can get rid of it (so far) is to resize the frame, so what methods are called when a frame resizes?

I've tried invalidate(), validate() and doLayout() on the contentPane but none of them are helping.

For now I'm stuck using:
frame.setSize(frame.getWidth(), frame.getHeight() + 1);
frame.setSize(frame.getWidth(), frame.getHeight() - 1);

There's got to be a better way.

Any help greatly appreciated.

Thanks

Harry
 
Darryl Burke
Bartender
Posts: 5132
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could try a repaint() on the JTable's parent (note: that isn't the JFrame).

How/why did you implement transparency for the table?

Lastly, to get better help sooner, post a SSCCE (Short, Self Contained, Compilable and Executable, Example Program) that clearly demonstrates the problem.
 
Rob Camick
Ranch Hand
Posts: 2600
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Works fine for me. I used code like the following:



For more help you should create a SSCCE, that demonstrates the incorrect behaviour.
 
Harold Lime
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorted.

I had set the background of the one of JPanels involved to new Color(0,0,0,0) rather than setOpaque(false).

Thanks for the help.

Harry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic