Agenda For Feb 16 1. Discussion (Assignments & Rubric) 2. PowerPoint Presentation (Drawing Basic Shapes). 4.Read Unit 3 carefully (pages 15 - 20) then.

Slides:



Advertisements
Similar presentations
Chapter 13 Graphics.
Advertisements

Applets and Graphics.
Copyright 2006 by Pearson Education 1 Building Java Programs Supplement 3G: Graphics.
2D Graphics Drawing Things. Graphics In your GUI, you might want to draw graphics E.g. draw lines, circles, shapes, draw strings etc The Graphics class.
Laboratory Study II October, Java Programming Assignment  Write a program to calculate and output the distance traveled by a car on a tank of.
Graphics You draw on a Graphics object The Graphics object cannot directly be created by your code, instead one is generated when the method paintComponent.
Graphics Chapter 16.  If you want to draw shapes such as a bar chart, a clock, or a stop sign, how do you do it?
Introduction to shapes
PHY-102 SAPIntroductory GraphicsSlide 1 Introductory Graphics In this section we will learn how about how to draw graphics on the screen in Java:  Drawing.
LAB SESSION 7 Graphical user interface Applet fundamentals Methods in applets Execution of an applet Graphics class.
Georgia Institute of Technology Drawing in Java – part 2 Barb Ericson Georgia Institute of Technology September 2005.
CSC1401 Drawing in Java - 2. Reminder from last class How do you save your modified picture? String filename = …; Picture stevePicture = new Picture(filename);
Java Graphics Section 1 - Multi-File Graphics Programs Section 2 - The Coordinate System and Graphics Context g Section 3 - The Java Drawing and Painting.
Drinks Bottle Using CREO DEVELOPMENT
GUI and Swing, part 2 The illustrated edition. Scroll bars As we have previously seen, a JTextArea has a fixed size, but the amount of text that can be.
Java Applets A First Program. Applet Example /* The world’s simplest program, repeated once more in another format in an attempt to turn all of you into.
1 A Simple Applet. 2 Applets and applications An application is an “ordinary” program Examples: Notepad, MS Word, Firefox, Halo, etc. An applet is a Java.
1 Chapter 15 l Basic Figures l Colors l Fonts and Other Text Details Graphics Objects.
©2004 Brooks/Cole Applets Graphics & GUIs. Figures ©2004 Brooks/Cole CS 119: Intro to JavaFall 2005 Graphical Programs Most applications these days are.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 13 Graphics.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 3 - Introduction to Java Applets Outline 3.1 Introduction 3.2 Sample Applets from the Java 2.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Topics  Applets  Classes used for graphics Graphics Point Dimension.
1 L37 Graphics and Java 2D™ (2). 2 OBJECTIVES To use methods of class Graphics to draw lines,  rectangles,  rectangles with rounded corners,  three-dimensional.
Copyright 2006 by Pearson Education 1 Building Java Programs Supplement 3G: Graphics.
2D Graphics in Java COMP53 Nov 14, Applets and Applications Java applications are stand-alone programs – start execution with main() – runs in JVM.
Slides prepared by Rose Williams, Binghamton University Chapter 19 Swing II.
1 Applets Chapter 1 To understand:  why applets are used to extend the capabilities of Web pages  how an applet is executed and know about the restrictions.
Java Applets. Road Map Introduction to Java Applets Review applets that ship with JDK Make our own simple applets –Introduce inheritance –Introduce the.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 5 Applets and Graphics.
Object Oriented Programming (OOP) LAB # 5 TA. Maram & TA. Mubaraka TA. Kholood & TA. Aamal.
Program Design With Methods And Graphics / Chapter 4 1 Abstract Window Toolkit.
Java Unit 5: Applets and Graphics Web Pages and Viewing Applets.
Graphics. Graphics Features in Java Topics to be covered Topics to be covered Graphics Basics Graphics Basics Coordinate System Coordinate System Graphics,
Chapter 16: Graphics. Objectives Learn about the paint() and repaint() methods Use the drawString() method to draw String s using various fonts and colors.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Java Applets What is an Applet? How do you create.
Agenda For Feb Finish up Unit 3 Exercises on page Unit 4 Exercises on page 33. Question #2 3. Create a Happy Face Java Applet (due next class).
Graphics and Multimedia Part #2
Java On The Web Session 15. Memory Upload JAVA Applets Colors Fonts Drawing Methods Posting your Applet.
Learn about the types of Graphics that are available Develop a basic Graphics applet Develop a basic Graphics application Review the Java API and use.
Chapter 15Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Chapter 15 l Basic Figures l Colors l Fonts and Other Text Details.
Applets & Graphics. Applets programs that run inside a browser Java platform-independence makes applets possible security restrictions: –cannot read or.
1 Applets and Course Evaluation Applet Example - Sailing Applet UML Diagrams Applet Web Page Encoding (HTML) Applet Java Coding – Hello World Course Evaluation.
Introduction to Java Simple Graphics. Objects and Methods Recall that a method is an action which can be performed by an object. –The action takes place.
Agenda For Feb PowerPoint Presentation (Introduction to Java Methods) 2.Finish Unit 2 exercises on page 13 (due by the end of the class today). 4.
CPS Today’s topics Java Applications Graphics Upcoming Review for Midterm Exam Reading Great Ideas, Chapters 5.
1 Building Java Programs Supplement 3G: Graphics These lecture notes are copyright (C) Marty Stepp and Stuart Reges, They may not be rehosted, sold,
Drawing rectangles and ovals in the Applet window Displaying Text in the Java Console Window Demo of the HelloAgain program Arithmetic expressions Examples.
(C) 2010 Pearson Education, Inc. All rights reserved.  Class Graphics (from package java.awt) provides various methods for drawing text and shapes onto.
Merete S COLLEGEFACULTY OF ENGINEERING & SCIENCE Graphics ikt403 – Object-Oriented Software Development.
25/2/00SEM107 - © Kamin & ReddyClass 9 - HTML - 1 Class 9 - HTML r Creating a personal web page r Structure of HTML documents r HTML tags r The APPLET.
Chapter 2: Graphics In Java Basics of classes –instance variables –methods –overriding methods Graphics class (drawing routines) Other classes –Color –Font.
Graphics and Java2D Chapter Java Coordinate System Origin is in _____________ corner –Behind title bar of window X values increase to the ________.
Introductory Graphics Chapter Three. Computer Graphics §Full motion pictures (“Star Wars”) l animated films §Virtual reality §Games §Simulators (air craft.
Agenda March 8 1.PowerPoint Presentation on Variables. For download:
CSI 3125, Preliminaries, page 1 Applet. CSI 3125, Preliminaries, page 2 Applet An applet is a Java program that runs in a Web browser. An applet can be.
IT11 Agenda for Feb Golden Rule Reminder. 2. PowerPoint demonstration on the structure of Java Applet programs. Source Files HTML Files Class Files.
Agenda For Feb PowerPoint Presentation on Java Methods. 3. Finish Happy Face Assignment (Due by the.
Please open JCreator and follow these steps: 1)Configure  Options 2)JDK Tools 3)Choose Run Applet from drop-down 4)Click Default, then Edit 5)Click the.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 3 - Introduction to Java Applets Will not cover Section 3.7 Thinking About Objects: Identifying.
2-POINT PERSPECTIVE. Exercise: Follow the next steps in order to create a box in a 2-point perspective.
CS202 Java Object Oriented Programming GUI Programming – Color and Drawing Methods Chengyu Sun California State University, Los Angeles.
Graphics Drawing Things With Java. Today's Topics Course Updates Java Graphics –Java 1.1 versus Java 1.2 (Java 2) Drawing Lines Drawing Shapes.
Applet: An applet is a java program that is transmitted over the network from the server to client & executed within clients browser. Applets are used.
Intro to Graphics from Chapter 2 of Java Software Solutions
12 Graphics and Java 2D™.
Building Java Programs
Basic Graphics Chapter 5 3/19/15 Thursday Section Only
Today’s topics Java Applications Upcoming Reading Graphics
4.14 GUI and Graphics Case Study: Creating Simple Drawings (Cont.)
Presentation transcript:

Agenda For Feb Discussion (Assignments & Rubric) 2. PowerPoint Presentation (Drawing Basic Shapes). 4.Read Unit 3 carefully (pages ) then do: Sec 3.1 and 3.2 Mastery Questions (on pages 18 & 19) Unit 3 Unit Exercises (on page 20). " When you put a date on your dream, it becomes a goal. When you aim for the goal, it becomes a challenge. When you beat the challenge, the reward is success. To have success... you need a dream..." Copyright © 2004 Raja Akhtar 3.Finish both Unit 2 Exercises & Assignment 2. Hand in all written questions. I will be coming around today to check you off for Assignment # 2 (Applet). 5. If you finish go on to Unit 4 & try all Mastery Questions.

Java Coordinate System The Java coordinate system is a little different from the one you are used to. In Java the origin (0,0) is located at the top left-hand corner of your applet. As the value of x increase the paint brush will move across the applet from left to right. As the value of y increases the paint brush will move down the applet. An x value greater than the width of the applet will run you off the screen and a y value greater than the height of the applet will also run you off the screen. Where do you go to change the dimensions of your Applet?

The Graphics variable “screen” contains many drawing methods that we will be using. On page 21 (in the box at the bottom) there is a comment that reads “declare a Graphics variable”. Please disregard this comment and all others like it in the text book. You don’t need to declare a Graphics variable here because it is already present in the header of the paint function. The drawing methods that we will be using are: Basic Methods of the Graphics Class drawString (“text goes here”, x-coordinate, y-coordinate); drawLine (x-start, y-start, x-end, y-end); drawRect (x-TopLeft, y-TopLeft, width, height); drawRoundRect (x-TopLeft, y-TopLeft, width, height, r1, r2); drawOval (x-TopLeft, y-TopLeft, width, height); drawArc (x-TopLeft, y-TopLeft, width, height, startDeg, endDeg);

Drawing Rectangles & Ovals screen.drawRect (0, 0, 50, 20); screen.drawRoundRect (10, 40, 80, 40, 10, 10); (0,0) (10,40) level of roundness

Drawing Arcs screen.drawArc (?, ?, ?, ?, ?, ?); 90 degrees 270 degrees 0 degrees180 degrees (50,50)(80,50) (80,60) To draw an Arc you first have to specify an Oval and then specify (using angles) what part of the oval you wish to draw. screen.drawArc (50, 50, 30, 10, 0, 90);

public class myApplet extends Applet { // variable section (declare your variables here) Graphics screen; // you can omit this line // initialization method public void init() { } // this method handles all the painting to the screen public void paint(Graphics screen) { // drawing instruction go here screen.drawRect (0, 0, 50, 20); } } Your Applet Program With Comments

screen.drawRect (0, 0, 50, 20); screen.drawRoundRect (30, 40, 75, 45, 25, 25); (30, 40)