This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Odd effects with Swing - Button pressed changes screen layout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Odd effects with Swing - Button pressed changes screen layout" Watch "Odd effects with Swing - Button pressed changes screen layout" New topic
Author

Odd effects with Swing - Button pressed changes screen layout

Jim Burton
Greenhorn

Joined: Oct 03, 2001
Posts: 3
I am having problems with GUI layouts. When certain button is pressed it generates a 'ghost' panel (beside other errors like controlling layout properly). See below code (sorry about formatting):-
// <applet code="TokenProgramTest.class" width=550 height=350>
// </applet>
// c:\jdk1.2.2\bin\appletviewer TokenProgramTest.java

[ February 19, 2002: Message edited by: Cindy Glass ]
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Jim,
Not exactly sure what you are doing, but BorderLayout works like this:
West and East components get to be their preferred width. Your ImagePanels don't have any perferred size so they appear very slim.
North and South components get to be their preferred height. Your topPanel doesn't get enough width to spread out.
To see what is happening you need to place the following line, as the first line, in each of your paint methods:
super.paint( screen );
Then your background colors will be drawn and you can see what is happening better.
Regards,
Manfred.
[ February 20, 2002: Message edited by: Manfred Leonhardt ]
 
wood burning stoves
 
subject: Odd effects with Swing - Button pressed changes screen layout
 
Similar Threads
Clip Board Problem
Clip Board Problem
applet cannot start error in browser ...
A Paint Application with Combo Boxes and Buttons
Maximize button in JDialog