public abstract class AbstractComponent extends Object implements Component
Component.Alignment| Constructor and Description |
|---|
AbstractComponent() |
| Modifier and Type | Method and Description |
|---|---|
Component |
addBorder(Border border,
String title)
Surrounds this component with a specified border
|
void |
addComponentListener(ComponentListener cl) |
protected abstract TerminalSize |
calculatePreferredSize() |
Component.Alignment |
getAlignment() |
protected List<ComponentListener> |
getComponentListeners() |
protected GUIScreen |
getGUIScreen() |
TerminalSize |
getMinimumSize()
This method is called by the layout system to figure out what the
absolute minimum size is for this component.
|
Container |
getParent() |
TerminalSize |
getPreferredSize()
This method is called by the layout system to figure out how much space
each component will be assigned.
|
Window |
getWindow()
Returns the window which is directly or indirectly containing this component.
|
protected void |
invalidate() |
boolean |
isScrollable()
This method is used by the layout system when it needs to shrink components
because the available space is too small.
|
boolean |
isVisible() |
void |
removeComponentListener(ComponentListener cl) |
void |
setAlignment(Component.Alignment alignment)
Sets the alignment property on the Component which will serve as a hint to the rendering code
as to how to draw the component if it is assigned more space that it asked for.
|
protected void |
setParent(Container parent) |
void |
setPreferredSize(TerminalSize preferredSizeOverride)
If called with a non-null parameter, it will override the component's
own preferred size calculation and instead
getPreferredSize()
will return the value passed in. |
void |
setVisible(boolean visible)
If false, the GUI system will ignore this component in the layout and
drawing stage
|
protected TextGraphics |
transformAccordingToAlignment(TextGraphics graphics,
TerminalSize preferredSize)
Will create a sub-graphic area according to the alignment, if the assigned size is larger
than the preferred size.
|
public Container getParent()
protected void setParent(Container parent)
public void addComponentListener(ComponentListener cl)
addComponentListener in interface Componentpublic void removeComponentListener(ComponentListener cl)
removeComponentListener in interface Componentpublic boolean isVisible()
public void setVisible(boolean visible)
ComponentsetVisible in interface Componentvisible - true if you want the component to be visible, false to
make it hiddenpublic boolean isScrollable()
ComponentisScrollable in interface Componentpublic void setPreferredSize(TerminalSize preferredSizeOverride)
ComponentgetPreferredSize()
will return the value passed in. If called with null, the
calculation will be used again.setPreferredSize in interface ComponentpreferredSizeOverride - Value getPreferredSize() should
return instead of calculating itpublic TerminalSize getPreferredSize()
ComponentgetPreferredSize in interface Componentprotected abstract TerminalSize calculatePreferredSize()
public TerminalSize getMinimumSize()
ComponentgetMinimumSize in interface Componentpublic Component.Alignment getAlignment()
getAlignment in interface Componentpublic void setAlignment(Component.Alignment alignment)
ComponentThe default alignment is also up to each component to decide, see the documentation for the individual component you are using.
setAlignment in interface Componentalignment - Alignment of the componentprotected void invalidate()
protected List<ComponentListener> getComponentListeners()
public Window getWindow()
Componentnull.protected GUIScreen getGUIScreen()
public Component addBorder(Border border, String title)
Componentprotected TextGraphics transformAccordingToAlignment(TextGraphics graphics, TerminalSize preferredSize)
Copyright © 2015. All Rights Reserved.