Slide 1

Slide 1 text

jgs CSE 205 Object-Oriented Programming and Data Structures Lecture 12: Java Swing III Dr. Javier Gonzalez-Sanchez [email protected] javiergs.engineering.asu.edu | javiergs.com PERALTA 230U Office Hours: By appointment

Slide 2

Slide 2 text

jgs Previously … JPanel

Slide 3

Slide 3 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 3 jgs JPanel

Slide 4

Slide 4 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 4 jgs Pseudo Calculator

Slide 5

Slide 5 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 5 jgs Extending JPanel

Slide 6

Slide 6 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 6 jgs Extending JPanel

Slide 7

Slide 7 text

jgs Tabs The class JTabbedPane

Slide 8

Slide 8 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 8 jgs Tabs

Slide 9

Slide 9 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 9 jgs Tabs

Slide 10

Slide 10 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 10 jgs Tabs

Slide 11

Slide 11 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 11 jgs Tabs

Slide 12

Slide 12 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 12 jgs Tabs

Slide 13

Slide 13 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 13 jgs Tabs

Slide 14

Slide 14 text

jgs JMenu

Slide 15

Slide 15 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 15 jgs JMenuBar Jmenu JMenuItem

Slide 16

Slide 16 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 16 jgs JMenuBar, Jmenu, JMenuItem

Slide 17

Slide 17 text

jgs Slider

Slide 18

Slide 18 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 18 jgs § JSlider s = new JSlider(0,10); add(s);

Slide 19

Slide 19 text

jgs CheckBox

Slide 20

Slide 20 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 20 jgs JCheckBox c1 = new JCheckBox("checkbox 1"); JCheckBox c2 = new JCheckBox("checkbox 2"); add(c1);add(c2);

Slide 21

Slide 21 text

jgs RadioButton

Slide 22

Slide 22 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 22 jgs JRadioButton b1 = new JRadioButton("one"); JRadioButton b2 = new JRadioButton("two"); JRadioButton b3 = new JRadioButton("three"); JRadioButton b4 = new JRadioButton("four"); b1.setSelected(true); b4.setEnabled(false); ButtonGroup group = new ButtonGroup(); group.add(b1); group.add(b2); group.add(b3); group.add(b4); add(b1); add(b2); add(b3); add(b4);

Slide 23

Slide 23 text

jgs JList and JComboBox

Slide 24

Slide 24 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 24 jgs JList Object data[] = {"one", "two", "three", "four", "five"}; JList list = new JList(data); list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); list.setLayoutOrientation(JList.VERTICAL); JScrollPane listScroller = new JScrollPane(list); add(listScroller);

Slide 25

Slide 25 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 25 jgs Orientation and Selection

Slide 26

Slide 26 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 26 jgs § Object data[] = {"one", "two", "three", "four", "five"}; JComboBox list = new JComboBox(data); add(list);

Slide 27

Slide 27 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 27 jgs Questions

Slide 28

Slide 28 text

jgs CSE 205 Object-Oriented Programming and Data Structures Javier Gonzalez-Sanchez, Ph.D. [email protected] Fall 2021 Copyright. These slides can only be used as study material for the class CSE205 at Arizona State University. They cannot be distributed or used for another purpose.