*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Swing help on server window - ConfigOptions is not rendering Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Swing help on server window - ConfigOptions is not rendering" Watch "Swing help on server window - ConfigOptions is not rendering" New topic
Author

Swing help on server window - ConfigOptions is not rendering

Cory Max
Ranch Hand

Joined: Jul 20, 2005
Posts: 83
Hi All,

I am in the final stages of completing my assignment (urlybird) and am having a problem with swing that I can not figure out. I am following the patterns set out in the monkhouse/cam book using the common 'ConfigOptions' panel in both the server window and the client config dialog. My client config dialog works well... my server window works well in that it shows the menu, status bar, buttons, etc but not the 'ConfigOptions' panel which contains my file name and port number fields. I.e. everything renders perfectly but my panel is missing completely.


If I put in a button where the configOptions are supposed to go, the button renders perfectly. I am not new to java but very new to swing and have no idea on how to start debugging problems like this. Any ideas on where to start?

Thanks,

Yeuker


There are only 10 types of people in this world... Those who understand binary and those who don't.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5455
    
  13

Hi Cory,

Seems there is something wrong with your ConfigOptions. But what could be wrong is just a bit of guessing with such limited information.

Is ConfigOptions a JPanel?
Are you able to add another panel (which contains other controls like buttons, text fields, ...) instead of just a button ? (because I guess such a panel is more similar to your ConfigOptions panel)

My server window is a JFrame and I created a content pane (of type JPanel), which contains all my GUI controls. And then I use the setContentPane() to change the existing content pane with mine. If you create your own content pane, don't forget to make it opaque (as described in the API)

Hope it helps!
Kind regards,
Roel


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Cory Max
Ranch Hand

Joined: Jul 20, 2005
Posts: 83
Hi Roel,

Thanks for the reply. I'd agree that there seems to be something wrong with my ConfigOptions. Weird though that it works well as part of my client config dialog box.

Yes. ConfigOptions a JPanel.

I will try adding another panel that contains other controls... good call.

Will report back later in the day.

Thanks again,

Cory
Cory Max
Ranch Hand

Joined: Jul 20, 2005
Posts: 83
Adding a different jpanel works perfectly. Certainly seems like there is something wrong with my configOptions. Anyone have any thoughts on what could make a JPanel not render?
Cory Max
Ranch Hand

Joined: Jul 20, 2005
Posts: 83
Getting closer all the time...

I'm using 'SpringLayout' as my layout manager for the JPanel. If I comment out the layout setting and control adding... and just do something like this:



It all works good! So to clarify my question...

What would make a JPanel using SpringLayout not render?

I'll keep you posted if I find the solution. Thanks again for leading me in the right direction Roel.

Cory Max
Ranch Hand

Joined: Jul 20, 2005
Posts: 83
OK... got it sorted out. I was not setting the constraint of the container (JFrame). I.e. The JFrame was not being shown because its edges were

Thanks again for getting me rolling.

C
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5455
    
  13

Glad to hear you were able to solve your issue!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Swing help on server window - ConfigOptions is not rendering