This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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 ]
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
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
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
SJCP, SCBCD, SJCD, SCDJWS, SCEA (Part I)
Joined: Aug 17, 2002
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.