Drawing of 2-d Primitives

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 34

DRAWING OF 2-D

PRIMITIVES

By:- Shreyansh Gang C.S.E IV Year

FLOW OF THE PRESENTATION

Project

Language used for the Project Organization

ORGANIZATION WHERE I DID MY TRAINING

About DRDO

Technology Areas

ABOUT DRDO :

DRDO was formed in 1958.

Responsible for the development of technology for use by the military. Design, develop and lead to production state-ofthe-art sensors, weapon systems, platforms and allied equipment for our Defence Services.

TECHNOLOGY AREAS :

Aeronautics Engineering

Materials

Missiles

Armaments

Life Science

Naval System

Combat Engineering

Electronics

Language Used

Run The Project

Drawing Of 2-D Primitives

Graphics Object

Components Of Project

LANGUAGE USED :

WHY JAVA ONLY :-

C++

JAVA

A BRIEF HISTORY OF JAVA


Sun Microsystems 1990

Green Project James Gosling Oak 1992 green Project Spun Off 1994 Focus targeted to Web technology 1994 Oak renamed to JAVA 1995 - Java was first publicly released.

JAMES GOSLING

James Gosling is generally credited as the inventor of the Java programming language He was the first designer of Java and implemented its original compiler and virtual machine He is also known as the Father of Java

FEATURES OF JAVA :Simple Familiar Secure Portable Object-oriented Multithreaded Interpreted Distributed Dynamic

GRAPHICS PRIMITIVES :Point

Line

Oval

Polygon

Rectangle

Arc

String

HOW THESE PRIMITIVES ARE DRAWN:-

LINE:
Lines are drawn by means of the drawLine( ) method, shown here: void drawLine(int startX, int startY, int endX, int endY) drawLine( ) displays a line in the current drawing color that begins at startX, startY and ends at endX, endY.

RECTANGLE:
The drawRect( ) and fillRect( ) methods display an outlined and filled rectangle, respectively. They are shown here: void drawRect(int top, int left, int width, int height) void fillRect(int top, int left, int width, int height)

ELLIPSE AND CIRCLE:

To draw an ellipse, use drawOval( ). To fill an ellipse, use fillOval( ). These methods are shown here: void drawOval(int top, int left, int width, int height) void fillOval(int top, int left, int width, int height)

ARC:

Arcs can be drawn with drawArc( ) and fillArc(), shown here: void drawArc(int top, int left, int width, int height, int startAngle, int sweepAngle) void fillArc(int top, int left, int width, int height, int startAngle, int sweepAngle)

POLYGON:

It is possible to draw arbitrarily shaped figures using drawPolygon( ) and fillPolygon( ), shown here:

COMPONENTS OF PROJECT:

Applet

Frame

Event Handling

APPLET

Applets are small applications that are accessed on an Internet server, transported over the Internet, automatically installed, and run as part of a Web document. Applets are used to provide interactive features to web applications that cannot be provided by HTML alone. They can capture mouse input and also have controls like buttons or check boxes. In response to the user action an applet can change the provided graphic content. This makes applets well suitable for demonstration, visualization and teaching.

LIFE CYCLE OF AN APPLET

FRAMES:

Frame encapsulates what is commonly thought of as a window.

It is a subclass of Window and has a title bar, menu bar, borders, and resizing corners. Two of Frames constructors: Frame( ) Frame(String title)

THE CLASS HIERARCHY FOR FRAME :

EVENT HANDLING:
With event-driven programming, events are detected by a program and handled appropriately Events: moving the mouse clicking the button pressing a key sliding the scrollbar thumb choosing an item from a menu

THREE STEPS OF EVENT HANDLING


1

Prepare to accept events import package java.awt.event Start listening for events include appropriate methods Respond to events implement appropriate abstract method

1. PREPARE TO ACCEPT EVENTS


Import package java.awt.event Applet manifests its desire to accept events by promising to implement certain methods Example: ActionListener for Button events AdjustmentListener for Scrollbar events

2. START LISTENING FOR EVENTS


To make the applet listen to a particular event, include the appropriate addxxxListener. Examples: addActionListener(this) shows that the applet is interested in listening to events generated by the pushing of a certain button.

3. RESPOND TO EVENTS
The appropriate abstract methods are implemented. Example: actionPerformed() is automatically called whenever the user clicks the button. Thus, implement actionPerformed() to respond to the button event.

You might also like