1 Classe Graphics Alcides Calsavara. 2 Uso com Applets u parâmetro do método paint –public void paint ( Graphics g ) u utilizado como base para o desenho.

Slides:



Advertisements
Similar presentations
JSP e Beans Alcides Calsavara. Exemplo de beans ExemploBeans.html FORM HTML ExemploBeans.jsp HTML + Java ACTION SpellCheck.class (bean)
Advertisements

1 Editor Gráfico Alcides Calsavara. 2 Interface Forma Cor Desenho.
VHDL.
Applets and Graphics.
Chapter 15 Graphics. To paint, you need to specify where to paint. Each component has its own coordinate system with the origin (0, 0) at the upper-left.
Copyright 2006 by Pearson Education 1 Building Java Programs Supplement 3G: Graphics.
For(int i = 1; i
x y z Medidas do prisma: 2X2X4 A B CD EF G H A(,, ) B(,, ) C(,, ) D(,, ) E(,, ) F(,, ) G(,, ) H(,, ) Determinar as coordenadas do vértices do prisma.
Life Cycle of an Applet, along with response to mouse events and other simple features. (ps:only two possible examples for life circle of an Applet)
CSE 1341 Honors Professor Mark Fontenot Southern Methodist University Note Set 21.
AWT Components. 2 Using AWT Components 4 Component –Canvas –Scrollbar –Button –Checkbox –Label –List –Choice –TextComponent –TextArea –TextField 4 Component.
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 Chapter 16.  If you want to draw shapes such as a bar chart, a clock, or a stop sign, how do you do it?
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.
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 1 Chapter 2 2D Graphics: Basics.
LAB SESSION 7 Graphical user interface Applet fundamentals Methods in applets Execution of an applet Graphics class.
More About Recursion - 2 Java. Looking at more recursion in Java A simple math example Fractals.
Objects, Variables & Methods Java encapsulates data and action modules that access the data in one container, called an object. Object members that.
Java Graphics Section 1 - Multi-File Graphics Programs Section 2 - The Coordinate System and Graphics Context g Section 3 - The Java Drawing and Painting.
©2004 Brooks/Cole Applets Graphics & GUIs. Figures ©2004 Brooks/Cole CS 119: Intro to JavaFall 2005 Graphical Programs Most applications these days are.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Topics  Applets  Classes used for graphics Graphics Point Dimension.
Simple Gui in C++. Project Selecting So Far Registering the window class Creating the window.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 5 Java Graphics Applets.
Handling Errors in Java Programming. // The “name-of-application” class import java.awt.*; import hsa.Console; public class name-of-application { static.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 5 Applets and Graphics.
Chapter 5 Graphics. Topics Applets Classes used for graphics –Graphics –Point –Dimension –Color.
Program Design With Methods And Graphics / Chapter 4 1 Abstract Window Toolkit.
Drawing pictures with Java. JFrame: the basic Java window The swing package contains classes, objects and methods that can be used to create a consistent.
1 Drawing Shapes and Text With Applets. 2 Drawing in the paint method import java.awt.*;// access the Graphics object import javax.swing.*;// access to.
Java Programs u 1 project file –with an extension of.mcp –contains information that CodeWarrior needs to run the program u >= 1 source files –have an extension.
©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 Discussion (Assignments & Rubric) 2. PowerPoint Presentation (Drawing Basic Shapes). 4.Read Unit 3 carefully (pages ) then.
Introducing Graphics There are generally two types of graphics facilities in Java –Drawing –GUIs We concentrate on drawing here We will draw on a Graphics.
Java On The Web Session 15. Memory Upload JAVA Applets Colors Fonts Drawing Methods Posting your Applet.
Object Oriented Programming one of the main reasons we now teach Java instead of C++. C++ was designed to be backwardly compatible with the original (non-OOP)
Repetition - while, for and do “Loops - iterations Chapter Eight.
Exposure Java-A 2006 Chapter 4 Slides Using Methods and Parameters
Methods and Parameters Chapter 5 How to split large programs into isolated sections. Focus on one part of the problem – which can be “called” on or “invoked”
Applets & Graphics. Applets programs that run inside a browser Java platform-independence makes applets possible security restrictions: –cannot read or.
Graphics & Java 2D Drawing Two Dimensional Shapes Controlling Fonts Controlling Colors.
Canvas and Graphics CS 21a. 9/26/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved L17: Canvas.
Applets Applet is java program that can be embedded into HTML pages. Java applets runs on the java enabled web browsers such as mozilla and internet explorer.
10/11: do/while, Logical Operators the revised SwitchTest.java notes on JApplets the do / while repetition structure break continue Logical operators.
Lecture 8.3 The Use of JComponent. © 2006 Pearson Addison-Wesley. All rights reserved More About the Standard Drawing Classes java.awt.Container.
CPS Today’s topics Java Applications Graphics Upcoming Review for Midterm Exam Reading Great Ideas, Chapters 5.
Graphics & Applets CSC 1051 – Data Structures and Algorithms I
1 Windows program example import java.awt.*; import java.awt.event.*; public class wpexample extends Frame { public wpexample(String title) { super(title);
1 Building Java Programs Supplement 3G: Graphics These lecture notes are copyright (C) Marty Stepp and Stuart Reges, They may not be rehosted, sold,
(C) 2010 Pearson Education, Inc. All rights reserved.  Class Graphics (from package java.awt) provides various methods for drawing text and shapes onto.
Painting (Chapter 12) Java Certification Study Group January 25, 1999 Mark Roth.
(c)2006 E.S.Boese All Rights Reserved.1 Drawing Shapes and Text Chapter 2 – Lecture Slides.
Chapter 2: Graphics In Java Basics of classes –instance variables –methods –overriding methods Graphics class (drawing routines) Other classes –Color –Font.
Introductory Graphics Chapter Three. Computer Graphics §Full motion pictures (“Star Wars”) l animated films §Virtual reality §Games §Simulators (air craft.
Introduction to Graphics. Graphical objects To draw pictures, we will use three classes of objects: –DrawingPanel : A window on the screen. –Graphics.
Lec 15 Writing an Applet Class. Agenda Writing an Applet class Java Graphics class.
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.
6.1 Coordinates The screen of a computer is a grid of little squares called pixels. The color of each pixel can be set individually, and drawing on the.
CPCS 391 Computer Graphics Lab One. Computer Graphics Using Java What is Computer Graphics: Computer graphics are graphics created using computers and,
Object Oriented Programming one of the main reasons we now teach Java instead of C++. C++ was designed to be backwardly compatible with the original.
The 4 Stages of Program Design  Cryptic Programming Stage  Unstructured, Spaghetti-Programming Stage  Structured Programming Stage  Object Oriented.
The 4 Stages of Program Design  Cryptic Programming Stage  Unstructured, Spaghetti-Programming Stage  Structured Programming Stage  Object Oriented.
CS202 Java Object Oriented Programming GUI Programming – Color and Drawing Methods Chengyu Sun California State University, Los Angeles.
Java Graphics and Java2D
Intro to Graphics from Chapter 2 of Java Software Solutions
Design responsivo.
Today’s topics Java Applications Upcoming Reading Graphics
PowerPoint Presentation Authors of Exposure Java
Java Applets.
Making a Smile Face Pepper.
Drawing Shapes (Graphics Class) Creating Objects Packages
Presentation transcript:

1 Classe Graphics Alcides Calsavara

2 Uso com Applets u parâmetro do método paint –public void paint ( Graphics g ) u utilizado como base para o desenho do applet u exemplos: –g.drawLine (... ) –g.drawRect (... )

3 Método setColor u setColor (Color c) u define a nova cor para desenho u exemplos: –setColor ( Color.black ) –setColor ( Color.blue ) –setColor ( Color.red )

4 Método drawRect u drawRect (int x1, int y1, int x2, int y2) u desenha um retângulo com vértices opostos (x1,y1) e (x2,y2) u coordenadas (0,0) no canto superior esquerdo u exemplos: –drawRect ( 0, 0, 100, 200 ) –drawRect ( 20, 50, 90, 300 )

5 Método drawLine u drawLine (int x1, int y1, int x2, int y2) u desenha uma reta entre as coordenadas (x1,y1) e (x2,y2) u exemplos: –drawLine ( 100, 200, 300, 200 ) –drawLine ( 300, 100, 100, 300 )

6 Método drawArc u drawArc (int x, int y, int largura, int altura, int anguloInicial, int anguloArco) u exemplo: drawArc (10, 10, 60, 40, 30, 40) (x,y) altura largura 0 90