getParent
getParent: (Component) -> Container?The container this component is in, or nil: the very object the plugin built, with its fields.
Box.createGlue()
Box.createHorizontalGlue()
Box.createVerticalGlue()| Method | Returns | Description |
|---|---|---|
getParent() | Container? | The container this component is in, or nil: the very object the plugin built, with its fields. |
isValid() | boolean | Whether the component is laid out (validate() ran since anything changed). |
invalidate() | () | Marks the component, and its ancestors up to the first invalid one, as needing a layout. Requests nothing. |
validate() | () | Lays the component out now, if it is displayable: every invalid container at and under it, top down. A component that is not displayable la… |
revalidate() | () | Invalidates the component and queues its validate root to be laid out at the next slot. |
repaint() | () | (Component) -> (): Asks for the component to be painted again. |
repaint(number, number, number, number) | () | |
repaint(number, number, number, number, number) | () | |
isDisplayable() | boolean | Whether the component's surface is attached (a registered panel, an open popup): what Swing calls having a peer. |
isShowing() | boolean | Whether the component is on screen: displayable, and it and every ancestor visible. |
addNotify() | () | Runs when the component becomes displayable; an override calls X.super.addNotify(self) to reach the children. |
removeNotify() | () | Runs when the component stops being displayable; an override calls X.super.removeNotify(self) to reach the children. |
isVisible() | boolean | Whether the component is visible (its own flag; see isShowing). |
setVisible(boolean) | () | Shows or hides the component; a layout skips a hidden one. |
isEnabled() | boolean | Whether the component is enabled. A disabled component still receives mouse events (its listeners run; its look ignores them) and no keys. |
setEnabled(boolean) | () | Enables or disables the component (not its children). |
getBackground() | Color? | The background: the component's own, else its nearest ancestor's, else nil. |
setBackground(Color?) | () | Sets the background; nil inherits the parent's again. |
getForeground() | Color? | The foreground: the component's own, else its nearest ancestor's, else nil. |
setForeground(Color?) | () | Sets the foreground; nil inherits the parent's again. |
getFont() | Font? | The font: the component's own, else its nearest ancestor's, else nil. |
setFont(Font?) | () | Sets the font; nil inherits the parent's again. |
setCursor(Cursor?) | () | Sets the mouse cursor shown over the component (Cursor.new(type), Cursor.getPredefinedCursor(type)); nil inherits the parent's. |
getCursor() | Cursor? | The cursor setCursor set, or nil (inherited). |
getName() | string? | The component's name, or nil. |
setName(string?) | () | Names the component. |
isFocusable() | boolean | Whether the component can take focus. |
setFocusable(boolean) | () | Lets the component take focus, or not; a focus owner made unfocusable passes focus on. |
getFocusTraversalKeysEnabled() | boolean | Whether Tab and Shift+Tab traverse focus from the component (else they reach its key listeners). |
setFocusTraversalKeysEnabled(boolean) | () | Whether Tab and Shift+Tab traverse focus from the component. |
requestFocusInWindow() | boolean | Asks for focus within the component's window; the focus events are posted. false when it cannot take focus or already has it. |
requestFocus() | () | Asks for focus, the window's included; the focus events are posted. |
hasFocus() | boolean | Whether the component owns focus. |
isFocusOwner() | boolean | Whether the component owns focus (hasFocus()). |
getX() | number | The x position in the parent. |
getY() | number | The y position in the parent. |
getWidth() | number | The width. |
getHeight() | number | The height. |
getBounds() | Rectangle | The bounds in the parent, as a new Rectangle. |
setBounds(number, number, number, number) | () | (Component, number, number, number, number) -> (): Moves and resizes the component (a layout may change it again). |
setBounds(Rectangle) | () | |
getSize() | Dimension | The size, as a new Dimension. |
setSize(number, number) | () | (Component, number, number) -> (): Resizes the component. |
setSize(Dimension) | () | |
getLocation() | Point | The position in the parent, as a new Point. |
setLocation(number, number) | () | (Component, number, number) -> (): Moves the component. |
setLocation(Point) | () | |
getPreferredSize() | Dimension | The preferred size: the size set with setPreferredSize, else the look's or the layout's, else Component's default. The native member: a… |
setPreferredSize(Dimension?) | () | Sets the preferred size; nil computes it again. Invalidates nothing and requests nothing: a parent's cached size stays until something el… |
isPreferredSizeSet() | boolean | Whether a preferred size was set. |
getMinimumSize() | Dimension | The minimum size (the native member). |
setMinimumSize(Dimension?) | () | Sets the minimum size; nil computes it again. |
getMaximumSize() | Dimension | The maximum size (the native member). |
setMaximumSize(Dimension?) | () | Sets the maximum size; nil computes it again. |
addMouseListener(MouseListener) | () | Adds a MouseListener (a MouseAdapter subclass, or any table with the methods it needs): it runs on presses, releases, clicks, enters an… |
removeMouseListener(any) | () | Removes a MouseListener, by identity. |
getMouseListeners() | {any} | A copy of the MouseListeners, in registration order. |
addMouseMotionListener(any) | () | Adds a MouseMotionListener: it runs on moves and drags. |
removeMouseMotionListener(any) | () | Removes a MouseMotionListener, by identity. |
getMouseMotionListeners() | {any} | A copy of the MouseMotionListeners, in registration order. |
addMouseWheelListener(any) | () | Adds a MouseWheelListener (a table, or a function of the event). |
removeMouseWheelListener(any) | () | Removes a MouseWheelListener, by identity. |
addKeyListener(KeyListener) | () | Adds a KeyListener: it runs on the keys the component receives as focus owner, before the key's bindings and the editor. |
removeKeyListener(any) | () | Removes a KeyListener, by identity. |
getKeyListeners() | {any} | A copy of the KeyListeners, in registration order. |
addFocusListener(any) | () | Adds a FocusListener (focusGained, focusLost). |
removeFocusListener(any) | () | Removes a FocusListener, by identity. |
getFocusListeners() | {any} | A copy of the FocusListeners, in registration order. |
addComponentListener(any) | () | Adds a ComponentListener: resized, moved, shown, hidden, posted after the change. |
removeComponentListener(any) | () | Removes a ComponentListener, by identity. |
dispatchEvent(any) | () | Delivers an AWT mouse, key, focus or component event to this component's listeners of its kind, now, as the same object; the look's own beh… |
init(Component) | () | The implicit no-argument constructor: the fresh state a node of this kind starts with, and nothing more. Construction runs it as every nati… |
isInstance(any) | boolean | Whether obj is a Component object, a class(Component) subclass's included. |
| Field | Type | Description |
|---|---|---|
TOP_ALIGNMENT | number | Component.TOP_ALIGNMENT: 0. |
CENTER_ALIGNMENT | number | Component.CENTER_ALIGNMENT: 0.5. |
BOTTOM_ALIGNMENT | number | Component.BOTTOM_ALIGNMENT: 1. |
LEFT_ALIGNMENT | number | Component.LEFT_ALIGNMENT: 0. |
RIGHT_ALIGNMENT | number | Component.RIGHT_ALIGNMENT: 1. |
| Method | Returns | Description |
|---|---|---|
AwtInputEvent.getComponent | Component? | The component, as getSource(). |
AwtInputEvent.getSource | Component? | The component the event is about, for an event a Swing listener is handed (a panel's mouse, wheel or key listener): the component the liste… |
AwtWindow.getFocusOwner | Component? | The component that has focus in the window while it is focused, else nil. |
AwtWindow.getMostRecentFocusOwner | Component? | The component that gets focus when the window is focused again: the focus owner, or the last one. |
BoxClass.createGlue | Component | A filler that grows both ways. |
BoxClass.createHorizontalGlue | Component | A filler that grows horizontally. |
BoxClass.createHorizontalStrut | Component | A fixed-width filler. |
BoxClass.createRigidArea | Component | A fixed-size filler. |
BoxClass.createVerticalGlue | Component | A filler that grows vertically. |
BoxClass.createVerticalStrut | Component | A fixed-height filler. |
ComponentEvent.getComponent | Component? | The component, as getSource(). |
Container.add | Component | (Container, Component) -> Component: Adds comp last (taking it from any container it was in), and answers it. Invalidates this containe… |
Container.getComponent | Component | The child at index n (from 0). |
Container.getComponents | {Component} | The children, in index order (array index 1 is child index 0: the top-most). |
FocusEvent.getOppositeComponent | Component? | The other component in the change, or nil (another window, the game). |
JComponent.getComponentPopupMenu | Component? | The popup menu shown on a popup trigger (a right click) over it: its own, or with setInheritsPopupMenu(true) its parent's. |
JLabel.getLabelFor | Component? | The component this label labels, or nil. |
JSpinner.getEditor | Component? | The editor: a JSpinner.DefaultEditor holding the formatted field (getEditor():getTextField()). |
JSpinnerDefaultEditor.getSpinner | Component? | The spinner it edits, or nil. |
JSpinnerDefaultEditor.getTextField | Component? | The formatted field it shows the value in. |
JViewport.getView | Component? | The view, or nil. |
SwingEvent.getSource | Component? | The component the event is about, or nil when its source is not a component (a model) or was collected since. |
getParentgetParent: (Component) -> Container?The container this component is in, or nil: the very object the plugin built, with its fields.
isValidisValid: (Component) -> booleanWhether the component is laid out (validate() ran since anything changed).
invalidateinvalidate: (Component) -> ()Marks the component, and its ancestors up to the first invalid one, as needing a layout. Requests nothing.
validatevalidate: (Component) -> ()Lays the component out now, if it is displayable: every invalid container at and under it, top down. A component that is not displayable lays out nothing.
revalidaterevalidate: (Component) -> ()Invalidates the component and queues its validate root to be laid out at the next slot.
repaintrepaint: ((Component) -> ()) & ((Component, number, number, number, number) -> ()) & ((Component, number, number, number, number, number) -> ())(Component) -> (): Asks for the component to be painted again.
(Component, number, number, number, number) -> (): Asks for a rectangle of the component, in its own coordinates, to be painted again.
(Component, number, number, number, number, number) -> (): Asks for a rectangle to be painted again within tm milliseconds (it is now).
isDisplayableisDisplayable: (Component) -> booleanWhether the component's surface is attached (a registered panel, an open popup): what Swing calls having a peer.
isShowingisShowing: (Component) -> booleanWhether the component is on screen: displayable, and it and every ancestor visible.
addNotifyaddNotify: (Component) -> ()Runs when the component becomes displayable; an override calls X.super.addNotify(self) to reach the children.
removeNotifyremoveNotify: (Component) -> ()Runs when the component stops being displayable; an override calls X.super.removeNotify(self) to reach the children.
isVisibleisVisible: (Component) -> booleanWhether the component is visible (its own flag; see isShowing).
setVisiblesetVisible: (Component, boolean) -> ()Shows or hides the component; a layout skips a hidden one.
isEnabledisEnabled: (Component) -> booleanWhether the component is enabled. A disabled component still receives mouse events (its listeners run; its look ignores them) and no keys.
setEnabledsetEnabled: (Component, boolean) -> ()Enables or disables the component (not its children).
getBackgroundgetBackground: (Component) -> Color?The background: the component's own, else its nearest ancestor's, else nil.
setBackgroundsetBackground: (Component, Color?) -> ()Sets the background; nil inherits the parent's again.
getForegroundgetForeground: (Component) -> Color?The foreground: the component's own, else its nearest ancestor's, else nil.
setForegroundsetForeground: (Component, Color?) -> ()Sets the foreground; nil inherits the parent's again.
getFontgetFont: (Component) -> Font?The font: the component's own, else its nearest ancestor's, else nil.
setFontsetFont: (Component, Font?) -> ()Sets the font; nil inherits the parent's again.
setCursorsetCursor: (Component, Cursor?) -> ()Sets the mouse cursor shown over the component (Cursor.new(type), Cursor.getPredefinedCursor(type)); nil inherits the parent's.
getCursorgetCursor: (Component) -> Cursor?The cursor setCursor set, or nil (inherited).
getNamegetName: (Component) -> string?The component's name, or nil.
setNamesetName: (Component, string?) -> ()Names the component.
isFocusableisFocusable: (Component) -> booleanWhether the component can take focus.
setFocusablesetFocusable: (Component, boolean) -> ()Lets the component take focus, or not; a focus owner made unfocusable passes focus on.
getFocusTraversalKeysEnabledgetFocusTraversalKeysEnabled: (Component) -> booleanWhether Tab and Shift+Tab traverse focus from the component (else they reach its key listeners).
setFocusTraversalKeysEnabledsetFocusTraversalKeysEnabled: (Component, boolean) -> ()Whether Tab and Shift+Tab traverse focus from the component.
requestFocusInWindowrequestFocusInWindow: (Component) -> booleanAsks for focus within the component's window; the focus events are posted. false when it cannot take focus or already has it.
requestFocusrequestFocus: (Component) -> ()Asks for focus, the window's included; the focus events are posted.
hasFocushasFocus: (Component) -> booleanWhether the component owns focus.
isFocusOwnerisFocusOwner: (Component) -> booleanWhether the component owns focus (hasFocus()).
getXgetX: (Component) -> numberThe x position in the parent.
getYgetY: (Component) -> numberThe y position in the parent.
getWidthgetWidth: (Component) -> numberThe width.
getHeightgetHeight: (Component) -> numberThe height.
getBoundsgetBounds: (Component) -> RectangleThe bounds in the parent, as a new Rectangle.
setBoundssetBounds: ((Component, number, number, number, number) -> ()) & ((Component, Rectangle) -> ())(Component, number, number, number, number) -> (): Moves and resizes the component (a layout may change it again).
(Component, Rectangle) -> (): Moves and resizes the component to r.
getSizegetSize: (Component) -> DimensionThe size, as a new Dimension.
setSizesetSize: ((Component, number, number) -> ()) & ((Component, Dimension) -> ())(Component, number, number) -> (): Resizes the component.
(Component, Dimension) -> (): Resizes the component to d.
getLocationgetLocation: (Component) -> PointThe position in the parent, as a new Point.
setLocationsetLocation: ((Component, number, number) -> ()) & ((Component, Point) -> ())(Component, number, number) -> (): Moves the component.
(Component, Point) -> (): Moves the component to p.
getPreferredSizegetPreferredSize: (Component) -> DimensionThe preferred size: the size set with setPreferredSize, else the look's or the layout's, else Component's default. The native member: an override's X.super.getPreferredSize(self) reaches it.
setPreferredSizesetPreferredSize: (Component, Dimension?) -> ()Sets the preferred size; nil computes it again. Invalidates nothing and requests nothing: a parent's cached size stays until something else invalidates it.
isPreferredSizeSetisPreferredSizeSet: (Component) -> booleanWhether a preferred size was set.
getMinimumSizegetMinimumSize: (Component) -> DimensionThe minimum size (the native member).
setMinimumSizesetMinimumSize: (Component, Dimension?) -> ()Sets the minimum size; nil computes it again.
getMaximumSizegetMaximumSize: (Component) -> DimensionThe maximum size (the native member).
setMaximumSizesetMaximumSize: (Component, Dimension?) -> ()Sets the maximum size; nil computes it again.
addMouseListeneraddMouseListener: (Component, MouseListener) -> ()Adds a MouseListener (a MouseAdapter subclass, or any table with the methods it needs): it runs on presses, releases, clicks, enters and exits, in registration order, and makes the component take the mouse from its parent.
removeMouseListenerremoveMouseListener: (Component, any) -> ()Removes a MouseListener, by identity.
getMouseListenersgetMouseListeners: (Component) -> {any}A copy of the MouseListeners, in registration order.
addMouseMotionListeneraddMouseMotionListener: (Component, any) -> ()Adds a MouseMotionListener: it runs on moves and drags.
removeMouseMotionListenerremoveMouseMotionListener: (Component, any) -> ()Removes a MouseMotionListener, by identity.
getMouseMotionListenersgetMouseMotionListeners: (Component) -> {any}A copy of the MouseMotionListeners, in registration order.
addMouseWheelListeneraddMouseWheelListener: (Component, any) -> ()Adds a MouseWheelListener (a table, or a function of the event).
removeMouseWheelListenerremoveMouseWheelListener: (Component, any) -> ()Removes a MouseWheelListener, by identity.
addKeyListeneraddKeyListener: (Component, KeyListener) -> ()Adds a KeyListener: it runs on the keys the component receives as focus owner, before the key's bindings and the editor.
removeKeyListenerremoveKeyListener: (Component, any) -> ()Removes a KeyListener, by identity.
getKeyListenersgetKeyListeners: (Component) -> {any}A copy of the KeyListeners, in registration order.
addFocusListeneraddFocusListener: (Component, any) -> ()Adds a FocusListener (focusGained, focusLost).
removeFocusListenerremoveFocusListener: (Component, any) -> ()Removes a FocusListener, by identity.
getFocusListenersgetFocusListeners: (Component) -> {any}A copy of the FocusListeners, in registration order.
addComponentListeneraddComponentListener: (Component, any) -> ()Adds a ComponentListener: resized, moved, shown, hidden, posted after the change.
removeComponentListenerremoveComponentListener: (Component, any) -> ()Removes a ComponentListener, by identity.
dispatchEventdispatchEvent: (Component, any) -> ()Delivers an AWT mouse, key, focus or component event to this component's listeners of its kind, now, as the same object; the look's own behaviour (a button's press, say) is not run.
initinit: (Component) -> ()The implicit no-argument constructor: the fresh state a node of this kind starts with, and nothing more. Construction runs it as every native base's super(); new does not take it.
isInstanceisInstance: (any) -> booleanWhether obj is a Component object, a class(Component) subclass's included.