Results 1 to 9 of 9
  1. #1
    evandevon is offline Member
    Join Date
    Jul 2010
    Posts
    4
    Rep Power
    0

    Default Helped needed to modify code

    Hi Java-coders! I'm totally new to Java and have a request. I am writing an opensource app in AutoHotKey script which will help severely physically disabled (e.g. twitch a finger/single muscle etc) people paint using a computer. I don't know how to draw bezier curves that go THROUGH chosen points and so I've stumbled across the opensource Java project "Cusp":

    Cusp - CubicSpliner | Download Cusp - CubicSpliner software for free at SourceForge.net

    This app basically is a gui in which you click some points and a curve is made going through those points, the entire coordinates of which are saved to a text file and read by my app. This process is very visually intrusive and I require something more like a command line program. i.e.call the program with the coordinates and automatically save a text file with the curve's coordinates (all done invisibly). To be honest I am not willing to become a Java master to solve this one problem but if it is simple to modify the code it would be much appreciated if someone could point me in the right direction or help me write something that works.

    Also, I've already contacted the author of "Cusp" to no avail.

    Thanks in advance, Evs.

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default

    Quote Originally Posted by evandevon View Post
    To be honest I am not willing to become a Java master to solve this one problem
    Tough luck, we won't do it for you either.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,458
    Rep Power
    25

    Default

    Have you done any work on it? Are you having problems?
    If so post them here with your questions?

  4. #4
    al_Marshy_1981 is offline Senior Member
    Join Date
    Feb 2010
    Location
    Waterford, Ireland
    Posts
    748
    Rep Power
    5

    Default

    Like Norm said just post whatever attempt you have so far even if you think it is rubbish, you wont get help unless you have made some kind of effort

  5. #5
    evandevon is offline Member
    Join Date
    Jul 2010
    Posts
    4
    Rep Power
    0

    Default

    That's fair enough, I read tonnes of comments similar to PhHein's on the AutoHotkey forums as well so that was expected - just thought I'd put the request out there, but thanks to the rest of you for responding with a better attitude.
    I already downloaded the Netbeans IDE and I've opened up the source file cubicspliner.java (I've attached the source).

    The first step I guess I need to do is change the program so that it could either read a text file with my coordinates in it so that the program starts with a curve already drawn or to be run like a command line prog and call it along with the coordinates as parameters, which option do you suggest?

    I don't know how to do the command line way so...
    If I go for a text file read I need a loop which will run and read each line which will look like this:
    x1,y1
    x2,y2
    x3,y3
    xn,yn

    Can anyone tell me where this loop should be put in the code and why? I'm guessing about line 238 in cubicspliner.java which is after the gui has been setup. I'm not on my com at the moment - I'll post some code when i get home.
    Any comments?

    Thanks, Evs
    Attached Files Attached Files

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,458
    Rep Power
    25

    Default

    Waiting for the posted code.

  7. #7
    evandevon is offline Member
    Join Date
    Jul 2010
    Posts
    4
    Rep Power
    0

    Default

    Sorry it took me so long to get back on here, busy organising a wedding and I thought I'd better see if I could teach myself. Anyway, after spending DAYS trying to learn Java I've realised it's harder than it looked at first glance. I dabbled in C++ years ago and the AutoHotkey language I know and love is a bit more user friendly to the likes of me. So this is where my learning (or lack of) has brought me to...

    Questions:
    1.
    What is the difference between when a mouse is 'clicked' and when it is 'pressed'? The action takes place after I click the canvas but it is under the 'pressed' method.

    2.
    At line 1362 in cubicspliner.java there is the method call
    addPoint(new Vector2D(mx, my));
    with the word 'Vector2D' in italics - is this for a reason?

    3. I realised that Java doesn't just run through its code at its beginning (unless constructors are used...) which is unlike what I'm used to so this seems to make sense to me:
    When I add at line 574:
    public void mouseEntered(MouseEvent e)
    {
    574 addPoint(new Vector2D(100, 100));
    }
    would this make a point at 100,100 whenever I enter the mouse into the canvas?

    4. How do I compile the source files in netbeans? whenever i hit run main project the .java file I have open isn't compiled but a project from the left window which lists my past projects. i just want to modify the .java file and see if my changes work.

    Thanks, Evs

  8. #8
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,458
    Rep Power
    25

    Default

    What is the difference between when a mouse is 'clicked' and when it is 'pressed'?
    What does the API doc say on that?
    Write a small program and add mouse listeners
    and have each method print out when it is called. It will show you what happens when.

    Sorry about the rest of the questions. I haven't seen the code you talk about and I don't use your IDE.

  9. #9
    evandevon is offline Member
    Join Date
    Jul 2010
    Posts
    4
    Rep Power
    0

    Default

    Hi Norm! Thankyou for your advice, after spending ages trying to learn java I've decided to change strategy. Because life tends to get in the way (funerals/my wedding/renovations etc) of my hobbies it's taking too long to get anywhere while dragging you along for the ride. I'll just go at my slow pace and post the occassional specific question (as opposed to a general 'help me!') in the forums.

    Thanks again, Evs.

Similar Threads

  1. needed code for this output
    By rajivjoshi in forum New To Java
    Replies: 4
    Last Post: 05-31-2010, 05:54 PM
  2. [SOLVED] Assistence is needed with my code. ty
    By JOSCMS_JAVANEWB in forum Other IDEs
    Replies: 6
    Last Post: 04-18-2009, 11:21 AM
  3. Hi code needed for JCA adaptor
    By lavanya82 in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 03-04-2009, 10:34 AM
  4. My code is not working properly ..modify it
    By Shyam Singh in forum New To Java
    Replies: 14
    Last Post: 07-16-2008, 05:48 PM
  5. Help needed with java arrays code
    By d24706 in forum New To Java
    Replies: 2
    Last Post: 03-07-2008, 01:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •