|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.threerings.opengl.gui.Component
public class Component
The basic entity in the UI user interface system. A hierarchy of components and component derivations make up a user interface.
| Field Summary | |
|---|---|
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. |
| Constructor Summary | |
|---|---|
Component(GlContext ctx)
Creates a new component. |
|
| Method Summary | |
|---|---|
boolean |
acceptsFocus()
Returns whether or not this component accepts the keyboard focus. |
void |
addListener(ComponentListener listener)
Adds a listener to this component. |
String |
boundsToString()
Returns our bounds as a nicely formatted string. |
void |
configUpdated(ConfigEvent<ManagedConfig> event)
Called when a configuration has been updated. |
boolean |
contains(int mx,
int my)
Determines whether this component contains the specified coordinates. |
static Component |
createDefaultTooltipComponent(GlContext ctx,
String tiptext)
Creates a tooltip component of the default form with the default style. |
static Component |
createDefaultTooltipComponent(GlContext ctx,
String tiptext,
ConfigReference<StyleConfig> tipstyle)
Creates a tooltip component of the default form. |
boolean |
dispatchEvent(Event event)
Instructs this component to process the supplied event. |
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. |
Background |
getBackground()
Returns a reference to the background used by this component. |
Border |
getBorder()
Returns the currently active border for this component. |
Rectangle |
getBounds()
Returns the bounds of this component in a new rectangle. |
Color4f |
getColor()
Returns the (foreground) color configured for this component. |
GlContext |
getContext()
Returns a reference to the component context. |
Cursor |
getCursor()
Returns a reference to the cursor used by this component. |
Component |
getFocusTarget()
Returns the component that should receive focus if this component is clicked. |
int |
getHeight()
Returns the height of this component. |
Component |
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. |
Container |
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. |
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. |
StyleConfig[] |
getStyleConfigs()
Returns a reference to the component's array of style configs. |
String |
getTooltipText()
Returns the tooltip text configured for this component. |
float |
getTooltipTimeout()
Returns the component's tooltip timeout, or -1 to use the default. |
String |
getTooltipWindowStyle()
Returns a reference to the component's tooltip window style config. |
TransferHandler |
getTransferHandler()
Returns the transfer handler for this component. |
int |
getWidth()
Returns the width of this component. |
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. |
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 |
isHoverable()
Returns this component's hoverability state. |
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. |
void |
removeAllListeners()
Removes all listeners registered on this component. |
void |
removeAllListeners(Class<? extends ComponentListener> clazz)
Removes all listeners of the specified class. |
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.threerings.opengl.renderer.Renderer) to allow the component to render itself. |
void |
requestFocus()
Requests that this component be given the input focus. |
void |
scrollRectToVisible(int x,
int y,
int w,
int h)
Request to have the specified rectangle, in this component's coordinate space, scrolled into view. |
void |
setAlpha(float alpha)
Sets the alpha level for this component. |
void |
setBackground(int state,
Background 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(Cursor cursor)
Configures the cursor for this component. |
void |
setEnabled(boolean enabled)
Sets this components enabled state. |
void |
setHoverable(boolean hoverable)
Sets this component's hoverability state. |
void |
setLocation(int x,
int y)
Sets the upper left position of this component in absolute screen coordinates. |
void |
setParent(Container 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 |
setStyleConfig(ConfigReference<StyleConfig> ref)
Sets the style configuration. |
void |
setStyleConfig(String name)
Sets the style configuration. |
void |
setStyleConfig(String name,
String firstKey,
Object firstValue,
Object... otherArgs)
Sets the style configuration. |
void |
setStyleConfigs(StyleConfig... styleConfigs)
Sets the style configurations. |
void |
setTooltipRelativeToMouse(boolean mouse)
Sets where to position the tooltip window. |
void |
setTooltipText(String text)
Configures the tooltip text for this component. |
void |
setTransferHandler(TransferHandler handler)
Sets the transfer handler for this component. |
void |
setVisible(boolean visible)
Sets this component's visibility state. |
void |
validate()
Instructs this component to lay itself out and then mark itself as valid. |
| Methods inherited from class java.lang.Object |
|---|
equals, 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
| Constructor Detail |
|---|
public Component(GlContext ctx)
| Method Detail |
|---|
public static Component createDefaultTooltipComponent(GlContext ctx,
String tiptext)
public static Component createDefaultTooltipComponent(GlContext ctx,
String tiptext,
ConfigReference<StyleConfig> tipstyle)
public GlContext getContext()
public void setStyleConfig(String name)
public void setStyleConfig(String name,
String firstKey,
Object firstValue,
Object... otherArgs)
public void setStyleConfig(ConfigReference<StyleConfig> ref)
public void setStyleConfigs(StyleConfig... styleConfigs)
public StyleConfig[] getStyleConfigs()
public String getTooltipWindowStyle()
public void setParent(Container parent)
public Container 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 Color4f getColor()
public String boundsToString()
public Border getBorder()
public Background getBackground()
public void setBackground(int state,
Background background)
public Cursor getCursor()
public void setCursor(Cursor 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 void setHoverable(boolean hoverable)
public boolean isHoverable()
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 Component 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 removeAllListeners(Class<? extends ComponentListener> clazz)
public void setTooltipText(String text)
Label.
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 float getTooltipTimeout()
public void setTransferHandler(TransferHandler handler)
public TransferHandler getTransferHandler()
public boolean isAdded()
public boolean isValid()
public void validate()
public void invalidate()
public void render(Renderer renderer)
renderComponent(com.threerings.opengl.renderer.Renderer) to allow the component to render itself.
public Component getHitComponent(int mx,
int my)
public boolean contains(int mx,
int my)
public void scrollRectToVisible(int x,
int y,
int w,
int h)
public boolean dispatchEvent(Event event)
super.dispatchEvent for events that they did not "consume".
public void configUpdated(ConfigEvent<ManagedConfig> event)
ConfigUpdateListener
configUpdated in interface ConfigUpdateListener<ManagedConfig>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||