Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Some code about GUI

 
George Ren
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,everyone.
Recently I am working on FBNS. First I created a dialog to allow user to select which model(Remote or Local)to use. I use JBuilder 9 to do the job, the .java file is compiled successfully, but when I run this gui, it displaies only the area of label of the window. I try to set size to the panel, but It seems don't work. Now I paste the code, please help me see it. Thanks.

[ October 01, 2003: Message edited by: Mark Spritzler ]
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11865
194
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi George,
One problem is that since you do not have a layout manager for the panel, when you call the pack() method, the panel cannot calculate it's preferred size. If you set the panel's preferred size, that problem will be avoided.
Regards, Andrew
 
George Ren
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Andrew, I will try.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would also look at your indentation of your code, and the variable naming. It appears a couple of places that it does not follow Sun's standards. And a variable name like "panel1" is a very bad name for that variable. variables should be more descriptive as to what it actually is.
I am also going to need to remove most of your code, just because it gives too much away to another test taker. I will leave the part of the code that relates to your question.
Thanks
Mark
 
Dushy Inguva
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello George,
Its probably better to use a LayoutManager. Sun usually insists about using a LayoutManager.
As part of the requirements, you are supposed to provide a framework for GUI development. It would fit in better if you use a layout manager.
Thanks
Dushy
 
George Ren
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank all of you for giving me the advice.
Mark, I will change the panel's name and I will not give out any code that doesn't relate to the problem.
Dushyanth,thank you for your advice. I will try to use a Layout manager in my implementation.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic