CEE 5110 Lecture Notes - Lecture 22: Layout Manager

18 views1 pages
Lecture - 22
Listeners (cont’d)
actionPerformed (or another listener method) takes a corresponding type of
event as a parameter.
Event objects have useful methods. For example, getSource returns the object
that produced this event.
A MouseEvent has methods getX, getY.
GUI Components Review
Java Methods Appendix C contains brief summaries of several Swing
components, their constructors, methods, and events.
For a complete specification refer to the Java Swing API docs.
JLabel
JButton
JCheckBox
etc.
Layouts
A layout manager is a strategy for placing components on the content pane or
another component (usually a panel).
In Java, the content pane and any GUI component is a Container.
A layout is chosen by calling the containers setLayout method.
Layouts (cont’d)
Layouts are used to achieve some degree of platform independence and
scalability.
awt/Swing support several layout managers. Here we consider four:
FlowLayout
GridLayout
BorderLayout
BoxLayout
Unlock document

This preview shows half of the first page of the document.
Unlock all 1 pages and 3 million more documents.

Already have an account? Log in

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents