Switch
Overview
Switch is a element that chooses between two proportions
This sample code is only from the Switch, to see the complete sample, including the Slider, go to github
Attributes
Type
Name
Description
boolean
centerText
Boolean that center the text instead of move from left to right
int
colorBackOff
Background color for off switch
int
colorBackOn
Background color for on switch
int
colorForeOff
Foreground color for off switch
int
colorForeOn
Foreground color for on switch
String
textBackOff
Background text for off switch
String
textBackOn
Background text for on switch
String
textForeOff
Foreground text for off switch
String
textForeOn
Foreground text for on switch
Methods
Type
Name
Description
Constructor
Switch( )
Creates a simple switch
int
getPreferredHeight( )
Returns the switch minimum height
int
getPreferredWidth( )
Returns the switch minimum width
boolean
isOn( )
Return true if the switch is on
void
moveSwitch(boolean toLeft)
If true, move the switch to left
void
setOn(boolean b)
If true, turn on the switch
void
setPos(int x, int y)
Set the Switch´s x and y position
References
See the JavaDocs for more information.
Last updated