The code bellow will enable users to scrible anything on a canvas. Now
what I intend to do is to create a vector object for every position
(pre_x,pre_y,x, y) of the lines drawn on the canvas and send it using
a socket connection to a remote server.
public void mouseDragged(MouseEvent e)
{
if(isButtonPressed==true)
{
pre_x=e.getX()+scrollbarH_value;
pre_y=e.getY()+scrollbarV_value;
isButtonPressed=false;
}
x=e.getX()+scrollbarH_value;
y=e.getY()+scrollbarV_value;
offscreenImageG.drawLine( pre_x, pre_y, x, y);
pre_x=x;
pre_y=y;
repaint();
e.consume();
message.setText(pre_x + ":" + pre_y + ":" + x + ":" + y);
}
Is my apporach considered to be feasible?. Any other ways?
Regards.
>The code bellow will enable users to scrible anything on a canvas.
Why are you using AWT in this day and age? If you
are (primarily) using Swing, why are you mixing Swing
with AWT?
>..Now what I intend to do is to create a vector
ArrayList (is probably) a better alternative to Vector,
since Java 1.2.
>...object for every position
>(pre_x,pre_y,x, y) of the lines drawn on the canvas and send it using
>a socket connection to a remote server.
...
>Is my apporach considered to be feasible?.
By who? I consider it feasible, until you try it and find
it fails because (..insert reason here).
>..Any other ways?
Construct the (joined) points into a GeneralPath and send
that, if they are not joined, send an ArrayList of same.

Signature
Andrew Thompson
http://www.athompson.info/andrew/