Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Custom painting/graphics  RSS feed

Micah Wedemeyer
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!