Drawing of 2-d Primitives

Embed Size (px)

Citation preview

  • 8/2/2019 Drawing of 2-d Primitives

    1/34

    DRAWINGOF 2-DPRIMITIVES

    By:- Shreyansh Gang

    C.S.E IV Year

  • 8/2/2019 Drawing of 2-d Primitives

    2/34

    FLOW OF THE PRESENTATION

    Organization

    Languageused for theProject

    Project

  • 8/2/2019 Drawing of 2-d Primitives

    3/34

    ORGANIZATIONWHERE I DIDMYTRAINING

  • 8/2/2019 Drawing of 2-d Primitives

    4/34

    About DRDO

    TechnologyAreas

  • 8/2/2019 Drawing of 2-d Primitives

    5/34

    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-of-the-art sensors, weapon systems, platforms and

    allied equipment for our Defence Services.

  • 8/2/2019 Drawing of 2-d Primitives

    6/34

    TECHNOLOGY AREAS :

    AeronauticsEngineering

    Armaments

    CombatEngineering

    Electronics

    Life Science

    Materials Missiles

    NavalSystem

  • 8/2/2019 Drawing of 2-d Primitives

    7/34

  • 8/2/2019 Drawing of 2-d Primitives

    8/34

  • 8/2/2019 Drawing of 2-d Primitives

    9/34

    DrawingOf 2-D

    Primitives

    LanguageUsed

    GraphicsObject

    ComponentsOf Project

    Run TheProject

  • 8/2/2019 Drawing of 2-d Primitives

    10/34

    LANGUAGE USED :

  • 8/2/2019 Drawing of 2-d Primitives

    11/34

    WHY JAVA ONLY :-

    C++ JAVA

  • 8/2/2019 Drawing of 2-d Primitives

    12/34

    A BRIEF HISTORYOF 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.

  • 8/2/2019 Drawing of 2-d Primitives

    13/34

    JAMES GOSLING

    James Gosling is generally creditedas the inventor of the Javaprogramming language

    He was the first designer of Java andimplemented its original compiler andvirtual machine

    He is also known as the Father of

    Java

  • 8/2/2019 Drawing of 2-d Primitives

    14/34

    FEATURES OF JAVA :-

    Simple

    Familiar

    Secure

    Portable Object-oriented

    Multithreaded

    Interpreted

    Distributed Dynamic

  • 8/2/2019 Drawing of 2-d Primitives

    15/34

    GRAPHICS PRIMITIVES :-

    Point

    Line

    Rectangle Arc

    Oval Polygon

    String

  • 8/2/2019 Drawing of 2-d Primitives

    16/34

    HOW THESE PRIMITIVES ARE DRAWN:-

  • 8/2/2019 Drawing of 2-d Primitives

    17/34

    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 drawingcolor that begins at startX, startYand ends at endX,endY.

  • 8/2/2019 Drawing of 2-d Primitives

    18/34

    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)

  • 8/2/2019 Drawing of 2-d Primitives

    19/34

    ELLIPSE AND CIRCLE:

    To draw an ellipse, use drawOval( ). To fill anellipse, use fillOval( ). These methods are shownhere:

    void drawOval(int top, int left, int width,

    int height)

    void fillOval(int top, int left, int width,

    int height)

  • 8/2/2019 Drawing of 2-d Primitives

    20/34

    ARC:

    Arcs can be drawn with drawArc( ) and fillArc(),shown here:

    void drawArc(int top, int left, int width, int height, intstartAngle, int sweepAngle)

    void fillArc(int top, int left, int width, int height,int startAngle, int sweepAngle)

  • 8/2/2019 Drawing of 2-d Primitives

    21/34

    POLYGON:

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

  • 8/2/2019 Drawing of 2-d Primitives

    22/34

    COMPONENTS OF PROJECT:

    EventHandling

    Frame

    Applet

  • 8/2/2019 Drawing of 2-d Primitives

    23/34

    APPLET

  • 8/2/2019 Drawing of 2-d Primitives

    24/34

    Applets are small applications that are accessed on anInternet server, transported over the Internet, automaticallyinstalled, and run as part of a Web document.

    Applets are used to provide interactive features to webapplications that cannot be provided by HTML alone.

    They can capture mouse inputand also have controls like

    buttonsor check boxes. In response to the user action anapplet can change the provided graphic content. This makesapplets well suitable for demonstration, visualization andteaching.

  • 8/2/2019 Drawing of 2-d Primitives

    25/34

    LIFE CYCLE OF AN APPLET

  • 8/2/2019 Drawing of 2-d Primitives

    26/34

    FRAMES:

    Frame encapsulates what is commonly thought ofas 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)

  • 8/2/2019 Drawing of 2-d Primitives

    27/34

    THECLASSHIERARCHYFOR FRAME :

  • 8/2/2019 Drawing of 2-d Primitives

    28/34

    EVENT HANDLING:

    With event-driven programming, events aredetected by a program and handled appropriately

    Events: moving the mouseclicking the button

    pressing a keysliding the scrollbar thumb

    choosing an item from a menu

  • 8/2/2019 Drawing of 2-d Primitives

    29/34

    THREE STEPSOF EVENT HANDLING

    1 Prepare to accept eventsimport package java.awt.event

    2 Start listening for eventsinclude appropriate methods

    3 Respond to eventsimplement appropriate abstract method

  • 8/2/2019 Drawing of 2-d Primitives

    30/34

    1. PREPARETOACCEPTEVENTS

    Import package java.awt.event

    Applet manifests its desire to accept events by

    promising to implement certain methods Example:

    ActionListener for Button events

    AdjustmentListener forScrollbar events

  • 8/2/2019 Drawing of 2-d Primitives

    31/34

    2. STARTLISTENINGFOREVENTS

    To make the applet listen to a particular event,

    include the appropriate addxxxListener.

    Examples:addActionListener(this)

    shows that the applet is interested inlistening to events generated by thepushing of a certain button.

  • 8/2/2019 Drawing of 2-d Primitives

    32/34

    3. RESPONDTOEVENTS

    The appropriate abstract methods areimplemented.

    Example:actionPerformed() is automatically

    called whenever the user clicks thebutton.Thus, implement actionPerformed() torespond to the button event.

  • 8/2/2019 Drawing of 2-d Primitives

    33/34

  • 8/2/2019 Drawing of 2-d Primitives

    34/34