drawing application?
hi all....i want to develop a drawing application which allow user to draw on the screen and the drawings will be sent over to the other client. it's something like isketch (http://isketch.net/). It's a real time drawing application.
any suggestions on how should do it to be able to send drawings over the other client? i plan to let user draws on white-color background image, and send the image every x seconds. would it be a good idea?
[454 byte] By [
don.juan9a] at [2007-11-27 10:55:10]

# 1
Yeah sure. Here's what you do. (this is assuming you know about all the networking involved).
public class ThisClass extends Canvas {
JFrame mainFrame;
public ThisClass() {
mainFrame = new JFrame("Main Frame";
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.setSize(500, 500);
Container cp = mainFrame.getContentPane();
cp.add(this);
}
public void sendCurrentImage() {
BufferedImage buf = new BufferedImage(500, 500);
Graphics gg = buf.createGraphics();
paint(gg2);
//at this point your Image (buf) is filled with whatever is currently on the screen. then you can send it to the other client.
}
public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D)g;
//all your paint stuff here.
}
public static void main(String[] args) {
new ThisClass();
}
}
ok, now i may just be ranting. but this will ONLY work if BufferedImage implements Serializable, which i am WAY to lazy to go check right now. Hope this helps.