• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable inside a Graphics Rectangle

 
Prasann Mathur
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to show a Tree Graph in a Swing Frame. For these ,I am using JTable for representing each node. Now I want to place this JTable object inside a Rectangle , drawn using Graphics2D.
Because, if I can place it in a Graphics object i can draw line to connect child node with the parent node.
Do reply in as to how you can show in a rectangle , a JTable object or How you can show any information inside a rectangle Graphics object.
 
Peter Taucher
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there!

I don't see why you would "paint" a Tree Graph instead of using a JTree component. You could simply make your JTable objects to TreeCellRenderers.

bye, Peter
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A components paint method will draw over the component.
Here's a couple of variations of the idea.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!