I am creating a "flowchart" type application, but instead of being just a documentation aid I want to actually execute the logic represented on screen. However my question is more graphics related than specific to the logic of the application.
In the two images attached you will see a number of orange squares. These are customised JPanels. Each panel will know which other panels it should be linked to. The actual black lines shown in the images below I have added using a paint program to illustrate what I want to end up with.
I can already drag these panels around the desktop. They are all sitting on another "white" JPanel.
So given that I can drag these panels around and each panel knows the name of the panel it's connected to, can I override the paint method of the parent (background) panel to draw the lines between them. I guess I would need to pass some form of list to the parent panel which indicates the lines which need removing and re-drawing.
Comments welcome - I've not done any low level graphics work before.
I wonder if I could ask another question which is directly linked to the above example. In the image above as I mentioned the background is a JPanel and the flowchart symbols are JPanels. As I don't know how big my virtual page needs to be I would like to create the background panel to say 2000 x 2000 pixels and put it on a jscrollpane. Umm, well obviously not that simple. Given the nature of my drag and drop symbols I am having to use an absolute layout manager on my background panel.
I'm confident I can do this, but experimentation has yet to yield results.
Joined: Jun 09, 2003
not sure what problem you're having...
if it's the backgroundPanel/scrollpane, just give the backgroundPanel a preferredeSize