|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jmex.bui.BComponent
public class BComponent
The basic entity in the BUI user interface system. A hierarchy of components and component derivations make up a user interface.
| Field Summary | |
|---|---|
protected float |
_alpha
|
protected BBackground[] |
_backgrounds
|
protected static IntBuffer |
_bbuf
Temporary storage for scissor box queries. |
protected BBorder[] |
_borders
|
protected ColorRGBA[] |
_colors
|
protected BCursor |
_cursor
|
protected boolean |
_enabled
|
protected int |
_height
|
protected boolean |
_hover
|
protected Insets[] |
_insets
|
protected ArrayList<ComponentListener> |
_listeners
|
protected BContainer |
_parent
|
protected Dimension |
_preferredSize
|
protected HashMap<String,Object> |
_properties
|
protected String |
_styleClass
|
protected boolean |
_tipmouse
|
protected String |
_tipStyle
|
protected String |
_tiptext
|
protected boolean |
_valid
|
protected boolean |
_visible
|
protected int |
_width
|
protected int |
_x
|
protected int |
_y
|
static int |
DEFAULT
The default component state. |
static int |
DISABLED
A component state indicating that the component is disabled. |
static int |
HOVER
A component state indicating that the mouse is hovering over the component. |
protected static int |
STATE_COUNT
|
protected static String[] |
STATE_PCLASSES
|
| Constructor Summary | |
|---|---|
BComponent()
|
|
| Method Summary | |
|---|---|
boolean |
acceptsFocus()
Returns whether or not this component accepts the keyboard focus. |
void |
addListener(ComponentListener listener)
Adds a listener to this component. |
static void |
applyDefaultStates()
|
String |
boundsToString()
Returns our bounds as a nicely formatted string. |
protected boolean |
changeCursor()
Returns true if the component should update the mouse cursor. |
protected Dimension |
computePreferredSize(int whint,
int hhint)
Computes and returns a preferred size for this component. |
protected void |
configureStyle(BStyleSheet style)
Instructs this component to fetch its style configuration from the supplied style sheet. |
protected BComponent |
createTooltipComponent(String tiptext)
Creates the component that will be used to display our tooltip. |
boolean |
dispatchEvent(BEvent event)
Instructs this component to process the supplied event. |
protected boolean |
emitEvent(BEvent event)
Dispatches an event emitted by this component. |
int |
getAbsoluteX()
Returns the x position of this component in absolute screen coordinates. |
int |
getAbsoluteY()
Returns the y position of this component in absolute screen coordinates. |
float |
getAlpha()
Returns the alpha transparency of this component. |
BBackground |
getBackground()
Returns a reference to the background used by this component. |
BBorder |
getBorder()
Returns the currently active border for this component. |
Rectangle |
getBounds()
Returns the bounds of this component in a new rectangle. |
ColorRGBA |
getColor()
Returns the (foreground) color configured for this component. |
BCursor |
getCursor()
Returns a reference to the cursor used by this component. |
protected String |
getDefaultStyleClass()
Returns the default stylesheet class to be used for all instances of this component. |
BComponent |
getFocusTarget()
Returns the component that should receive focus if this component is clicked. |
int |
getHeight()
Returns the height of this component. |
BComponent |
getHitComponent(int mx,
int my)
Returns the component "hit" by the specified mouse coordinates which might be this component or any of its children. |
Insets |
getInsets()
Returns the insets configured on this component. |
protected BComponent |
getNextFocus()
Searches for the next component that should receive the keyboard focus. |
BContainer |
getParent()
Returns the parent of this component in the interface hierarchy. |
Dimension |
getPreferredSize(int whint,
int hhint)
Returns the preferred size of this component, supplying a width and or height hint to the component to inform it of restrictions in one of the two dimensions. |
protected BComponent |
getPreviousFocus()
Searches for the previous component that should receive the keyboard focus. |
Object |
getProperty(String key)
Returns the user defined property mapped to the specified key, or null. |
int |
getState()
Returns the state of this component, either DEFAULT or DISABLED. |
protected int |
getStateCount()
Returns the number of different states that this component can take. |
protected String |
getStatePseudoClass(int state)
Returns the pseudoclass identifier for the specified component state. |
String |
getStyleClass()
Returns the Style class to be used for this component. |
String |
getTooltipText()
Returns the tooltip text configured for this component. |
int |
getWidth()
Returns the width of this component. |
protected BWindow |
getWindow()
Returns the window that defines the root of our component hierarchy. |
int |
getX()
Returns the x coordinate of this component. |
int |
getY()
Returns the y coordinate of this component. |
boolean |
hasFocus()
Returns true if this component has the focus. |
protected static boolean |
intersectScissorBox(Rectangle store,
int x,
int y,
int width,
int height)
Activates scissoring and sets the scissor region to the intersection of the current region (if any) and the specified rectangle. |
void |
invalidate()
Marks this component as invalid and needing a relayout. |
boolean |
isAdded()
Returns true if this component is added to a hierarchy of components that culminates in a top-level window. |
boolean |
isEnabled()
Returns true if this component is enabled and responding to user interaction, false if not. |
boolean |
isShowing()
Returns true if this component is both added to the interface hierarchy and visible, false if not. |
boolean |
isTooltipRelativeToMouse()
Returns true if the tooltip window should be position relative to the mouse. |
boolean |
isValid()
Returns true if this component has been validated and laid out. |
boolean |
isVisible()
Returns true if this component is visible, false if it is not. |
protected void |
layout()
Instructs this component to lay itself out. |
void |
removeAllListeners()
Removes all listeners registered on this component. |
boolean |
removeListener(ComponentListener listener)
Removes a listener from this component. |
void |
render(Renderer renderer)
Translates into the component's coordinate space, renders the background and border and then calls renderComponent(com.jme.renderer.Renderer) to allow the component to render itself. |
protected void |
renderBackground(Renderer renderer)
Renders the background for this component. |
protected void |
renderBorder(Renderer renderer)
Renders the border for this component. |
protected void |
renderComponent(Renderer renderer)
Renders any custom bits for this component. |
void |
requestFocus()
Requests that this component be given the input focus. |
protected static void |
restoreScissorState(boolean enabled,
Rectangle rect)
Restores the previous scissor state after a call to intersectScissorBox(com.jmex.bui.util.Rectangle, int, int, int, int). |
void |
setAlpha(float alpha)
Sets the alpha level for this component. |
void |
setBackground(int state,
BBackground background)
Configures the background for this component for the specified state. |
void |
setBounds(int x,
int y,
int width,
int height)
Sets the bounds of this component in screen coordinates. |
void |
setCursor(BCursor cursor)
Configures the cursor for this component. |
void |
setEnabled(boolean enabled)
Sets this components enabled state. |
void |
setLocation(int x,
int y)
Sets the upper left position of this component in absolute screen coordinates. |
void |
setParent(BContainer parent)
Informs this component of its parent in the interface heirarchy. |
void |
setPreferredSize(Dimension preferredSize)
Configures the preferred size of this component. |
void |
setPreferredSize(int width,
int height)
Configures the preferred size of this component. |
void |
setProperty(String key,
Object value)
Sets a user defined property on this component. |
void |
setSize(int width,
int height)
Sets the width and height of this component in screen coordinates. |
void |
setStyleClass(String styleClass)
Configures this component with a custom stylesheet class. |
void |
setTooltipRelativeToMouse(boolean mouse)
Sets where to position the tooltip window. |
void |
setTooltipText(String text)
Configures the tooltip text for this component. |
void |
setVisible(boolean visible)
Sets this component's visibility state. |
protected void |
stateDidChange()
Called when the component's state has changed. |
protected void |
updateCursor(BCursor cursor)
Updates the mouse cursor with the supplied cursor. |
void |
validate()
Instructs this component to lay itself out and then mark itself as valid. |
protected void |
wasAdded()
This method is called when we are added to a hierarchy that is connected to a top-level window (at which point we can rely on having a look and feel and can set ourselves up). |
protected void |
wasRemoved()
This method is called when we are removed from a hierarchy that is connected to a top-level window. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT
public static final int HOVER
public static final int DISABLED
protected BContainer _parent
protected String _styleClass
protected Dimension _preferredSize
protected int _x
protected int _y
protected int _width
protected int _height
protected ArrayList<ComponentListener> _listeners
protected HashMap<String,Object> _properties
protected String _tiptext
protected String _tipStyle
protected boolean _tipmouse
protected boolean _valid
protected boolean _enabled
protected boolean _visible
protected boolean _hover
protected float _alpha
protected ColorRGBA[] _colors
protected Insets[] _insets
protected BBorder[] _borders
protected BBackground[] _backgrounds
protected BCursor _cursor
protected static IntBuffer _bbuf
protected static final int STATE_COUNT
protected static final String[] STATE_PCLASSES
| Constructor Detail |
|---|
public BComponent()
| Method Detail |
|---|
public static void applyDefaultStates()
public void setStyleClass(String styleClass)
public String getStyleClass()
public void setParent(BContainer parent)
public BContainer getParent()
public Dimension getPreferredSize(int whint,
int hhint)
public void setPreferredSize(Dimension preferredSize)
public void setPreferredSize(int width,
int height)
setPreferredSize(Dimension).
public int getX()
public int getY()
public int getWidth()
public int getHeight()
public int getAbsoluteX()
public int getAbsoluteY()
public Rectangle getBounds()
public Insets getInsets()
null will never be returned,
an Insets instance with all fields set to zero will be returned instead.
public ColorRGBA getColor()
public String boundsToString()
public BBorder getBorder()
public BBackground getBackground()
public void setBackground(int state,
BBackground background)
public BCursor getCursor()
public void setCursor(BCursor cursor)
public void setAlpha(float alpha)
public float getAlpha()
public void setEnabled(boolean enabled)
public boolean isEnabled()
public void setVisible(boolean visible)
public boolean isVisible()
public boolean isShowing()
public int getState()
DEFAULT or DISABLED.
public void setProperty(String key,
Object value)
public Object getProperty(String key)
public boolean acceptsFocus()
public boolean hasFocus()
public BComponent getFocusTarget()
public void requestFocus()
public void setLocation(int x,
int y)
public void setSize(int width,
int height)
public void setBounds(int x,
int y,
int width,
int height)
setLocation(int, int),
setSize(int, int)public void addListener(ComponentListener listener)
public boolean removeListener(ComponentListener listener)
public void removeAllListeners()
public void setTooltipText(String text)
BLabel.
public String getTooltipText()
public void setTooltipRelativeToMouse(boolean mouse)
mouse - if true, the window will appear relative to the mouse position, if false, the
window will appear relative to the component bounds.public boolean isTooltipRelativeToMouse()
public boolean isAdded()
public boolean isValid()
public void validate()
public void invalidate()
public void render(Renderer renderer)
renderComponent(com.jme.renderer.Renderer) to allow the component to render itself.
public BComponent getHitComponent(int mx,
int my)
public boolean dispatchEvent(BEvent event)
super.dispatchEvent for events that they did not "consume".
protected void layout()
protected Dimension computePreferredSize(int whint,
int hhint)
protected void wasAdded()
protected void configureStyle(BStyleSheet style)
protected void wasRemoved()
wasAdded(), this is a fine place
to do so.
protected BComponent createTooltipComponent(String tiptext)
getTooltipText() returns non-null text.
protected void renderBackground(Renderer renderer)
protected void renderBorder(Renderer renderer)
protected void renderComponent(Renderer renderer)
protected String getDefaultStyleClass()
protected int getStateCount()
protected String getStatePseudoClass(int state)
DISABLED state maps to disabled and is configured like so:
component:disabled {
color: #CCCCCC; // etc.
}
protected void stateDidChange()
protected boolean changeCursor()
protected void updateCursor(BCursor cursor)
protected BWindow getWindow()
protected BComponent getNextFocus()
protected BComponent getPreviousFocus()
protected boolean emitEvent(BEvent event)
dispatchEvent(com.jmex.bui.event.BEvent)
with the event.
protected static boolean intersectScissorBox(Rectangle store,
int x,
int y,
int width,
int height)
restoreScissorState(boolean, com.jmex.bui.util.Rectangle) to restore the previous state.
store - a rectangle to hold the previous scissor region for later restoration
true if scissoring was already enabled, false if it was not.
protected static void restoreScissorState(boolean enabled,
Rectangle rect)
intersectScissorBox(com.jmex.bui.util.Rectangle, int, int, int, int).
enabled - the value returned by intersectScissorBox(com.jmex.bui.util.Rectangle, int, int, int, int), indicating whether or not
scissoring was enabledrect - the scissor box to restore
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||