I just dissected the entire reading of "How to use JLayered Panes"...
- Swing Container with 2 depths
- Adding components to LayeredPanes - specify depth as an integer.
- Higher number is something that's closer to the top.
- Component Overlap: Closer Components have a larger depth than Farther Components.
- 2 Layered Panes
- JLayered Panes
- JDesktop Panes
- No Argument Constructor
- Adding Components and Setting the Depth
- createColoredLabel
- Opaque
- Background Colour
- Border
- Text
- Size
- add
- component to add
- integer object - specifying depth
- actual values don't matter. they are all relative values to the depth.
- depth
- components at higher depth are on top of the ones with a lower depth
- setLayer method (component, new depth, position within depth)
- setLayer method (component, new depth)
- Setting Component Position Within Depth
- Use Integer
- setLayer - int
- add (component, Integer, position within depth)
- Determine Componential Relationship
- Position between -1 and (n-1) means the number of components at that depth.
- The smaller the position number, the higher the component
- Using -1 is the same as (n-1) and it means the bottommost position
- Using 0 means the topmost position within the depth
- Layout Components
- Default: No layout manager
- setBounds (size, position)
- Possible to assign layouts (like borderLayout or gridLayout)
I think it makes much more sense.
So perhaps in that case, I'll make the gamePieces a depth of 1; and the pawns a depth of 3.
No comments:
Post a Comment