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
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
2 Attachment(s)
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
:wave:
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