Warum nicht?
/*
* BasePanel.java
*
* Created on 17.09.2010, 07:49:32
*/
package test;
import javax.swing.JButton;
/**
*
* @author Noname
*/
public class BasePanel extends javax.swing.JPanel {
/** Creates new form BasePanel */
public BasePanel() {
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")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jButton1.setText("Button 1");
add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 120, -1, -1));
jButton2.setText("Button 2");
add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 120, -1, -1));
}// </editor-fold>
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
// End of variables declaration
}
/*
* TopPanel.java
*
* Created on 17.09.2010, 07:49:57
*/
package test;
import java.awt.Graphics;
/**
*
* @author Noname
*/
public class TopPanel extends BasePanel {
/** Creates new form TopPanel */
public TopPanel() {
super();
initComponents();
System.out.println(getComponentCount());
}
/** 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")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jButton1 = new javax.swing.JButton();
setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jButton1.setText("Button 3");
add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 90, -1, -1));
}// </editor-fold>
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
// End of variables declaration
}