• 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
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Issue in Displaying panel

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am stuck up in my Gui design for Swings

I have three panels in my frame
panel 1 will have the symbol(the symbol is on Right Hand Side)
Panel 2 has one lable, two radio button and one file chooser button

panel 3 has a group of check box button

Now initially panel 3 is invisible, once the user selects one of the radio button(New User) from panel 2 it will be visible. if the user select other radio button (Profile user) the panel becomes invisible

My problem is that when i test my application, Panel 2 is takes the space of itself and panel 3, when i press one of the radio button panel 3 becomes visible and the frame looks good(as iwanted) but when the user press another button (profile user) the panel 3 is invisble, but once again panel 2 takes the entire place of frame
and UI looks bad.

I am using NetBeans IDE ( so it takes GroupLayout by default)

Please throw some light so i can try something.
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Raj kalaria:

I am using NetBeans IDE ( so it takes GroupLayout by default)
Please throw some light so i can try something.



Your layout manager is the culprit here. Change it to suit your requirement.
 
Raj kalaria
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks maneesh,
I tried to change the lay out, but it is giving me a hard time.
can you look at my code and suggest, so that i can pick it up from there





 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would suggest you to use a GridLayout with 3 rows and 1 column for the three panels. In this way you can specifically assign the positions for Panels either at run time or during the editing.



This is a small code snippet which shows how to add the Panels.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


off topic, but the above is a really good example of
"why not to use a gui-code-generator"
possibly worth considering as an addition to the swing faq
 
He was giving me directions and I was powerless to resist. I cannot resist this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic