Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

java GUI conundrum??

Options
  • 21-02-2005 4:54pm
    #1
    Closed Accounts Posts: 228 ✭✭


    my problem is this ...I'm trying to create a GUI which contains components that you can drag around and connect to other components for example
    (1) (2) and (3) are components connected by connecting lines


    1 and 2 are input to 3 and 3 adds them and outputs a result
    Has anyone does this before?how would I achieve getting connecting lines from each object to other objects


Comments

  • Registered Users Posts: 333 ✭✭s4dd


    although i'm not certain what you want to achieve..

    perhaps the components could be drawn on a canvas an upon a "mouse dragged" action, or similar, the connecting lines could be redrawn. and perhaps proximity could be calculated by line length..

    although if you were a bit clearer and even if you provided a picture of what you wanted to achieve....

    regards


  • Closed Accounts Posts: 228 ✭✭daggeredge


    Sorry I should have been clearer

    e.g:
    component 1 holds the integer (4)
    component 2 holds the integer (2)

    when they are connected to 3 they are subjected to whatever mathematic operation 3 contains, so if 3 is an adder function when 1 and 2 are connected to 3 in this case , 3 outputs the integer (6)
    I plan it to be expandable so that the output of 3 could connect to a 4 etc....

    I plan to do this on a canvas where all the components can be dragged around and Connecting lines can be drawn between things & was just wondering how you would achieve this kind of functionality :D


  • Registered Users Posts: 2,426 ✭✭✭ressem


    You're going to have value objects, operation objects and connecting line paths which can either be objects themselves or calculated and drawn when the paint method of the other objects is called.

    Is this a school project or a work project. If you want a serious project you might want to look at Eclipse GEF classes draw2d and dnd, which have connections with routing and drag and drop listeners. Not suitable for collegework though.

    http://www.eclipse.org/articles/Article-GEF-Draw2d/GEF-Draw2d.html
    http://publib.boulder.ibm.com/infocenter/ad51help/index.jsp?topic=/org.eclipse.gef.doc.isv/reference/api/overview-tree.html


  • Registered Users Posts: 333 ✭✭s4dd


    i guess simplest way would to have the lines either as objects or have small objects at the tip of the lines to drag around... don't see it being a huge probelm is it's all on a canvas


Advertisement