• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

grouping labels and buttons in a JPanel with other JPanels

 
Ranch Hand
Posts: 210
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,

So i have been working on my project "changing layouts at runtime" for quite a while now and have it finally working. I am now just trying to make the different layouts look better.
I have grouped together some things on the tempPanel() , which are the Components used in the different layouts picked by the user , using JPanel as shown below..


is this a good practice? is it ok to do it that way ?


example code:



Thanks in advance
Mike
 
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when does the layout change? when clicked on a button? and how are you implementing the change in your listener?

Looking from what you are doing, I think you should make use of CardLayout to display different panels as per the need
 
mike ryan
Ranch Hand
Posts: 210
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ranganathan Kaliyur Mannar wrote:

when does the layout change? when clicked on a button? and how are you implementing the change in your listener?

Looking from what you are doing, I think you should make use of CardLayout to display different panels as per the need



hi,

In this project i am not allowed to use CardLayout although i know how to use it, that is the reason i am doing it this way. the layout is changed either using JRadioButtons in a fixed JPanel, or with a button which produces a random layout <--- just added the random layout for fun.. Like i said, everything is working quite well, just curious if grouping Components together with a JPanel whithin a JPanel is ok to do? or is there a better way of doing it?


Thanks
Mike
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
of course, its perfectly ok to group components through panel and also through a panel of panels.
 
mike ryan
Ranch Hand
Posts: 210
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ranganathan!!


Everything is finally done and looking good then ;)



Mike
 
I need a new interior decorator. This tiny ad just painted every room in my house purple.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic