Welcome Guestlogin to KGsePGregister at KGsePG email | FAQs

Java based simulator created for Free hand drawing using mouse

download

    1 of 24

    Java based simulator created for Free hand drawing using mouse



    Java based simulator created for Free hand drawing using mouse - Transcript


    PROJECT REPORT ON
    Java based simulator created for Free hand drawing using mouse

    Index
    S No Contents Pg No
    1 Theories involved
    Introduction to java
    Applet
    awt
    Multithreading
    2 Proposed system
    3 Feasability
    4 Fact finding techniques
    5 System Requirements
    Hardware requirements
    Software requirements
    6 System Analysis
    Entity Relationship Diagram
    Data Flow Diagram
    Class Diagram
    Use Case Diagram
    Activity Diagram
    Component Diagram
    7 Coding
    8 User Manual
    Input Screen Layout
    Output Screen Layout
    9 Limitations and Future Enhancements
    10 Conclusion
    11 Bibliography


    Introduction to java
    Java Programming basics
    Java technology is
    A programming language
    A development environment
    An application environment
    A deployment environment
    Syntax
    class Class name


    Javac it compiles the java file and converts it into class file
    To compile javac FreeHand java
    To run java FreeHand
    Primary goals of java technology
    Is object oriented to help you visualize the program in real life
    It eliminates pitfalls of other programming languages
    Speed development Reduces the complie link load test cycle
    Code portability enables you to write code that can be run on multiple operating systems
    Java technology architecture
    JVM
    Garbage collection
    JRE
    Java virtual machine
    It is an imaginary machine that is implemented by emulating it in software on a real machine
    Provides hardware platform to compile all java codes
    It generates byte code that makes java platform independent
    JVM Tasks
    Loads code
    Verifies code
    Executes code
    Java runtime environment
    At runtime the byte codes that make java software programs are loaded checked and run in an interpreter
    runtime
    Applet
    What is applet
    Applet is a package that consist of small programs that are executed by using a Web browser or a tool such as the applet viewer
    The applet viewer is included in the Java Development Kit JDK
    The applet viewer reads the HTML and interprets the information that is contained between the applet tags
    An applet must be a subclass of the java applet Applet class which provides the standard interface between the applet and the browser environment
    An applet must be a subclass of the java applet Applet class which provides the standard interface between the applet and the browser environment
    The life cycle of an applet
    By calling certain methods a browser manages an
    applet life cycle if an applet is loaded in a web page
    init This method is intended for whatever initialization is needed for your applet
    start This method is automatically called after init method It is also called whenever user returns to the page containing the applet after visiting other pages
    stop This method is automatically called whenever the user moves away from the page containing applets You can use this method to stop an animation
    destroy Called by the browser or applet viewer before the applet is terminated The stop method is invoked before destroy
    Handling Events
    To react to an event an applet must override the appropriate event specific method
    Interfaces Key Listener Mouse Listener Text Listener Window Listener
    Events Key Event Mouse Event Text Event Window Event
    Multithreading
    A multithreaded program contains two or more parts that can run concurrently Each part of such a program is called a thread
    Each thread defines a separate part of execution
    Multithreading is a specialized form of multitasking
    Multithreading helps in speeding up computation of a program
    Multithreading enables you to write very efficient programs that make maximum use of CPU because ideal time can be kept to the minimum
    awt
    AWT Abstract Window Toolkit provides support for applets and is also the foundation upon which Swing is built
    It can also create stand alone windows that run in a GUI environment i e it provides a machine independent programming interface for applications
    AWT classes are contained in java awt package
    Object hierachy Every GUI component that appears on the screen is a subclass of abstract class Component or MenuComponent
    The class Container is an abstract subclass of Component which permits other components to be nested inside it These components can also be containers permitting other components to be nested inside which creates a complete hierarchial structure Containers are helpful in arranging GUI components on screen The containers Panel and Frame are the containers that you use most often
    Class hierarchy for panel and frame
    PROPOSED SYSYTEM
    The proposed system is supposed access the desktop of the remote machine Server to the machine on which it is running Client
    This system is supposed to have two machines one as server and the other as client The Server will start and wait for a client to establish a connection Client requires server machine s IP address to connect
    When a client connects to the server a connection is establish for that particular client Then server sends image of the desktop of the server machine
    These images are sent after every specific time interval and update the client about the server s desktop status
    FEASIBILITY STUDY
    From the inception of ideas for a software system until it is implemented and delivered to customer and even after that the system undergoes gradual developments and evaluations
    The software is said to have life cycle composed of several phases At the feasibility stage it is desirable that two or three different configuration will be pursed that satisfy the key technical requirement but which represent different level of ambition and cost
    Feasibility is the determination of whether or not a project is worth doing A feasibility study is carried out select a best system that mate performance requirements
    The data collected during primary investigation examines system feasibilities that are likelihood that the system will be beneficial to the organization Four tests for feasibility study are as follows
    Technical Feasibility
    This is concerned with specifying equipment and software that will successfully satisfy the use considerably but might include
    The feasibility to produce output in a given time because system is fast enough to handle multiple users
    Response time under certain circumstances and ability to process a certain volume of transaction of a particular speed
    Feasibility to communicate data to distant location
    Economical Feasibility
    Economic analysis is the most frequently used technique used for evaluating the effectiveness of a proposed system More commonly known as cost benefit analysis the procedure is to determine the benefits and savings that are expected from a proposed system and compared them with cost Though the cost of installing the system may appear high it is one time investment The resulting benefit is that automation results in turn around time The resulting cost benefit ratio is favorable
    Operational Feasibility
    It is mainly related to human organizational as social aspects The points to be considered are
    The system interface is standard
    It is user friendly
    Provides extensive help Hence no training is required
    FACT FINDING TECHNIQUES
    The very first step in the field of system analysis and design is to collect the information regarding the system Success of any requirement depends on availability of accurate reliable information The fact finding techniques used for this project are as follows
    Observation Interview
    In this method the flow of system the way of executing processes steps practically followed in actual scenario etc are observed Through observation of systems where virtual network computing is used for accessing remote terminals we were able to understand the layout working functionality of the system We interviewed people who actually use such systems to know how useful this system is to be able to understand its full fledged functionality
    SYSTEM REQUIREMENTS
    Hardware Requirements
    Processor type Intel R Core TM 2 Duo Processor
    Processor cache size 2048 Kb
    Memory 3 GB RAM
    Memory speed 667 Mhz
    Memory Technology DDR2 SDRAM
    Hard Disk 250 GB HDD
    Mouse Standard Serial Mouse
    Keyboard 101 104 Keys
    Software Requirements
    Operating System Windows XP
    Software JVM JDK 1 5 1
    E R diagram

    Component diagram
    Class diagram
    It depicts methods in addition to attributes
    Activity diagram of applet
    This depicts the flow of tasks between various components of a system
    USE CASE diagram
    This shows the interaction between users and the system in particular the steps of tasks that users perform
    SOURCE CODE
    import java awt
    import java awt event
    import java awt geom
    import java awt image BufferedImage
    import javax swing
    import javax swing event

    public class FreeHand extends JPanel

    BufferedImage image
    Color color
    Stroke stroke

    public FreeHand

    color Color blue
    stroke new BasicStroke 1f BasicStroke CAP BUTT
    BasicStroke JOIN MITER


    protected void paintComponent Graphics g

    super paintComponent g
    if image null
    initImage
    g drawImage image 0 0 this


    public void draw Point start Point end

    Graphics2D g2 image createGraphics
    g2 setRenderingHint RenderingHints KEY ANTIALIASING
    RenderingHints VALUE ANTIALIAS ON
    g2 setPaint color
    g2 setStroke stroke
    g2 draw new Line2D Double start end

    JPanel panel new JPanel new GridLayout 1 0
    for int j 0 j colors length j

    JButton button new JButton
    button setFocusPainted false
    button setBackground colors j
    button addActionListener l
    panel add button

    return panel


    private JPanel getControlPanel

    JButton clear new JButton clear
    clear addActionListener new ActionListener

    public void actionPerformed ActionEvent e

    clearImage


    final JSlider slider new JSlider JSlider HORIZONTAL 1 6 1
    slider addChangeListener new ChangeListener

    public void stateChanged ChangeEvent e

    float value Integer slider getValue floatValue
    stroke new BasicStroke value BasicStroke CAP BUTT
    BasicStroke JOIN MITER


    JPanel panel new JPanel
    panel add new JLabel stroke
    panel add slider
    public void mouseDragged MouseEvent e

    Point p e getPoint
    freeHand draw start p
    start p



    Limitations Future Enhancements

    Conclusion

    Bibliography

    In this project the drawing is restricted to only free hand drawing We can add more number of menu options
    The project now does not feature a tool bar which can be included as a side bar
    We can have options like drawing circles rectangles squares ovals polygons etc
    A color menu can also be added
    Also a scroll bar can be added in order to make the frame work larger
    Currently the project is restricted to only drawing The project can be enhanced to make the free hand drawing act as an memory image source for animation
    In this project i e a simulator created for free hand drawing using mouse the various graphical methods functions classes and instance varialbles have been explored
    It has a graphical user interface built
    This is used to create drawings on a blank canvas
    Books
    The complete reference java J2SE Herbert Schildt
    Teach yourself java
    Programming with java E Balaguruswamy
    The sun java Sun microsystems
    Database system concepts Silbertschatz Korth and Sudarshan
    Website
    www google com
    www sun com
    Introduction to java
    Networking
    Advanced io streams
    ADVANCED JAVA PROGRAMMING
    DEVELOPING GRAPHICAL USER INTERFACE
    BUILDING APPLICATIONS
    MORE OBJECT ORIENTED PROGRAMMING
    GUI based applications
    Text based applications
    Arrays
    Exceptions Assertions
    GUI event handling
    Advanced class features
    threads
    Identifiers keywords
    Class design
    Expressions flow control
    Building java GUI
    OOP
    Getting started
    Loads from
    Hard disk
    Network
    Other
    source
    compile
    Class loader
    Runtime
    interpreter
    Bytecode
    verifier
    Hardware
    FreeHand class
    javac
    FreeHand java