I am trying to create a custom component using Java AWT or Swing which will be a rectangle with a number of components inside of it, including other rectangles. Something like this:
╔══════╗
║ ┌┐ ║
║ ├┘ ║
║ ║
╚══════╝
And this needs to be a component that I can preferably draw with one instruction. Something like myFrame.add(new MyComponent())
.
What would you say is the best way to do this? Is there a way I can do this using Rectangle
, or should I go with JPanel
or something from Swing?