I have designed this gui in netBeans which has a canvas , a couple of JtextAreas and a Jbutton. It looks great in preview, the problem is when I run the actual program the text areas are shurnk until the program prints something in them, then they expand to their full size, the Jbutton is invisible until I mouse over it then it stays visible, there is also a Jlabel which just doesnt show up in the program at all only in preview. I have designed one more program in netbeans before but did not have these problems. Any idea what I could be doing wrong?
+1
A:
No idea whats wrong, but you should NOT be using a Canvas. That is an AWT component and you should not be using AWT components in a Swing application.
Actually the Canvas could be the problem. AWT components are painted on top of Swing components which could be causing the problem. That might be why the mouse over forces the button to show through the Canvas. I've never mixed AWT/SWING components so I don't know what wierd painting artifacts you will encounter.
camickr
2009-09-14 03:30:53
... the reason being that AWT will eventually be taken out of Java standard. Swing will become Skeletor, and be mercilessly attacking He-man (read: C++) with many devious plots. It should get good and I'm ready to buy the t-shirt.
bobby
2009-09-14 03:34:35
"AWT will eventually be taken out of Java standard." - I don't think so. All Swing components are made using AWT at the low level.
Joonas Pulakka
2009-09-14 04:37:16