Perry Smith

Java Questions & Answers

Home / Java Q & A Page 2 / Java Q & A Archive Main Page

Graph editor
Monday, 23-Nov-98 16:20:41
195.11.50.203 writes:

I want to create a graph editor, where the user can create graphs made out
of nodes, arrows, labels etc. Now, I want the user to be able to create,
delete, move, select and de-select (the user can select a region or a single
arrow and move it etc.)
The only problem is I don't know where to start or how to do this.
I'm not exactly a wizard when it comes to java and any help on this subject
is much appreciated.

Suzanne

Response
Re: Graph editor
Tuesday, 24-Nov-98 02:09:33
171.212.152.78 writes:

First of all .... this program is gonna take some time. Probably a week
dedicated programming (and who has the time for that ... so, probably 2-4
weeks, depending on how much time you have). Most of what you're asking
about above is covered by the java.awt.MouseEvent class. But then you'll
have to create the various components. And have them interact appropriately
which is where I'm guessing you'll be doing the most debugging. Pretty much
all of the classes you need are subsets of java.awt, though. To get you
started though, what I'd do is start with the basic applet class and then
get the container going .... I'm guessing you'll have to use something like
a GridBag layout manager with fairly high component containment
(e.g. "setLayout(new GridBagLayout(40,40))"). If I'm thinking about this
correctly, then what that LayoutManager will do is allow you to move your
various components. Though the components will "snap" to approximately the
location you desire when "dropped", the amount of inaccuracy with the
"snap-to" effect will be reduced by having large numbers in the
GridBagLayout construction.

MikeD



Home / Java Q & A Page 2 / Java Q & A Archive Main Page