Class CardLayout
java.lang.Object
com.blackrook.gui.layout.CardLayout
- All Implemented Interfaces:
GUILayout
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintvoidresizeChild(GUIObject object, int index, int childTotal) Called when a child object needs resizing.voidsetActiveCard(String activeCard) Sets which card is supposed to be visible by an identifier.voidsetActiveIndex(int activeIndex) Sets which card is supposed to be visible by its child index.
-
Field Details
-
objectRef
Reference to object bound to this layout. -
activeCard
Identifier for the active card. -
activeIndex
protected int activeIndexIndex used for the active card.
-
-
Constructor Details
-
CardLayout
Creates a new CardLayout.- Parameters:
objectRef- should be the reference to the object using this layout. Used for triggering child visibility when the active card changes.
-
-
Method Details
-
setActiveCard
Sets which card is supposed to be visible by an identifier. The object that has this identifier as an attribute will be set as visible. This resets the active index.- Parameters:
activeCard- the id to set as the identifier of the active object.
-
setActiveIndex
public void setActiveIndex(int activeIndex) Sets which card is supposed to be visible by its child index. This nullifies the active identifier, if it was in use.- Parameters:
activeIndex- the index to set as the active object.
-
getActiveCard
- Returns:
- the name of which card is supposed to be visible.
-
getActiveIndex
public int getActiveIndex()- Returns:
- the index of which card is supposed to be visible.
-
resizeChild
Description copied from interface:GUILayoutCalled when a child object needs resizing. DO NOT RESIZE THE PARENT OBJECT IN THIS METHOD, AS IT MAY CAUSE AN INFINITE LOOP TO OCCUR.- Specified by:
resizeChildin interfaceGUILayout- Parameters:
object- the object to resize.index- the child index while traversing through the list of children.childTotal- the total number of children.
-