Labels:
JLabel(String text) - default alignment of LEFT.
JLabel(String text, int align) - align can be JLabel.LEFT, JLabel.RIGHT, or JLabel.CENTER.
getAlignment() - return the Label object's current alignment.
getText() - return the current text for the Label object.
setAlignment(int align) - set the Label object's alignment to align.
setText(String text) - set the text for the Label object to text.
Text
getText() - returns the entire contents of the text object (i.e. what the user typed in.)
setText(String text) - set the contents of the text object. This can be used to re-set a text object to a default value.
setEditable(boolean canEdit) - if canEdit is true, the user can edit the text in the text object.
isEditable() - returns true if the user can edit the text object, false if they cannot.
JTextField(String initText) - create the text field and initialize it to initText.
JTextField(int columns) - columns are "approximate".
setEchoChar(char c) - Show the specified character as the user types instead of the characters they are entering (used for passwords).
JTextArea(int nrows, int ncols) - create the text area with the specified number of rows and columns.
JTextArea(String initText, int nrows, int ncols) - create the text area with the specified number of rows and columns and initialize it to initText.
appendText(String text) - add text to the end of the text area.
insertText(String text, int pos) - insert text into the character position specified. Note this is not a column position, but an index into the character array in the text area.
Check Boxes
JCheckbox(String text) - create a checkbox with the passed-in text as the label.
JCheckbox(String text, boolean on) - create a checkbox with the passed-in text as the label. If on is true, the the checkbox is selected. If on is false, the checkbox is not selected. (Note this is 1.1 only.)
String getLabel() - returns a string containing the checkbox's label.
boolean getState() - returns true if the check box is selected, false if it is not.
Radio Buttons
ButtonGroup fruitRadioButtons = new ButtonGroup();
JRadioButton applebox = new JRadioButton("apples", true);
JRadioButton orangebox = new JRadioButton("orange", true);
fruitRadioButtons.add(applebox);
fruitRadioButtons.add(orangebox);
getContentPane().add(applebox);
getContentPane().add(orangebox);
Buttons
JButton() - create an empty button.
JButton(String text) - create a button labeled with the specified text.
String getLabel() - returns the label for the button.
setLabel(String text) - set the label of the button to the passed-in
text.