lec10 - COMP201 Java Programming Part II: GUI Programming...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
COMP201 Java Programming Part II: GUI Programming Topic 10: Swing User Interface Components Chapter 9
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COMP201 Topic 10 / Slide 2 Outline Overview of Swing components Layout management Using Swing components Text input Buttons ComboBox Menus Dialogs
Background image of page 2
COMP201 Topic 10 / Slide 3 Overview of Swing Components Top-Level Containers Windows: JFrame class Dialog boxes: JOptionPane , JDialog * , JFileChooser classes Applets: JApplet * class v2: covered in volume 2, *: will discuss
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COMP201 Topic 10 / Slide 4 Overview of Swing Components General-Purpose containers for laying out components. JPanel class JSrollPane * class provides a scrollable view of components. JSplitPane v2 displays two groups of components, either side by side or one on top of the other.
Background image of page 4
COMP201 Topic 10 / Slide 5 Overview of Swing Components Basic control: Components for getting user input Textfields: JTextField * , JPasswordField * , JTextArea * Buttons : Jbutton * , JCheckBox * , JRadioButton * , …
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COMP201 Topic 10 / Slide 6 Overview of Swing Components Basic control: Components for getting user input JMenu * , JMenuItem * JSlider v2 , JScrollbar JComboBox *
Background image of page 6
COMP201 Topic 10 / Slide 7 Overview of Swing Components non-editable components for information display Jlabel * class can display non-selectable text and images. JProgressBar v2 class displays progress of a job. Tool Tips v2 : created using JComponent
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COMP201 Topic 10 / Slide 8 Overview of Swing Components Editable components for information display JTable v2 class can display and edit tables of data, Texts * : JTree v2 class can display hierarchical data File Chooser JColorChooser class to provide users with a palette of colors to choose from.
Background image of page 8
COMP201 Topic 10 / Slide 9 Overview of Swing Components Summary: Containers Top-Level: JFrame, JOptinePane, JDialog, JFileChooser,JApplet , General-purpose: JPanel, JScrollPane, JSplitPane User input JTextField, JPasswordField, JTextArea, JButton, JCheckbox, JRadioButton, Jlist, JComboBox, JMenu, JMenuItem, JSlider, JScrollBar Information display Non-editable: Jlabel, JProgressBar, Tool tips Editable: Jtable, Texts, Jtree, JColorChooser
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COMP201 Topic 10 / Slide 10 Layout Management Layout management determines the size and position of components. Each container has a default layout manager. Generally, need to set the layout manager of two types of containers: content panes (which use BorderLayout by default) and JPanels (which use FlowLayout by default).
Background image of page 10
COMP201 Topic 10 / Slide 11 Layout Management FlowLayout class : default layout manager of JPanel . FlowLayout puts components in a row, sized at their preferred size (set using setPreferedSize of JComponent or computed automatically. You can also setMaximumSize & setMinumSize ).
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 67

lec10 - COMP201 Java Programming Part II: GUI Programming...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online