com.incrediblesoft.redjey
Class Container

java.lang.Object
  extended by com.incrediblesoft.redjey.Component
      extended by com.incrediblesoft.redjey.Container
Direct Known Subclasses:
MenuBar, ScrollBar, ScrollPane, Window

public class Container
extends Component


Field Summary
 
Fields inherited from class com.incrediblesoft.redjey.Component
BOTTOM_LAYOUT, DISABLED, H_EXPAND, HCENTER_LAYOUT, HIGHLIGHTED, LEFT_LAYOUT, NORMAL, PRESSED, RIGHT_LAYOUT, TOP_LAYOUT, TOTAL_STATES, V_EXPAND, VCENTER_LAYOUT
 
Constructor Summary
Container()
          Constructs default container
Container(java.lang.String styleClassName)
          Constructs container with given style class name
 
Method Summary
 Component add(Component c)
          Adds specified component to this container
 void dispatchEvent(AbstractEvent event)
          Dispatches event to children
 Component getComponent(int index)
          Returns component at specified index
 Component getComponentAt(int x, int y, boolean deepSearch)
          Returns component located under the x,y position in this container coordinate system.
 int getComponentCount()
          Returns the count of components
 Layout getLayout()
           
 java.lang.String getName()
          This method is used to retrieve the appropriate style set from a hashtable of styles
 int indexOf(Component c)
          Returns the index of specified component within this container
 Component insertAt(Component c, int index)
          Inserts component at specified index
 void pack()
          Sets the size of container to preferred one.
 void remove(Component c)
          Removes specified component from this container
 void remove(int index)
          Removes component at specified index
 void removeAll()
          Removes all the components from this container
 void setLayout(Layout layout)
          Sets layout to this container
 void tick(int dt)
          Called every tick.
 
Methods inherited from class com.incrediblesoft.redjey.Component
addActionListener, addMouseListener, fireActionEvent, getAbsoluteRect, getAbsoluteX, getAbsoluteY, getAlignment, getBounds, getClientSize, getContentAlignment, getCurrentStyle, getHeight, getParent, getPreferredSize, getState, getStyle, getStyleClass, getWidth, getX, getY, invalidate, invalidateTree, isFocused, isHighlightable, isVisible, keyPressed, keyReleased, paint, removeActonListener, removeMouseListener, repaint, repaint, setAlignment, setBounds, setContentAlignment, setLocation, setPreferredSize, setSize, setSize, setState, setStyle, setStyle, setStyleClass, setTag, setVisible, setX, setY, toString, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Container

public Container()
Constructs default container


Container

public Container(java.lang.String styleClassName)
Constructs container with given style class name

Parameters:
styleClassName - style class name
Method Detail

getName

public java.lang.String getName()
Description copied from class: Component
This method is used to retrieve the appropriate style set from a hashtable of styles

Specified by:
getName in class Component
Returns:
Name of component

getComponentCount

public int getComponentCount()
Returns the count of components

Returns:
count

getComponent

public Component getComponent(int index)
Returns component at specified index

Parameters:
index - index of component
Returns:
component

getComponentAt

public Component getComponentAt(int x,
                                int y,
                                boolean deepSearch)
Returns component located under the x,y position in this container coordinate system. Performs in-depth search.

Parameters:
x - the x coordinate
y - the y coordinate
deepSearch - sets search mode. False means that only top-level component will be returned, true - means perform in-septh search
Returns:
null if the component does not contain the position. If there is no child component at the requested point and the point is within the bounds of the container the container itself is returned;

add

public Component add(Component c)
Adds specified component to this container

Parameters:
c - component
Returns:
component

insertAt

public Component insertAt(Component c,
                          int index)
Inserts component at specified index

Parameters:
c - component
index - index the component is inserted to
Returns:
component itself

remove

public void remove(Component c)
Removes specified component from this container

Parameters:
c - component

remove

public void remove(int index)
Removes component at specified index

Parameters:
index - index

removeAll

public void removeAll()
Removes all the components from this container


indexOf

public int indexOf(Component c)
Returns the index of specified component within this container

Parameters:
c - component
Returns:
index of component, -1 if non was found

setLayout

public void setLayout(Layout layout)
Sets layout to this container

Parameters:
layout - layout

getLayout

public Layout getLayout()
Returns:
layout

pack

public void pack()
Sets the size of container to preferred one.


dispatchEvent

public void dispatchEvent(AbstractEvent event)
Description copied from class: Component
Dispatches event to children

Overrides:
dispatchEvent in class Component

tick

public void tick(int dt)
Description copied from class: Component
Called every tick. Subclasses must override this method to do custom actions that depend on real time.

Overrides:
tick in class Component
Parameters:
dt - time in milliseconds