先在applet的init方法里,setLayout(null);
然后定义一个button,在用button.setBounds(100,100,70,30);
第一,二个参数为x,y值,第三,四参数为按钮的长宽。
然后把button添加到applet上
add(button);

解决方案 »

  1.   

    setLayout(null)
    Button v = new Button("d");
    v.setBound(int x,
                        int y,
                        int width,
                        int height);
      

  2.   

    setLayout(null)  //为什么要把布局设为空呢?
    我查了一下类库的书,好象Button没有setBounds()这个方法呀!不过我的书比较老,1999年出的。
      

  3.   

    必须把布局设为空的,
    您可以参考java核心技术这本书你就可以知道了。
    setLayout(null);
    Button button = new Button(String buttontext);
    button.setBound(int x,int y,int width,int height);
    不过sun不推荐你使用这种方法的。