public class TextPopup
extends java.lang.Object
HelpScreen
for keyboard shortcut
type help screens.Constructor and Description |
---|
TextPopup(processing.core.PApplet sketch)
Initialises the text popup with default border size and font, but does not
display it [requires
setIsActive(true) ]. |
TextPopup(processing.core.PApplet sketch,
int xBorder,
int yBorder)
Initialises the text popup with default border size and font, but does not
display it [requires
setIsActive(true) ]. |
TextPopup(processing.core.PApplet sketch,
processing.core.PFont font,
int xBorder,
int yBorder)
Initialises the text popup with default border size and the given font, but does not
display it [requires
setIsActive(true) ]. |
Modifier and Type | Method and Description |
---|---|
void |
addText(java.lang.String textLine)
Adds a given line of text to that displayed in the popup window
|
void |
addText(java.lang.String textLine,
float lineTextSize)
Adds a given line of text to that displayed in the popup window
|
void |
clearText()
Clears the text to be displayed in the popup window.
|
void |
draw()
Draws the text in the popup window.
|
java.awt.Dimension |
getExternalMargin()
Reports the external margins between the popup and the sketch.
|
java.awt.Dimension |
getInternalMargin()
Reports the internal margins between the popup and the text displayed within it.
|
boolean |
getIsActive()
Reports whether or not the popup is currently active.
|
float |
getTextSize()
Reports the current text size in pixels.
|
void |
setBackgroundColour(int bgColour)
Sets the background colour of the popup.
|
void |
setExternalMargin(int xMargin,
int yMargin)
Sets the external margin between the popup and the edge of the sketch.
|
void |
setForegroundColour(int fgColour)
Sets the foreground colour of the popup.
|
void |
setInternalMargin(int xMargin,
int yMargin)
Sets the internal margins between the popup and the text displayed within it.
|
void |
setIsActive(boolean isActive)
Determines whether or not the popup should be currently active.
|
void |
setText(java.lang.String text)
Replaces the text to be displayed in the popup window with the given text.
|
void |
setText(java.lang.String text,
float textSize)
Replaces the text to be displayed in the popup window with the given text at the given size.
|
void |
setTextSize(float textSize)
Sets the current text size in pixels.
|
public TextPopup(processing.core.PApplet sketch)
setIsActive(true)
].sketch
- Sketch that will use the popup window.public TextPopup(processing.core.PApplet sketch, int xBorder, int yBorder)
setIsActive(true)
]. The border defines the number
of pixels from within the given sketch, the window is drawn. So border values of 0
would take up the entire sketch, a border value of 10 would leave a 10 pixel wide band
of the original sketch visible behind the popup.sketch
- Sketch that will use the text popup.xBorder
- Width in pixels of the border to the left and right of the popup.yBorder
- Height in pixels of the border to the top and bottom of the popup.public TextPopup(processing.core.PApplet sketch, processing.core.PFont font, int xBorder, int yBorder)
setIsActive(true)
]. The border defines the number
of pixels from within the given sketch, the window is drawn. So border values of 0
would take up the entire sketch, a border value of 10 would leave a 10 pixel wide band
of the original sketch visible behind the popup.sketch
- Sketch that will use the text popup.font
- Font used for display of text.xBorder
- Width in pixels of the border to the left and right of the popup.yBorder
- Height in pixels of the border to the top and bottom of the popup.public void draw()
draw()
method. If the text popup
is not active, nothing will be drawn, if it is active, this popup will be
drawn over the top of the sketch that called it.public boolean getIsActive()
public void setIsActive(boolean isActive)
isActive
- If true, the popup is made active.public float getTextSize()
public void setTextSize(float textSize)
textSize
- New text size in pixels.public void setBackgroundColour(int bgColour)
bgColour
- Background colour expressed as a Processing integer colour.public void setForegroundColour(int fgColour)
fgColour
- Foreground colour expressed as a Processing integer colour.public void setExternalMargin(int xMargin, int yMargin)
xMargin
- Width in pixels of the margin between the left and right of the popup and the sketch.yMargin
- Height in pixels of the margin between the top and bottom of the popup and the sketch.public java.awt.Dimension getExternalMargin()
public void setInternalMargin(int xMargin, int yMargin)
xMargin
- Width in pixels of the margin between the left and right of the popup and the text.yMargin
- Height in pixels of the margin between the top and bottom of the popup and the text.public java.awt.Dimension getInternalMargin()
public void addText(java.lang.String textLine)
textLine
- Line of text to add.public void addText(java.lang.String textLine, float lineTextSize)
textLine
- Line of text to add.lineTextSize
- Vertical size in pixels of text for this line.public void setText(java.lang.String text)
text
- New text to display in the popup window.public void setText(java.lang.String text, float textSize)
text
- New text to display in the popup window.textSize
- Vertical size in pixels of text for this line.public void clearText()