aspose file tools
The moose likes Swing / AWT / SWT and the fly likes Custom painting/graphics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Custom painting/graphics" Watch "Custom painting/graphics" New topic

Custom painting/graphics

Micah Wedemeyer
Ranch Hand

Joined: Jun 11, 2001
Posts: 68
I am trying to make a graphing package for Swing. By graphing, I mean a set of nodes laid out with the vertices connecting them.
I have built a custom layout manager to properly lay out the nodes (which are JComponents, just think of them as Buttons). However, I do not know what to do with the edges. Since they are just straight lines, I think that I should just call drawLine() However, I'm not sure where to do this. If I make a custom panel that does all the drawing, then I have both the panel and the layout manager to worry about (increase coupling). However, if I have the layout manager draw the lines, I think that would be a violation of what the layout manager is supposed to do. I'm not even sure the layout manager can draw lines.
Give me any advice you have, I'd welcome any suggestions.
It is sorta covered in the JavaRanch Style Guide.
subject: Custom painting/graphics