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

CSC305 Summer Lecture 05

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

CSC305 Summer Lecture 05

Individual Software Design and Development
GUI
(202508)

Avatar for Javier Gonzalez-Sanchez

Javier Gonzalez-Sanchez PRO

August 05, 2025
Tweet

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

  1. Dr. Javier Gonzalez-Sanchez [email protected] www.javiergs.info o ffi ce: 14 -227

    CSC 305 Individual Software Design and Development | Summer Version Lecture 05. GUI
  2. Problem public class B implements E { public B() {

    C c1 = new C(); } public void method() { B b = new B(); b.sleep(); } } public class Y extends B { A [] a = new A[5]; } public class A extends B { C c1, c2; public A() { c1 = new C(); } public void method(D d) { d.working(); } } public class X { private String s; public void m() { B var = new A(); double x – Math.sqrt(5); } }
  3. import javax.swing.*; public class Example extends JFrame{ public Example() {

    super("Hello World Swing"); BorderLayout layout = new BorderLayout(); setLayout(layout); JLabel label = new JLabel("Hello World"); add(label, BorderLayout.CENTER); JButton button = new JButton("Click Me"); add(button , BorderLayout.SOUTH); JTextField text = new JTextField("Text", 10); add(text , BorderLayout.NORTH); JCheckBox check = new JCheckBox("Option"); add(check , BorderLayout.EAST); } public static void main(String[] args) { Example frame = new Example(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(500,500); frame.setVisible(true); } }
  4. Homework 24 Review the kappa version of my Paint App

    https://github.com/CSC3100/App-Paint/tree/main/ src/main/java/javiergs/paint/Kappa
  5. Lab

  6. Game of Life - https://playgameo f life.com/ Cre a te

    this GUI using J a v a : 1. Blue b a r a t the top with your n a me. 2. A grid a t the center. Use MouseListener to a llow the user to click on a squ a re a nd ch a nge the color to yellow 3. The f ive buttons on the bottom. Only “Cle a r" need to work. Ignore the others. 4. The gr a y-box over the grid with the sliders c a n be ignored. Do not a dd it a t this moment. 27
  7. CSC 305 Individual Software Design and Development Javier Gonzalez-Sanchez, Ph.D.

    [email protected] Summer 2025 Copyright. These slides can only be used as study material for the class CSC305 at Cal Poly. They cannot be distributed or used for another purpose.