Class GPanel
java.lang.Object
com.glitchybyte.glib.terminal.display.GPanel
- Direct Known Subclasses:
GRootPanel
Terminal UI panel.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGPanel(int zOrder, int x, int y, int width, int height) Creates a terminal panel. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a child panel to this panel.protected abstract StringCreates the panel imprint.protected voidDraws the panel.protected StringConvenience method to fill the panel area with a glyph and colors.protected StringfillBackground(Integer bgColor) Convenience method to fill the panel with a background color.protected intReturns the distance from the left of the screen to the left side of this panel.protected intReturns the distance from the top of the root panel the top side of this panel.protected StringReturns aStringto move the cursor to the X offset.voidrefresh()Refreshes the imprint.voidRefreshes this panel and all its children.voidSignals this panel's contents have changed and needs to be refreshed.
-
Field Details
-
zOrder
public final int zOrderPanel Z position. Lower number gets drawn first. -
x
public final int xX position. -
y
public final int yY position. -
width
public final int widthPanel width. -
height
public final int heightPanel height. -
rootPanel
Root panel that contains all panels.
-
-
Constructor Details
-
GPanel
public GPanel(int zOrder, int x, int y, int width, int height) Creates a terminal panel.- Parameters:
zOrder- Panel Z position. Lower number gets drawn first.x- X position.y- Y position.width- Panel width.height- Panel height.
-
-
Method Details
-
addPanel
Adds a child panel to this panel.- Parameters:
panel- Child panel.
-
getXOffset
protected int getXOffset()Returns the distance from the left of the screen to the left side of this panel.- Returns:
- The distance from the left of the screen to the left side of this panel.
-
getYOffset
protected int getYOffset()Returns the distance from the top of the root panel the top side of this panel.- Returns:
- The distance from the top of the root panel the top side of this panel.
-
moveToXOffset
Returns aStringto move the cursor to the X offset.- Returns:
- A
Stringto move the cursor to the X offset.
-
createImprint
Creates the panel imprint.This method MUST return the cursor to the same line. Horizontal position is not important.
- Returns:
- A complete imprint of the panel.
-
signalDirty
public void signalDirty()Signals this panel's contents have changed and needs to be refreshed. -
refresh
public void refresh()Refreshes the imprint. -
refreshAll
public void refreshAll()Refreshes this panel and all its children. -
drawPanel
protected void drawPanel()Draws the panel. -
fill
Convenience method to fill the panel area with a glyph and colors.- Parameters:
glyph- Glyph to fill the area with.fgColor- Foreground color.bgColor- Background color.- Returns:
- A
Stringto fill the panel area with a glyph and colors.
-
fillBackground
Convenience method to fill the panel with a background color.- Parameters:
bgColor- Background color.- Returns:
- A
Stringto fill the panel area with a background color.
-