Hello everyone. Been riding the
fence on a design decision and I was hoping someone could stear me in the right direction.
First has anyone worked with the 2DLine objects much? I've got a class that extends from the Rectangle shape but their is no easy way to extend a Line object. It basically has two static factory methods which kind of puts a cramp in the direction I was going with my Rectangle class.
I want a clean way via a mediator to handle events on objects drawn in a JPanel. They are loaded in via a file and drawn into a JPanel at the moment. My demo works fine and I'm happy with it but I'm worried about how it will scale. Right now I'm using the JPanel's paint(Graphic) to draw the images into.
I parse a file that contains a uniqueID, color and icon name. I basically need to allow them to click on a rectangle, then a line and make an entry into a JPanel(BorderLayout.South).add(myJTable).
What is the best way to handle the events?
Do I have this objects extend JComponent? I see a lot of examples that do. If I do that I can override the tooltip text messages for free and do some neat stuff.
Do I implement the objects as Shape and have the Graphics 'canvas' passed in and the object draw into it?
Can't decide but my deadline for the beta is before Thanksgiving so any help would be appreciated.
Been reading and looking at examples and can't find ANYTHING that is like what I want to do. I basically want to do something JUST LIKE TogetherJ with the mouse clicks on UML shapes updating via mediator other associated component views.
Thanks for reading. Look forward to your comments on this
thread.
Ed