Circle Button Demo and Documentation

Display sketch code: CircleButtonDemo.pde. The code for CircleButton is in Clickable.pde

Circle Button are very similar to regular buttons except they are circular instead of rectangular.

class CircleButton
extends Button
which extends Clickable

The three constructors for Circle button are nearly the same as those for regular Buttons. The only difference is the shape of the button.

Fields x and y represent the the center of the circle. w is the horizontal radius while h is the vertical radius. Normally w = h but this is not required.

** CircleButton(int centerX, int centerY, int radius, String theLabel,)
                    color stdColor, color overColor)
- A constructor which extends Button by replacing the rectangle by a circle. The button does not have a selected state.
** CircleButton(int centerX, int centerY, int radius, String theLabel,
                    color stdColor, color overColor, color selected, color overSelected)
- A constructor which extends Button by constructing a two state circular button with selected colors.
** CircleButton(int centerX, int centerY, int radius, String theLabel,
                    int numColors, color[] stdColor, color[] overColor)
- A constructor which extends Button by constructing a multistate circular button. The number of states is determined by the length of the stdColor array. ("numColors" is not actually used but included only as a work around for a "bug" in Processing.js.)
* void display()
- If visible, displays a circle with the label on the right of the circle using the color specified by its colorState. Uses a special color if disabled.
* boolean isOver()
- Returns true if the button is over the circle. If it is. then "over" is set true and it returns true. Always returns false if stillSearching_ is false.

Method use codes:

** This constructor or method is designed to be called in the user sketch.

* This method is normally not called in the user's sketch unless the Clickable item was not been included in a ClickableGroup. ClickableGroup automatically uses the method as needed. Exception: This method may be needed if the user is extending Clickable with a new class.

# This constructor or method is rarely used in the user program. In Java, it would probably marked "private". Clickable, ScrollBar, and some other abstract constructors would never be called directly by the user sketch because they do nothing useful unless the user is extending a class.


Inherited from Button

Constructors
Button, Button, Button

Methods
display, isOver, nextState, toggle


Inherited from Clickable

Fields
NOTHING_CLICKED, COMBO_BUTTON, DISABLED_COLOR, borderColor, c, clicked, clickedItemNum, colorState, enabled, h, label, over, overC, scrollable, selected, selectedItemNum, visible, w, x, y

Constructors
Clickable

Methods
checkForClick, display, doNotSelect, getClickedItemNum, getColorState, getH, getItem, getLabel, getSelected, getSelectedItem, getSelectedItemLabel, getSelectedItemNum, getW, getX, getY, hasBeenClicked, hideSomething, isOver, setBorderColor, setColorState, setH, setLabel, setScrollable, setSelected, setSelectedItemNum, setEnabled, setVisible, setW, setX, setY, sX, sY

Return to the top of the page

Revised: 04/11/2014