写了个类继承JApplet, 在其中添加JButton,按扭不能正常显示,只有鼠标移到上面才显示,点击以后只有被点击按扭显示,其他都不可见了。估计是是刷新的问题,但不知道怎么解决。如果用的Button,就没有这个问题。请大虾指点,谢谢!

解决方案 »

  1.   

    你是不是在代码里把Jbutton给加了隐藏属性,刷新会带来这样的问题吗?不会吧。
      

  2.   

    没有经过处理,直接this.add();然后setBounds();private JButton ok = new JButton("ok");
    ...
    this.add(ok);
    ok.setBounds(20,20,50,25);
    ...
      

  3.   

    Container c=this.getContentPane();
    c.setLayout(...);
    ..
    c.add(ok);
      

  4.   

    在建立界面的代码之后加上
    this.pack();
    this.show();
      

  5.   

    添加一句ok.setVisible(true);后试试看还是不是有问题!