• Post Reply Bookmark Topic Watch Topic
  • New Topic

using JPanel for everything  RSS feed

 
Paul Keohan
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • 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.
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • 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.
 
David Brafford
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!