Click to See Complete Forum and Search --> : Can I make a drawing program by Java?
kee149
November 23rd, 2004, 11:44 PM
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
fbafelipe
November 24th, 2004, 04:41 PM
yes, its possible,
this is a little examble to draw:
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
Kirkess
November 24th, 2004, 07:43 PM
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 (http://java.sun.com/docs/books/tutorial/2d/index.html )
:wave:
kee149
November 24th, 2004, 08:59 PM
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
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.