CS 112 - Fall 2012, Lab 09 Haohan Zhu. Boston University Slideshow Title Goes Here CS 112 - Fall...
-
Upload
eustacia-bryan -
Category
Documents
-
view
213 -
download
0
Transcript of CS 112 - Fall 2012, Lab 09 Haohan Zhu. Boston University Slideshow Title Goes Here CS 112 - Fall...
CS 112 - Fall 2012, Lab 09
Haohan Zhu
Boston University Slideshow Title Goes Here
CS 112 - Fall 2012, Lab 09
2
04/20/23
GUI - Graphical User Interface
JFC - Java Foundation Classes
An API for providing a graphical user interface (GUI) for Java programs.
Include AWT, Swing and Java 2D.
Boston University Slideshow Title Goes Here
CS 112 - Fall 2012, Lab 09
3
04/20/23
GUI widget toolkit
Swing Primary Java GUI widget toolkit
AWT Original platform-independent windowing, graphics,
and user-interface widget toolkit.
SWT
Boston University Slideshow Title Goes Here
CS 112 - Fall 2012, Lab 09
4
04/20/23
Swing
Top-Level Containers JFrame, JDialog, and Japplet
Boston University Slideshow Title Goes Here
CS 112 - Fall 2012, Lab 09
5
04/20/23
Swing
General-Purpose Containers JPanel, JScrollPane, JSplitPane, and so on
Special-Purpose Containers JInternalFrame, JLayeredPane and Root pane
Boston University Slideshow Title Goes Here
CS 112 - Fall 2012, Lab 09
6
04/20/23
JPanel
JPanel() Creates a new JPanel with a double buffer and a flow layout.
JPanel(LayoutManager layout) Create a new buffered JPanel with the specified layout manager
setLayout(LayoutManager layout)
Boston University Slideshow Title Goes Here
CS 112 - Fall 2012, Lab 09
7
04/20/23
LayoutManage
Interface
FlowLayout BorderLayout GridLayout …
Boston University Slideshow Title Goes Here
CS 112 - Fall 2012, Lab 09
8
04/20/23
Jcomponent
All Swing components whose names begin with "J" descend from the JComponent class
JButton JCheckBox JComboBox JRadioButton JTextField Jtable …
Boston University Slideshow Title Goes Here
CS 112 - Fall 2012, Lab 09
9
04/20/23
Jbutton
ActionListener Interface http://
docs.oracle.com/javase/7/docs/api/java/awt/event/ActionListener.html
actionPerformed(ActionEvent e)
ActionEvent Class Click a button, create an event
Boston University Slideshow Title Goes Here
CS 112 - Fall 2012, Lab 09
10
04/20/23
JOptionPane
JOptionPane.showMessageDialog();
Boston University Slideshow Title Goes Here
CS 112 - Fall 2012, Lab 09
11
04/20/23
Practice
Finish the code
Learn how to write a GUI