Monday, 6 May 2013

Never Mind...

Oops..

I just dissected the entire reading of "How to use JLayered Panes"...


  1. Swing Container with 2 depths
  2. Adding components to LayeredPanes  - specify depth as an integer.
  3. Higher number is something that's closer to the top. 
  4. Component Overlap: Closer Components have a larger depth than Farther Components. 
  5. 2 Layered Panes
    1. JLayered Panes
    2. JDesktop Panes
  6. No Argument Constructor
  7. Adding Components and Setting the Depth 
    1. createColoredLabel
      1. Opaque 
      2. Background Colour
      3. Border
      4. Text
      5. Size
    2. add 
      1. component to add
      2. integer object - specifying depth
        1. actual values don't matter. they are all relative values to the depth. 
    3. depth
      1. components at higher depth are on top of the ones with a lower depth 
      2. setLayer method (component, new depth, position within depth) 
      3. setLayer method (component, new depth)
  8. Setting Component Position Within Depth 
    1. Use Integer
    2. setLayer - int
    3. add (component, Integer, position within depth) 
      1. Determine Componential Relationship
    4. Position between -1 and (n-1) means the number of components at that depth. 
      1. The smaller the position number, the higher the component
    5. Using -1 is the same as (n-1) and it means the bottommost position
    6. Using 0 means the topmost position within the depth
  9. Layout Components
    1. Default: No layout manager
    2. setBounds (size, position) 
    3. 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