public class DrawST extends javax.swing.JFrame {
/**
* Creates new form DrawST
*/
public DrawST() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
Generated code
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new DrawST().setVisible(true);
}
});
}
class Class01 extends JPanel{
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
}
}
class Class02 extends JPanel{
@Override
public void paintComponent(Graphics g){
super.paintComponent(g);
}
}
// Variables declaration - do not modify
// End of variables declaration
}
How can I use both Class01 and Class02 to paint in this JFrame, Class01 will draw pipes, and Class02 will draw frog(Happy Frog). I try to create Container contain = getContentPane(); and add two classes. But it work only 1 class added.If I add two classes, the JFrame won't draw anything.