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

IFTextField

The IFTextField object creates a new text field GUI component. Text fields are single-line boxes that accept text input, mouse and keyboard selection of text, and cut/copy/paste to the system clipboard.

Syntax

IFButton b = new IFButton("Label", _, _);

Method Summary

IFTextField(String label, int x, int y);
IFTextField(String label, int x, int y, int width);
IFTextField(String label, int x, int y, int width, String contents);

  • label, the name of the text field (not displayed).
  • x, the X position of the text field's upper left hand corner.
  • y, the Y position of the text field's upper left hand corner.
  • width, the width of the text field, in pixels.
  • contents, the text to be displayed in the text field.

setLabel(String newLabel)

  • Sets the name of the text field. The text field name is used when submitting the interface's current state to a web server.
  • newLabel, the new name for the text field.

getLabel()

  • Returns the text field's name as a String.

setValue(String contents)

  • Sets the text displayed in the text field.
  • contents, the new text to be displayed in the text field.

getValue()

  • Returns the text field's contents as a String.

setWidth(int width)

  • Sets the width of the text field.
  • width, the new width for the text field.

getWidth()

  • Returns the width in pixels of the text field in integer form.

setHeight(int height)

  • Sets the height of the text field.
  • height, the new height for the text field.

getHeight()

  • Returns the height in pixels of the text field in integer form.

setSize(int width, int height)

  • A convenience method to set both dimensions of the text field.
  • width, the new width for the text field.
  • height, the new height for the text field.

setX(int x)

  • Sets the X position of the text field relative to its GUIController.
  • x, the new X position for the text field.

getX()

  • Returns the X position in pixels of the text field relative to its GUIController.

setY(int y)

  • Sets the Y position of the text field relative to its GUIController.
  • y, the new Y position for the text field.

getY()

  • Returns the Y position in pixels of the text field relative to its GUIController.

setPosition(int x, int y)

  • A convenience method to set both the X and Y position of the text field.
  • X, the new X position for the text field.
  • Y, the new Y position for the text field.

addActionListener(Object listener)

  • Adds an action listener object which receives `GUIEvent` notifications when the text field is clicked or released. You must implement the [actionPerformed()](/documentation/actionperformed/) method in order to receive events from the text field.
  • listener, the object that events are sent to. (Usually `this`.)

Example

import interfascia.*;

GUIController c;
IFTextField t;

void setup() {
   c = new GUIController(this);
   t = new IFTextField("Input", 30, 30);
}

void draw() {
}