使用布局管理器时,使用setPreferredSize方法:
jbutton.setPreferredSize(new Dimension(w,h));
使用绝对布局时:
jbutton.setBounds(x,y,w,h);
setBounds(int x,int y,int width,int heigth)的时候就可以设置大小嘛!