● A brief introduction to Swing
● Swing features
● Demo
What is Swing?
The Swing toolkit, a part of the Java platform
provides a rich set of GUI (Graphical User
Interface) components.
– A collection of standard widgets
– Many functionalities
14 trang |
Chia sẻ: candy98 | Lượt xem: 518 | Lượt tải: 0
Bạn đang xem nội dung tài liệu Object-Oriented Programming - Lecture 8: Introduction to the Swing Toolkit - Lê Hồng Phương, để tải tài liệu về máy bạn click vào nút DOWNLOAD ở trên
Lecture 8: Introduction to the Swing
Toolkit
Lê Hồng Phương
phuonglh@gmail.com
Department of Mathematics, Mechanics and Informatics
Vietnam National University, Hanoi
2
Content
● A brief introduction to Swing
● Swing features
● Demo
3
What is Swing?
● The Swing toolkit, a part of the Java platform
provides a rich set of GUI (Graphical User
Interface) components.
– A collection of standard widgets
– Many functionalities
4
Features provided by Swing
● GUI components:
– Basic components: buttons, check boxes, menus...
– Rich and complex components: texts, tables, trees...
● Java 2D API: figures, images, shadows...
● Pluggable Look-And-Feel supports:
– Java LAF, platform LAF, custom LAF
● Data transfer: cut, copy, paste, drag and drop
between applications
5
Features provided by Swing
● Internationalization
– Applications that can interact with users world wide in
their own languages and cultural conventions.
● Undo framework API: undo, redo supports
● Flexible deployment supports:
– Applets which run in web browsers
– Programs which launch from a browser using Java Web
Start
– Standard desktop application
6
Basic controls
JSpinner JTextField JPasswordField
JRadioButton
JSlider
JButton
JCheckBox
JList
JComboBox
7
Interactive displays of highly
formatted information
JEditorPane
JTable
JColorChooser
8
Interactive displays of highly
formatted information
JFileChooser
JTree
JTextArea
9
Uneditable information displays
JLabel
JProgressBar
JTooltip
JSeparator
10
Top-level containers
JApplet
JFrame
JDialog
11
General-purpose containers
JToolBar
JTabbedPane
JScrollBar
JSplitPane
JPanel
12
Special-purpose containers
JInternalFrame
JLayeredPane
JRootPane
13
Internationalization
14
References: the Java tutorial
● Graphical User Interfaces
–
● Creating GUI with JFC/Swing
–