CM Unit 3 Flashcards
GUI
Graphical User Interface
Layout
Specifies how components will be added to the panel.
Examples: Flow Layout, Border Layout, Grid Layout.
Listener
Handles interface events through the action performed method.
Swing GUI Components
JButton
JLabel
JTextField
Double.parseDouble
Convert text to a double
Integer.parseInt
Convert text to an integer
Switch
Switch(x)
{
Case1: …break;
default;
}
JButton syntax and method and constructor
JButton Button = new JButton(“text”)
add ActionListener(new Listener());
JLabel syntax and method and constructor
JLabel label = new JLabel(“text”)
label.settext();
JTextFeild syntax and method and constructor
JTextField box = new JTextField(“Text”, width);
box.getText();
The Action Listener Interface and how to create listeners
Private Class Listener implements Action Listener
{
public void action performed(Action Event e)
{
…
}
}
Random number formula and other
Double D = Math.random() * Range of Values + Lowest
[0,6) is 6 numbers
[0,6] is 7 numbers.
Inclusive is hard bracket. Exclusive is soft bracket.