• Post Reply Bookmark Topic Watch Topic
  • New Topic

Issue in Displaying panel  RSS feed

 
Raj kalaria
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • 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.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • 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





 
Mohamed Sanaulla
Bartender
Posts: 3174
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • 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.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!