Objectives: The Objectives of This Chapter Are
Objectives: The Objectives of This Chapter Are
Objectives: The Objectives of This Chapter Are
Component
Button Panel
List
Checkbox
TextComponent TextField
TextArea
Component
aFrame.add(aPanel);
Buttons
This class represents a push-button which displays some
specified text.
When a button is pressed, it notifies its Listeners. (More
about Listeners in the next chapter).
To be a Listener for a button, an object must implement the
ActionListener Interface.
Panel aPanel = new Panel();
Button okButton = new Button("Ok");
Button cancelButton = new Button("Cancel");
aPanel.add(okButton));
aPanel.add(cancelButton));
okButton.addActionListener(controller2);
cancelButton.addActionListener(controller1);
Labels
aPanel.add(aLabel);
List
North
South
Grid Layout
aPanel.add(new Button("Ok"));
aPanel.add(new Button("Add"));
aPanel.add(new Button("Delete"));
aPanel.add(new Button("Cancel"));
What if I don’t want a LayoutManager?
Ch. VIII - 21
Graphics