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 Component
public void removeComponentListener(ComponentListener cl)
removeComponentListener
in interface Component
public boolean isVisible()
public void setVisible(boolean visible)
Component
setVisible
in interface Component
visible
- true if you want the component to be visible, false to
make it hiddenpublic boolean isScrollable()
Component
isScrollable
in interface Component
public void setPreferredSize(TerminalSize preferredSizeOverride)
Component
getPreferredSize()
will return the value passed in. If called with null
, the
calculation will be used again.setPreferredSize
in interface Component
preferredSizeOverride
- Value getPreferredSize()
should
return instead of calculating itpublic TerminalSize getPreferredSize()
Component
getPreferredSize
in interface Component
protected abstract TerminalSize calculatePreferredSize()
public TerminalSize getMinimumSize()
Component
getMinimumSize
in interface Component
public Component.Alignment getAlignment()
getAlignment
in interface Component
public void setAlignment(Component.Alignment alignment)
Component
The default alignment is also up to each component to decide, see the documentation for the individual component you are using.
setAlignment
in interface Component
alignment
- Alignment of the componentprotected void invalidate()
protected List<ComponentListener> getComponentListeners()
public Window getWindow()
Component
null
.protected GUIScreen getGUIScreen()
public Component addBorder(Border border, String title)
Component
protected TextGraphics transformAccordingToAlignment(TextGraphics graphics, TerminalSize preferredSize)
Copyright © 2015. All Rights Reserved.