Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Swing help on server window - ConfigOptions is not rendering

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Cory Max
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Glad to hear you were able to solve your issue!
 
reply
    Bookmark Topic Watch Topic
  • New Topic