Conversion awt to swing JFrame goes blank

I have been attempting convert an AWT UI to Swing. At first I tried just changing everything and that didn't work (blank screen) So I started converting the UI in reverse. Buttons to JButton's , panels to JPanels ect.

I have no problems until the end when I attempt to change from a Frame to a JFrame. Once I do I get a few seconds of my JFrame with my JMenubar then the entire JFrame goes blank (grey)

If I use a MenuBar I get the same thing except the menubar is still there.

I have read through the posts and docs. I assumed it was a getContentPane() problem. But I have all of the Add and setLayout going to the ContentPane...So I'm a bit lost.

Any ideas?

[695 byte] By [xavier33a] at [2007-10-3 3:29:34]
# 1
only a guessperhaps you still have some left-over awt components. mixing awt and swing components often causes funny things to happen in painting.post the code.
Michael_Dunna at 2007-7-14 21:23:23 > top of Java-index,Desktop,Core GUI APIs...
# 2

I finally figured out that the problem was calls to removeAll(). Apparently with awt the menubar and frame were not cleared. But with swing everything is removed jframe, jmenubar ect.

The problem now is that the jpanels are not being cleared and new jpanels are just being placed on top of the old ones. Any ideas what I can use?

Message was edited by:

xavier33

xavier33a at 2007-7-14 21:23:23 > top of Java-index,Desktop,Core GUI APIs...
# 3
After adding or removing components from a JPanel you need to revalidate() the panel. Sometimes you also need to do a repaint();
camickra at 2007-7-14 21:23:23 > top of Java-index,Desktop,Core GUI APIs...