Layered Panes - PowerPoint PPT Presentation

1 / 3
About This Presentation
Title:

Layered Panes

Description:

Components at the same depth level are arranged top to bottom (last one added at ... if the mouse is over it and pass the click through (to turn off the glass pane. ... – PowerPoint PPT presentation

Number of Views:29
Avg rating:3.0/5.0
Slides: 4
Provided by: williamm9
Category:

less

Transcript and Presenter's Notes

Title: Layered Panes


1
Layered Panes
  • Manages the painting of components to simulate
    different depths. The highest depth level number
    is on top. Components at the same depth level
    are arranged top to bottom (last one added at the
    bottom).
  • If you add only to the ContentPane you have a
    single layer (managed by a layout manager). The
    user adds a LayeredPane to a ConentPane to
    provided 3D. Adding a layout manager to a
    LayeredPane asks that ALL of the components be
    ordered as if they had been added to the content
    pane from highest depth and top to bottom at each
    depth.
  • Constructor has no arguments. Add() has two or
    three arguments, the first being the component
    and the second being the Integer containing the
    layer depth. setLayer() can change the depth
    dynamically, and its three arguments are
    component, int layer depth, and also the position
    in the layer (0top, -1bottom, and 1 is above 2
    is above 3 )
  • When there is no layout manager, you have to size
    and position each component component.setBounds(x
    ,y,width,height)
  • Component.setLocation(x,y) (Note that the
    component knows its location, hence a layout
    manager sets a new value for each components
    location and bounds)

2
Root Panes
  • Provided in top level containers and internal
    frames.
  • Always contains a Layered Pane, a Content Pane
    and a Glass Pane. The Layered Pane is not the
    one added to the Content Pane for 3D. It holds
    the Content Pane and the Menu, both on the lowest
    level (-3000)
  • The components added to the content pane are
    placed in the default layer (0).
  • The palette layer (100) holds floating tool bars
    or components that cover content.
  • The modal layer (200) displays internal frame
    dialogs
  • The popup layer (300) display above everything
    else.
  • The drag layer (400) is where moving components
    are painted to simulate their motion, and when
    dropped, they retrun to their original layer (0).
  • When dragging, the mouse does not trigger other
    components.

3
The Glass Pane
  • You can place components or graphics on the glass
    pane that will be active ONLY when the glass pane
    is visible. When visible, the glass pane
    OBSTRUCTS interaction with any component below
    it, even though that component may be visible.
  • The trick is to be able to turn the glass pane on
    and off. This is done by placing the on-off
    switch on the content pane, but when it is
    OBSTRUCTED, determine if the mouse is over it and
    pass the click through (to turn off the glass
    pane.
  • We need to walk through the example code with a
    keen eye as to what needs to happen
Write a Comment
User Comments (0)
About PowerShow.com