● 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
● 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
14 trang |
Chia sẻ: candy98 | Lượt xem: 559 | Lượt tải: 0
Bạn đang xem nội dung tài liệu Object-Oriented Programming - Lecture 6: 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 6: Introduction to the Swing
Toolkit
Lê Hồng Phương
phuonglh@gmail.com
Department of Mathematics, Mechanics and Informatics
Vietnam National University, Hanoi
2012-2013 Object-Oriented Programming: Introduction to Swing 2
Content
● A brief introduction to Swing
● Swing features
● Demo
2012-2013 Object-Oriented Programming: Introduction to Swing 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
2012-2013 Object-Oriented Programming: Introduction to Swing 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
2012-2013 Object-Oriented Programming: Introduction to Swing 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
2012-2013 Object-Oriented Programming: Introduction to Swing 6
Basic controls
JSpinner
JTextField JPasswordField
JRadioButton
JSlider
JButton
JCheckBox
JList
JComboBox
2012-2013 Object-Oriented Programming: Introduction to Swing 7
Interactive displays of highly
formatted information
JEditorPane
JTable
JColorChooser
2012-2013 Object-Oriented Programming: Introduction to Swing 8
Interactive displays of highly
formatted information
JFileChooser
JTree
JTextArea
2012-2013 Object-Oriented Programming: Introduction to Swing 9
Uneditable information displays
JLabel
JProgressBar
JTooltip
JSeparator
2012-2013 Object-Oriented Programming: Introduction to Swing 10
Top-level containers
JApplet
JFrame
JDialog
2012-2013 Object-Oriented Programming: Introduction to Swing 11
General-purpose containers
JToolBar
JTabbedPane
JScrollBar
JSplitPane
JPanel
2012-2013 Object-Oriented Programming: Introduction to Swing 12
Special-purpose containers
JInternalFrame
JLayeredPane
JRootPane
2012-2013 Object-Oriented Programming: Introduction to Swing 13
Internationalization
2012-2013 Object-Oriented Programming: Introduction to Swing 14
References: the Java tutorial
● Graphical User Interfaces
–
● Creating GUI with JFC/Swing
–
● API Documentation:
–
– Browse javax.swing.* packages