1

I am trying to make a component for an application which a user can use to create simple UML diagrams . The idea is that the user will drag & drop the shapes on canvas and then add some text to it .

The problem is that I haven't done anything similar before or anything that has to do with graphics(except GUI).

What I would like to ask is how I would be able to store the state of a canvas so it can be serialised and send to another canvas to be redrawn.

Would I be able to save coordinates on a text document and send that document ? If not how such operations are done usually ? Thanks

Giannis
  • 5,286
  • 15
  • 58
  • 113

1 Answers1

3

easiest way would be store Graphics Objects in the Set, Map, Vector, Array or in the separate Class that hold your Objects (nice answer to my question by @trashgod) before painting in paintComponent method, then there you can prepare Object for painting (meaning remove, add, modify, clone or compare)

Community
  • 1
  • 1
mKorbel
  • 109,525
  • 20
  • 134
  • 319