public class Frame1 extends BaseFrame {
  XYLayout xYLayout1 = new XYLayout();
  JButton jButton1 = new JButton();  public Frame1() {
    try {
      jbInit();
    }
    catch(Exception e) {
      e.printStackTrace();
    }
  }
  private void jbInit() throws Exception {
    jButton1.setText("jButton1");
    this.getContentPane().setLayout(xYLayout1);
    this.getContentPane().add(jButton1, new XYConstraints(231, 188, 81, 35));
  }
}
我就加了一个按钮上去,看看有什么不对的地方

解决方案 »

  1.   

    你把layout都重新搞了??
    layout不变的情况下,好像可以。
    不过我觉得没有必要继承
    类似这样不就行了:   JPanel jj=new JPanel();
       jj.add(new JButton("test"));
       BaseFrame bf=new BaseFrame();
       bf.getContentPane().add(jj,BorderLayout.SOUTH);
       bf.show();
      

  2.   

    你把layout都重新搞了??
    layout不变的情况下,好像可以。
    不过我觉得没有必要继承
    类似这样不就行了:   JPanel jj=new JPanel();
       jj.add(new JButton("test"));
       BaseFrame bf=new BaseFrame();
       bf.getContentPane().add(jj,BorderLayout.SOUTH);
       bf.show();