Interfascia

Class Listing

IFTextField
IFRadioController
IFRadioButton
IFProgressBar
IFLookAndFeel
IFLabel
IFCheckBox
IFButton
GUIEvent
actionPerformed
GUIController

Examples

Text Field
Temperature Converter
Radio Buttons
Custom Widget Color
Button

GUIController

The GUIController object keeps track of all GUI components and handles the forwarding of events from the Processing applet to the individual GUI components. All you need to do is create a new GUIController that references the current PApplet and add desired GUIComponents to the controller.

Syntax

GUIController c = new GUIController(this);
c.add(button);
c.requestFocus(button);

Method Summary

GUIController(PApplet parent);
GUIController(PApplet parent, boolean visible);

  • parent, the Processing applet where the GUI components will be drawn; usually the keyword 'this' is used.
  • visible, whether the components in the controller will be drawn.

add(GUIComponent component);

  • The add() method adds a GUI component to the controller's list of components it controls.
  • component, component to be added

remove(GUIComponent component);

  • The remove() method removes a GUI component to the controller's list of components it controls.
  • component, component to be removed

requestFocus(GUIComponent component);

  • The requestFocus() method requests that the controller send keyboard events to the specified component.
  • component, component to receive focus

yieldFocus(GUIComponent component);

  • The yieldFocus() method tells the controller to no longer forward keyboard events to the specified component.
  • component, component to lose focus

getComponentWithFocus();

  • The getComponentWithFocus() method returns the component that is currently receiving keyboard events.

getFocusStatusForComponent(GUIComponent component);

  • The getFocusStatusForComponent() method returns true if the specified component has keyboard focus, false otherwise.
  • component, component whose focus status is in question

copy(String s);

  • The copy() method copies the specified string to the system's clipboard.
  • s, the string to be copied to the clipboard

paste();

  • The paste() method returns the string that is currently in the system's clipboard.

Example

GUIController c;
Button b;

void setup() {
   c = new GUIController(this);
   b = new Button("Click!", 20, 20, 40);

   c.add(b);
}

void draw() {

}