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

Slides:



Advertisements
Similar presentations
Unit 141 Threads What is a Thread? Multithreading Creating Threads – Subclassing java.lang.Thread Example 1 Creating Threads – Implementing java.lang.Runnable.
Advertisements

Event-Driven Programming Thus far, our programs have been executed one statement after the other However, many programs depend on user actions to dictate.
Event-Driven Programming Thus far, our programs have been executed one statement after the other However, many programs depend on user actions to dictate.
Object-Oriented Software Engineering Java with added Swing.
Unit 111 Java GUI Components and Events  Learning Outcomes oDistinguish between GUI components and containers. oIdentify and distinguish top-level containers.
Graphical User Interfaces
Java Review Structure of a graphics program. Computer Graphics and User Interfaces Java is Object-Oriented A program uses objects to model the solution.
GUI and event-driven programming An introduction.
Contructing GUI’s in Java Implemented in the Swing API Imported into your programs by: import javax.swing.*; Most Swing programs also need the AWT packages.
GUI Tutorial Images. Useful Info – not on final exam.
GUI Basics and Event- Driven Programming Feb 7, 2000.
CIS3023: Programming Fundamentals for CIS Majors II Summer 2010 Ganesh Viswanathan Graphical User Interface (GUI) Design using Swing Course Lecture Slides.
GUI Basics: Introduction. Creating GUI Objects // Create a button with text OK JButton jbtOK = new JButton("OK"); // Create a label with text "Enter your.
Introduction to Java GUI Creating Graphical User Interfaces © copyright Bobby Hoggard / material may not be redistributed without permission.
19-Sep-15 Air Force Institute of Technology Electrical and Computer Engineering Object-Oriented Programming Design Topic : Applets Maj Joel Young
Lesson 27: Introduction to the Java GUI. // helloworldbutton.java import java.awt.*; import javax.swing.*; class HelloButton{ public static void main.
Applets and Frames CS 21a: Introduction to Computing I First Semester,
CSE 219 Computer Science III Graphical User Interface.
Introduction to GUI in Java 1. Graphical User Interface Java is equipped with many powerful,easy to use GUI component such as input and output dialog.
Java GUI CSCE 190 – Java Instructor: Joel Gompert Mon, July 26, 2004.
Java Applets. Topics What is an applet? To convert GUI applications to Applets Hello World applet example!! Applets life cycle examples Invoking applets.
GUI Chapter 10 Graphics context and objects Creating a window based application JFrame, JTextField, JButton Containers and Controls Graphics commands Layout.
Intro to Applets August 19, 2008 Mrs. C. Furman. Java Applets vs. Java Applications Java Applet: a program that is intended for use on the web. Java Applet:
1 CSC111H Graphical User Interfaces (GUIs) Introduction GUIs in Java Understanding Events A Simple Application The Containment Hierarchy Layout Managers.
More GUI CSCE 190 – Java Instructor: Joel Gompert Lecture 8 – July 28, 2004.
Graphic User Interface. Graphic User Interface (GUI) Most of us interact with computers using GUIs. GUIs are visual representations of the actions you.
FEN IntroJava2006 AAU1 GUI: Graphical User Interface AWT/SWING: Components Drag and Drop in NetBeans Events Listeners.
1 Graphical User Interfaces AWT and Swing packages Frames and Panels Components Nested Panels Images Reading for this Lecture: L&L, 3.9 – 3.11.
JFrame and JPanel CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Applets and Frames. Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved L14: GUI Slide 2 Applets Usually.
Java Swing Reference: 1.Swing: A Beginner’s Guide by Herbt Schildt, TMH Edition.
Introduction to GUI Programming with Java Graphical User Interfaces With AWT and Swing Towson University *Ref:
GUI Basics. What is GUI? A graphical user interface (GUI) is a type of user interface item that allows people to interact with programs in more ways than.
Creating Windows. How can we use Java to create programs that use windows (GUI applications)? How can we use Java to create programs that use windows.
1 / 67 COP 3503 FALL 2012 SHAYAN JAVED LECTURE 14 Programming Fundamentals using Java 1.
 GUI – Graphic User Interface  Up to now in the programs we have written all output has been sent to the standard output device i.e.: the DOS console.
Java GUI. Graphical User Interface (GUI) a list a button a text field a label combo box checkbox.
Creating Applets. What is an applet? What is an applet? A Java program that runs in a web browser. A Java program that runs in a web browser. An applet.
Graphical User Interfaces. Graphical input and output with JOptionPane.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved COS240 O-O Languages AUBG,
GUI Basics. Agenda What GUI How to make in java Creating frames Frequently used GUI components Layout Managers.
1 Applets. 2 Design of Applets 3 Sun wrote Java to be executable within a hosting application browser The applications are applets. An applet is downloaded.
CIS Intro to JAVA Lecture Notes Set 8 9-June-05.
Using classes. One step instantiation, Composition I JFrame myWindow = new JFrame( ); Two step Instantiation, Composition II private JFrame myWindow;
CSC 1051 – Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website:
Outline Creating Objects The String Class The Random and Math Classes Formatting Output Enumerated Types Wrapper Classes Components and Containers Images.
Basics of GUI Programming Chapter 11 and Chapter 22.
Graphical User Interfaces A Graphical User Interface (GUI) in Java is created with at least three kinds of objects: –components, events, and listeners.
CSC 1051 – Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website:
Java Swing One of the most important features of Java is its ability to draw graphics.
Sadegh Aliakbary Sharif University of Technology Fall 2011.
Swing GUI Components So far, we have written GUI applications which can ‘ draw ’. These applications are simple, yet typical of all Java GUI applications.
Lesson 28: More on the GUI button, frame and actions.
Graphical User Interface (GUI)
GUI Tutorial Day 4. More GUI action  adding a Mouse Listener  SimpleDots  Simple mouse listener  Draw an oval where the mouse is clicked  Box example.
Getting Started with GUI Programming Chapter 10 CSCI 1302.
Basic Graphics 03/03/16 & 03/07/16 Imagine! Java: Programming Concepts in Context by Frank M. Carrano, (c) Pearson Education - Prentice Hall, 2010.
Java Swing. Graphical User Interfaces (GUIs) GUI: An application that uses graphical objects to interact with users GUI applications consist of: – Events:
CPCS 391 Computer Graphics Lab One. Computer Graphics Using Java What is Computer Graphics: Computer graphics are graphics created using computers and,
Import javax.swing.*; class Check { public static void main(String[] args) { JFrame frame = new JFrame("Check"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//DO_NOTHING_ON_CLOSE.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 7 ( Book Chapter 14) GUI and Event-Driven Programming.
Unit 131 GUI Layout Managers Learning Outcomes oList and distinguish between the four most common, standard layout managers in Java. oUse these and other.
Graphical User Interfaces
Using Objects.
Applets.
Drawing in Java.
class PrintOnetoTen { public static void main(String args[]) {
Steps to Creating a GUI Interface
Advanced Programming in Java
Real World Scenario Sometimes it's appropriate to have exactly one instance of a class: window manager print spooler Filesystems press Ctrl-F to display.
Presentation transcript:

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

Development Cycle

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); }

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); }

Patterns

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

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

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

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

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); }

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): }

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); }