This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JFrame re-sizing, what methods are called? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JFrame re-sizing, what methods are called?" Watch "JFrame re-sizing, what methods are called?" New topic

JFrame re-sizing, what methods are called?

Harold Lime
Ranch Hand

Joined: Jul 20, 2009
Posts: 38
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.


Darryl Burke

Joined: May 03, 2008
Posts: 4950

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.

luck, db
There are no new questions, but there may be new answers.
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2356
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

Joined: Jul 20, 2009
Posts: 38

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.

Don't get me started about those stupid light bulbs.
subject: JFrame re-sizing, what methods are called?
It's not a secret anymore!