Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2007

Tip: Looking for answers? Try searching our database.

draw line position - networking

Thread view: 
solomon13000@gmail.com - 06 Oct 2007 20:44 GMT
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.
Andrew Thompson - 06 Oct 2007 21:55 GMT
>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/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.