使用布局管理器时,使用setPreferredSize方法:1jbutton.setPreferredSize(new Dimension(w,h));使用绝对布局时:1jbutton.setBounds(x,y,w,h);