Presentation on theme: "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."— Presentation transcript:
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 (0=top, -1=bottom, 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)
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.
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:example code