Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CSE205 Lecture 11

CSE205 Lecture 11

Object-Oriented Programming and Data Structures
Java Swing III
(202109)

B546a9b97d993392e4b22b74b99b91fe?s=128

Javier Gonzalez
PRO

September 21, 2021
Tweet

Transcript

  1. jgs CSE 205 Object-Oriented Programming and Data Structures Lecture 11:

    Java Swing III Dr. Javier Gonzalez-Sanchez javiergs@asu.edu javiergs.engineering.asu.edu | javiergs.com PERALTA 230U Office Hours: By appointment
  2. jgs Previously …

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

    Tabs
  4. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 4 jgs

    Tabs
  5. jgs JMenu

  6. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 6 jgs

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

    JMenuBar, Jmenu, JMenuItem
  8. jgs Slider

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

    § JSlider s = new JSlider(0,10); add(s);
  10. jgs CheckBox

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

    JCheckBox c1 = new JCheckBox("checkbox 1"); JCheckBox c2 = new JCheckBox("checkbox 2"); add(c1);add(c2);
  12. jgs RadioButton

  13. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 13 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);
  14. jgs Jlist and JComboBox

  15. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 15 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);
  16. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 16 jgs

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

    § Object data[] = {"one", "two", "three", "four", "five"}; JComboBox list = new JComboBox(data); add(list);
  18. jgs Homework 02

  19. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 19 jgs

    Homework 02
  20. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 20 jgs

    Note about Borders JPanel myPanel = new MyPanel(); myPanel.setBorder( BorderFactory.createTitledBorder("title") ); add(myPanel);
  21. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 21 jgs

    Questions
  22. jgs CSE 205 Object-Oriented Programming and Data Structures Javier Gonzalez-Sanchez,

    Ph.D. javiergs@asu.edu 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.