This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman 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 Building Microservices this week in the Design 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 ]
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Odd effects with Swing - Button pressed changes screen layout
 
jQuery in Action, 3rd edition