Reputation: 316
I am developing a Java application that will have a JFrame with a tabbed pane inside it consisting of eight tabs. Each tab will have a JPanel in it.
If I am to draw a class diagram of this application, would the JPanels be represented as classes on their own under the JFrame's class or would I just include their attributes and behaviors in the JFrame's class?
Upvotes: 1
Views: 2556
Reputation: 469
No, each component/container is a class on its own, there isn't any relationship between them. However if you have a class that extends JFrame, then you would put that class as a child/subclass of JFrame.
I drew this up as an example for you:
Upvotes: 1
Reputation: 13123
If you're really drawing a class diagram, where one figure on the diagram represents one object/class, then of course you wouldn't put attributes of a JPanel within a JFrame figure, because that class does not have those attributes.
Class diagrams show relationships among classes, along with their attributes and sometimes their methods. A class diagram for a GUI application bears little resemblance to the GUI design of the application.
Upvotes: 0
Reputation: 442
See if you can get any useful information from this post: Representing swing components in UML class diagrams. If not, just post your comments so that I can research more and help you.
Upvotes: 0