import java.awt.*; import java.applet.Applet; public class GridBag2 extends Applet{ public GridBag2(){ GridBagLayout gb=new GridBagLayout(); GridBagConstraints c =new GridBagConstraints(); setLayout(gb); Button nupp1=new Button("Nupp 1"); c.gridx=c.gridy=0; c.weightx=c.weighty=1; c.fill=GridBagConstraints.BOTH; gb.setConstraints(nupp1, c); add(nupp1); } public static void main(String argumendid[]){ Frame f=new Frame("Paigutus"); f.add(new GridBag2()); f.setSize(200, 200); f.setVisible(true); } }