IFProgressBar
The IFProgressBar object creates a new progress bar GUI component. A progress bar is updated with
a value bwtween 0 and 1 representing a process’s percent complete.
Method Summary
IFProgressBar(int x, int y, int width)
x, the X position of the text field's upper left corner.y, the Y position of the text field's upper left corner.width, the width of the text field in pixels.
setProgress(float progress)
- Updates the progress bar's length in proportion to the percentage complete.
progress, the percentage complete (must be between 0 and 1).
getProgress()
- Returns the percentage complete, represented as a float between 0 and 1.
setLabel(String newLabel)
- Sets the name of the button. The button name is used when submitting the interface's current state to a web server.
newLabel, the new name for the button.
getLabel()
- Returns the button's name as a String.
setWidth(int width)
- Sets the width of the button.
width, the new width for the button.
getWidth()
- Returns the width in pixels of the button in integer form.
setHeight(int height)
- Sets the height of the button.
height, the new height for the button.
getHeight()
- Returns the height in pixels of the button in integer form.
setSize(int width, int height)
- A convenience method to set both dimensions of the button.
width, the new width for the button.height, the new height for the button.
setX(int x)
- Sets the X position of the button relative to its GUIController.
x, the new X position for the button.
getX()
- Returns the X position in pixels of the button relative to its GUIController.
setY(int y)
- Sets the Y position of the button relative to its GUIController.
y, the new Y position for the button.
getY()
- Returns the Y position in pixels of the button relative to its GUIController.
setPosition(int x, int y)
- A convenience method to set both the X and Y position of the button.
X, the new X position for the button.Y, the new Y position for the button.
Example
import interfascia.*;
IFProgressBar p = new IFProgressBar(10, 10, 80);
float percent = 0;
void setup() {
GUIController c = new GUIController(this);
c.add(p);
p.setProgress(percent);
}
void draw() {
p.setProgress(percent);
if (percent < 1) {
percent += 0.01;
} else {
percent = 0;
}
}