Lecture 18b - Key Swing Containers o JFrame o o o Is a...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Key Swing Containers o JFrame o Is a window with a title bar, menu bar, and border(inset) o Can be iconified o Is free-floating Ie cannot be nested inside another container o Consists of several layers Has a JRootPane Each JRootPane has a jLayeredPane, JMenuBar, JContentPane, and JGlassPane o Add components to the content pane o JPanel o Is A generic container, always inside some other container Cannot float freely on the screen o Used to group controls together You can nest several JPanels inside another JPanel o Can also e used as an area to draw on o You must extend the class, and override pointComponent() Layout Manager o Are classes that determine where components are placed inside a container o Do not determine exact placement, but implement a general layout policy o If you resize the container, the components may be repositioned or change in size o Use setLayout() to set a container’s layout manager o Eg: myContainer.setLayout(new FlowLayout()); o Set the layout first, then add components o With some layouts, the order in which you add is important
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
o FlowLayout o Places components sequentially from left to right
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/04/2010 for the course CPSC 233 taught by Professor Li during the Fall '09 term at University of Calgary.

Page1 / 5

Lecture 18b - Key Swing Containers o JFrame o o o Is a...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online