File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Odd effects with Swing - Button pressed changes screen layout
 
Similar Threads
applet cannot start error in browser ...
Clip Board Problem
A Paint Application with Combo Boxes and Buttons
Maximize button in JDialog
Clip Board Problem