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

using JPanel for everything

 
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it a good idea to use JPanel for everything? For clarity, it makes sense to me. I want to place a list with a header on the left of my frame. I created a label (header) and placed it on a panel, then created a list and placed it on a panel. Then I placed both of these panels on one panel and added this panel to the content pane.
Overdoing it? - or good programming sense?
Advice appreciated.
 
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not if you understand how to use all of the Layout managers. You don't want to put every component onto a separate panel.
 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't put everything on a separate panel, but
panel layering makes good sense for UI design
and re-use. This is known as the
Composite View pattern - building your final
presentable UI from a series of panels.
Also, when you create your panels, create
Model objects to further separate and
componentize your UI code - using the simpler
Model/View pattern ( versus Model View Controller ). There should be a parallel
structure for your Views and Models. Parent
views know about children, but children do not
know about parents. Parent Models know about
child models, but children do not know about
their parents. A View knows about it's model,
but the model does not know about the view.
-----------------------------------
Considering the Certified Java Programmer Exam?
Get JCertify!
Now available for both 1.2 and 1.4 platform exams
http://www.enterprisedeveloper.com/jcertify
reply
    Bookmark Topic Watch Topic
  • New Topic