Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Odd effects with Swing - Button pressed changes screen layout

 
Jim Burton
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic