|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectcontrolP5.Tooltip
public class Tooltip
A tooltip can be registered for individual controllers and is activated on rollover.
/**
* ControlP5 Tooltip
*
* add a tooltip to a controller.
* hover your mouse on top of a slider in the example and wait
* for 1 second for the tooltip to appear.
*
* find a list of public methods available for the Tooltip Controller
* at the bottom of this sketch.
*
* by Andreas Schlegel, 2011
* www.sojamo.de/libraries/controlp5
*
*/
import controlP5.*;
ControlP5 cp5;
float s1 = 20, s2 = 100;
void setup() {
size(700,400);
smooth();
noStroke();
cp5 = new ControlP5(this);
cp5.begin(100,100);
cp5.addSlider("s1",10,200).linebreak();
cp5.addSlider("s2",0,150);
cp5.end();
cp5.getTooltip().setDelay(500);
cp5.getTooltip().register("s1","Changes the size of the ellipse.");
cp5.getTooltip().register("s2","Changes the Background");
}
void keyPressed() {
println("unregistering the tooltip for s2");
cp5.getTooltip().unregister("s2");
}
void draw() {
background(s2);
fill(255,100);
ellipse(width/2, height/2, s1,s1);
}
/*
a list of all methods available for the Tooltip Controller
use ControlP5.printPublicMethodsFor(Tooltip.class);
to print the following list into the console.
You can find further details about class Tooltip in the javadoc.
Format:
ClassName : returnType methodName(parameter type)
controlP5.Tooltip : Label getLabel()
controlP5.Tooltip : Tooltip disable()
controlP5.Tooltip : Tooltip enable()
controlP5.Tooltip : Tooltip register(Controller, String)
controlP5.Tooltip : Tooltip register(String, String)
controlP5.Tooltip : Tooltip setAlpha(int)
controlP5.Tooltip : Tooltip setBorder(int)
controlP5.Tooltip : Tooltip setColorBackground(int)
controlP5.Tooltip : Tooltip setColorLabel(int)
controlP5.Tooltip : Tooltip setDelay(long)
controlP5.Tooltip : Tooltip setDisplay(ControllerDisplay)
controlP5.Tooltip : Tooltip setHeight(int)
controlP5.Tooltip : Tooltip setLabel(Label)
controlP5.Tooltip : Tooltip setPositionOffset(float, float)
controlP5.Tooltip : Tooltip setWidth(int)
controlP5.Tooltip : Tooltip unregister(Controller)
controlP5.Tooltip : Tooltip unregister(String)
controlP5.Tooltip : boolean isEnabled()
controlP5.Tooltip : int getBorder()
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
*/
Method Summary | |
---|---|
Tooltip |
disable()
disables the Tooltip on a global level, when disabled, tooltip will not respond to any registered controller. |
Tooltip |
enable()
in case the tooltip is disabled, use enable() to turn the tooltip back on. |
int |
getBorder()
returns the value of the border |
Label |
getLabel()
returns the current Label |
int |
getWidth()
|
boolean |
isEnabled()
check if the tooltip is enabled or disabled |
Tooltip |
register(Controller theController,
java.lang.String theText)
registers a controller with the Tooltip, when activating the tooltip for a particular controller, the registered text (second parameter) will be displayed. |
Tooltip |
register(java.lang.String theControllerName,
java.lang.String theText)
|
Tooltip |
setAlpha(int theValue)
sets the transparency of the default background, default value is 200 |
Tooltip |
setBorder(int theValue)
sets the border of the tooltip, the default border is 4px. |
Tooltip |
setColorBackground(int theColor)
sets the background color of the tooltip, the default color is a dark grey |
Tooltip |
setColorLabel(int theColor)
sets the text color of the tooltip's label, the default color is a white |
Tooltip |
setDelay(long theMillis)
A tooltip is activated when entered by the mouse, after a given delay time the Tooltip starts to fade in. |
Tooltip |
setHeight(int theHeight)
|
Tooltip |
setLabel(Label theLabel)
sets the Label to a custom label and replaces the default label. |
Tooltip |
setPositionOffset(float theX,
float theY)
adds an offset to the position of the controller relative to the mouse cursor's position. |
Tooltip |
setView(ControllerView theDisplay)
A custom view can be set for a Tooltip. |
Tooltip |
setWidth(int theWidth)
with the default display, the width of the tooltip is set automatically, therefore setWidth() does not have any effect without changing the default display to a custom ControllerView. |
Tooltip |
unregister(Controller theController)
removes a controller from the tooltip |
Tooltip |
unregister(java.lang.String theControllerName)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public Tooltip disable()
Tooltip.unregister(Controller)
public Tooltip enable()
public int getBorder()
public Label getLabel()
public int getWidth()
public boolean isEnabled()
public Tooltip register(Controller theController, java.lang.String theText)
theController
- theText
-
public Tooltip register(java.lang.String theControllerName, java.lang.String theText)
public Tooltip setAlpha(int theValue)
theValue
-
public Tooltip setBorder(int theValue)
theValue
-
public Tooltip setColorBackground(int theColor)
theColor
-
public Tooltip setColorLabel(int theColor)
theColor
-
public Tooltip setDelay(long theMillis)
theMillis
-
public Tooltip setHeight(int theHeight)
theHeight
-
Tooltip.setWidth(int)
public Tooltip setLabel(Label theLabel)
theLabel
-
public Tooltip setPositionOffset(float theX, float theY)
theX
- theY
-
public Tooltip setView(ControllerView theDisplay)
theDisplay
-
ControllerView
public Tooltip setWidth(int theWidth)
ControllerView
,
controlP5.Tooltip#setDisplay(ControllerView)
public Tooltip unregister(Controller theController)
theController
-
public Tooltip unregister(java.lang.String theControllerName)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |