Presentation is loading. Please wait.

Presentation is loading. Please wait.

Errors, GUIs, and Patterns Dr. Doug Twitchell August 30, 2005.

Similar presentations


Presentation on theme: "Errors, GUIs, and Patterns Dr. Doug Twitchell August 30, 2005."— Presentation transcript:

1 Errors, GUIs, and Patterns Dr. Doug Twitchell August 30, 2005

2 Development Cycle

3 GUI - Frames import javax.swing.*; // use JFrame public class EmptyFrame{ public static void main(String[] args) { // declare the object JFrame frame = new JFrame(); // invoke its services frame.setTitle("EmptyFrame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocation(250, 100); frame.setSize(150, 200); frame.setVisible(true); }

4 GUI - Frames import javax.swing.*; // use JFrame public class EmptyFrame{ public static void main(String[] args) { // declare the object JFrame frame = new JFrame(); // invoke its services frame.setTitle("EmptyFrame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocation(250, 100); frame.setSize(150, 200); frame.setVisible(true); } 100 250 200 150

5 Patterns

6 Command Invocation Pattern >. >( >); karel.turnLeft() frame.setSize(100, 200)

7 Object instantiation Pattern > > = new >( >); City ny = new City() Robot billyBob = new Robot(ny, 4, 5, Direction.EAST); JFrame frame = new Frame(); Thing blob = new Thing(ny, 3, 5);

8 Sequential Execution Pattern >. >( >); karel.turnLeft() karel.move(); karel.turnLeft();

9 Java Program Pattern import >; public class > { public static void main(String[] args) { > }

10 Java Program Pattern import javax.swing.*; // use JFrame public class EmptyFrame{ public static void main(String[] args) { // declare the object JFrame frame = new JFrame(); // invoke its services frame.setTitle("EmptyFrame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocation(250, 100); frame.setSize(150, 200); frame.setVisible(true); }

11 Display a Frame Pattern import javax.swing.*; public class > { public static void main(String[] args) { //declare objects to show JFrame > = new JFrame(); JPanel > = new JPanel(); //set the frame’s contents to display the panel >.setContentPane( >); //set up and show the frame >.setTitle(“ >); >.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE); >.setLocation( >, >); >.setSize( >, >); >.setVisible(true): }

12 Display a Frame Pattern import javax.swing.*; // use JFrame public class EmptyFrame{ public static void main(String[] args) { // declare the object JFrame frame = new JFrame(); // invoke its services frame.setTitle("EmptyFrame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocation(250, 100); frame.setSize(150, 200); frame.setVisible(true); }


Download ppt "Errors, GUIs, and Patterns Dr. Doug Twitchell August 30, 2005."

Similar presentations


Ads by Google