cesarsalgado
cesarsalgado

Reputation: 1026

How should I proceed to do a interactive program with drag feature and graph arrows

I'm doing a college project which I must finish in 3 months. And I have 8 hours a week to spend in that project.

The project consists in doing a graphical interface that shows many rectangles next to each other which should be movable. It should be very similar to the tabs in the chrome browser, where you can drag them to which ever position you want.

In addition to that there should be arrows connecting one rectangle to the other. And these arrows should still connect the same rectangles even when I change the order of the rectangles. The image below illustrates what I'm saying.

instance of the problem

The image shows before and after one of the rectangles being dragged.

Since Java is my first language, I would like to use it.

My question is: What framework, APIs should I use to do this project. What will be the easiest and fastest way to do it? Should I use Swing? or JavaFX? or GWT? or other alternative?

Is there an API for handling arrows connecting objects? Maybe one used for representing graphs may be ok.

Edit: I don't know anything about Swing and neither about JavaFX. So which one would be more worthwhile learning given that I don’t have too much time this semester because I’m very busy?

Upvotes: 1

Views: 368

Answers (2)

Johnydep
Johnydep

Reputation: 6277

You might want to check Java Universal Network/Graph Framework.
It has some extensive support for making editable graphs while maintaining relationship among nodes and edges.

What you can do is change the icon of node to a squared rectagnle, while add logic to plot them in a straight axis so that it would look the way you want, plus it would be editable while linked arrows will remain where they should be.

But incase you don't have experience with Swing, better start learning the basis of SWING first, as JUNG framework pretty much requires some good basic knowledge of swing itself.

Upvotes: 0

Mikhail
Mikhail

Reputation: 8038

This shouldn't be too hard to write from scratch.

Use this site : http://www.codeproject.com/Articles/116088/Draggable-Components-in-Java-Swing for the drag-able components

Draw arrows with some kind of parameterization (math formula) for half of an oval. Pass the draw path into a java.awt.Graphics2D pen object.

Upvotes: 2

Related Questions