1
CSE 331
Visual Index of Swing GUI Components
slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia http://www.cs.washington.edu/331/
CSE 331 Visual Index of Swing GUI Components slides created by - - PowerPoint PPT Presentation
CSE 331 Visual Index of Swing GUI Components slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia http://www.cs.washington.edu/331/ 1 Components 2 Swing inheritance hierarchy Component
1
slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia http://www.cs.washington.edu/331/
2
3
(Swing)
(Swing)
JColorChooser JFileChooser
JLabel JList
JOptionPane JPanel
JProgressBar JScrollbar
JSlider JSpinner
JTabbedPane JTable
JTree JTextArea
...
import java.awt.*; import javax.swing.*;
4
whether it can be interacted with boolean enabled description type name various sizes, size limits, or desired sizes that the component may take Dimension
size, minimum / maximum / preferred size
border line around component Border border font used for text in component Font font foreground color of component Color foreground component's current size in pixels int height, width background color behind component Color background String boolean boolean text shown when hovering mouse tooltip text whether component can be seen visible whether key text can be typed on it focusable
5
6
7
8
9
10
11
myContainer.add(new JScrollPane(textarea), BorderLayout.CENTER);
12
import javax.swing.*; JOptionPane.showMessageDialog(null, "This candidate is a dog. Invalid vote.");
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Icon icon, boolean selected)
public void add(AbstractButton button)
29
myQuitButton.setMnemonic('Q'); JMenuItem myNewItem = new JMenuItem("New", 'N'); // or: myNewItem.setMnemonic('N');
30
menuItem.setAccelerator( KeyStroke.getKeyStroke('T',KeyEvent.ALT_MASK));
31