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
PRO

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 Slide

  2. jgs
    Previously …
    JPanel

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  7. jgs
    Tabs
    The class JTabbedPane

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  14. jgs
    JMenu

    View Slide

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

    View Slide

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

    View Slide

  17. jgs
    Slider

    View Slide

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

    View Slide

  19. jgs
    CheckBox

    View Slide

  20. 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 Slide

  21. jgs
    RadioButton

    View Slide

  22. 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 Slide

  23. jgs
    JList and JComboBox

    View Slide

  24. 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 Slide

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

    View Slide

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

    View Slide

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

    View Slide

  28. 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 Slide