Search code examples
javaswinguser-interfacemodeling

How to implement a Modeling Application with GUI


I'm trying to implement a application with GUI in Java that can let users build a model using certain predefined modeling language.

Is there any approach that I could easily build a GUI where user can do "drag a circle into canvas", "connect this circle with that rectangle", etc?

Or I should just use Swing.(maybe Swing Builder for simplicity). listen to the action of mouse and draw something accordingly?

Also I found Graphic Modeling Frame work in Eclipse very interesting, but I'm not sure if I could integrate it into my App easily.


Solution

  • Personally, I would give the Eclipse Modeling Framework a try before starting to write something in Swing (or SwingBuilder - you mean the Swing framework for Groovy?), unless you need something very simple and you are quite sure the required functionality will remain small.

    According to the FAQ on the Eclipse wiki, it is possible to use EMF standalone in your application:

    "I want to use EMF, SDO, or XSD in my standalone project, or include only a working subset of the code. What libraries (jar files) do I need in my CLASSPATH?

    Eclipse Modeling Framework (EMF) provides the infrastructure to run the generated models and dynamic model based on existing ecore files. It also provides XMI/XML serialization and deserialization.

    The following jars can be used in standalone mode. [Lists of jars are provided for several scenarios.]"

    This EMF tutorial by Lars Vogel could also be useful.