Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Antonios

macrumors newbie
Original poster
Apr 15, 2007
15
0
I want to build a visual based environment in which the user will drag and drop components on an empty canvas and these components would be possible to be interconnected with lines using Java like Quartz composer. My questions are:
1) How would I build the graphic part of the block? Use Java2D to create a rectangle? Use photoshop to make the graphic and then insert it in my project? Then how would I add the properties? Build a class that has the functionality and through properties link them to the graphic?
2) How would I built the lines and in the same time make the flow between two blocks a reality?
 

HiRez

macrumors 603
Jan 6, 2004
6,265
2,630
Western US
For starters, I would think you'd want to do the drawing "live", as opposed to prerendering images, because that will give you more flexibility for scaling the boxes, recoloring, etc. For the connecting line you probably want to investigate Béziér curves (cubic or quadratic). A simple stroked curve will probably give you the effect you want, you'll just need to experiment on where and how to place the control points relative to the two boxes being connected for the right effect. You don't really need to know much math to draw them, but it wouldn't hurt, as they are mathematical entities behind the visual representation you see.
 

Antonios

macrumors newbie
Original poster
Apr 15, 2007
15
0
Then if I go with the drawing live i will have to use Java2D to built my own container/node. Hmm, will have to look into it.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.