CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Posts
    101

    Can I make a drawing program by Java?

    I want to make a java program that can draw some graphics like rectangle, circle, polygon. When we draw , we can resize or move it after. How can I do this.. Java can do this kind of program ? Could u tell me the website that teach about this ?

    I want to make it and use it in the internet(applet)
    Thank you
    Kee

  2. #2
    Join Date
    Nov 2004
    Posts
    2

    Re: Can I make a drawing program by Java?

    yes, its possible,

    this is a little examble to draw:

    Code:
    import java.swing.*;
    import java.awt.*;
    public class Test extends JFrame{
     public Test(){
      super("Test");
      setSize(400, 400);
      setDefaultCloseOperation(EXIT_ON_CLOSE);
     }
     public static void main(String args[]){
      new Test();
     }
     public void paint(Graphics g){
      super.paint(g);
      g.drawRect(0, 0, 50, 50);
      g.fillOval(100, 100, 200, 200);
     }
    }
    you can use MouseMotionListener and variables to make the drag effect...

    take a look in the Java API specification on the classe Graphics and the interface MouseMotionListener

  3. #3
    Join Date
    Sep 2003
    Location
    Spokane, Wa
    Posts
    147

    Re: Can I make a drawing program by Java?

    You can use the attached source code as you wish. You can modify it, use it as a guide or pull out your hair as you try to understand it.

    See: 2D Graphics

    Attached Files Attached Files
    Last edited by Kirkess; November 24th, 2004 at 08:46 PM.

  4. #4
    Join Date
    Mar 2004
    Posts
    101

    Re: Can I make a drawing program by Java?

    thks , but I would like to know the other things.

    I want the user draw the rectangle like drawing program (the user can drag the scale of ractangle). Moveover, suppose that the user drawed 2 rectangles, after that he wants to modify it. he's clicking one of rectangle and resize its or delete its. How can I do this ? has it an website for tutoring ?

    Thank a lot
    Kee

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured