UML and java classes <p>I do need your valuable help. A few weeks ago I developed a small program in Java. Probably a wrong approach, but I didn't tackle the problem with UML in mind, but on the basis of a given idea I built a fully functional piece of software which lives up to expectations.</p> <p>The program itself consist of two classes and several methods.</p> <p>Now I need to draw the corresponding UML class diagram and it seems a very knotty problem for me.</p> <p>Since the UML class diagram aims at showing the source code dependencies between classes, I'm wondering how I can draw a class diagram based on the following code.</p> <p>.................................................................</p> <p>import javax.swing.JPanel; class WavPanel extends JPanel {</p> <pre><code> List&lt;Byte&gt; audioBytes; List&lt;Line2D.Double&gt; lines; public WavPanel() { super(); setBackground(Color.black); resetWaveform(); } public void resetWaveform() { audioBytes = new ArrayList&lt;Byte&gt;(); lines = new ArrayList&lt;Line2D.Double&gt;(); repaint(); } } </code></pre> <p>................................................................</p> <p>In a nutshell, the WavPanel class is an example of inheritance. The JPanel class (part of a package) acts as a superclass. How can I solve the problem? My concern is that JPanel is a class which is part of a package.</p> <p>Furthermore, in order to draw a good class diagram am I wrong in thinking that maybe I had to do the UML diagram first and then write the associated code?</p> <p>The fact that I wrote several methods (instead of classes) and just a few classes, can that be a problem with UML? If so it would mean reengineering the entire software again.</p> <p>Thanks in advance . Any help will be highly appreciated.</p>