select "connentPane"
set the "layout" property to "XYlayout"
then your problem disappear

解决方案 »

  1.   

    把Button所在的容器的Layout设为null或XYLayout。
      

  2.   

    你的布局不对,所以button要撑满整个frame了,把contentPane的布局改成其他布局就可以了
      

  3.   

    对,layout改成null后再
    myButton.setSize(x,y);
      

  4.   

    这里应该看你的容器的layout属性,你的button不能改变大小,是因为,你使用的是它的默认属性borderlayout,将它的属性变成null就可以改变button的大小了