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

CSE205 Lecture 12

CSE205 Lecture 12

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

Javier Gonzalez-Sanchez

September 22, 2021
Tweet

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

  1. 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

    View full-size slide

  2. jgs
    Previously …
    JPanel

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  7. jgs
    Tabs
    The class JTabbedPane

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  18. jgs
    RadioButton

    View full-size slide

  19. 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);

    View full-size slide

  20. jgs
    JList and JComboBox

    View full-size slide

  21. 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);

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  25. 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.

    View full-size slide