Search code examples
javaumlclass-diagram

Is a JPanel represented as a class of its own in a Class Diagram?


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?


Solution

  • 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:

    class diagram