import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Nupud{ public static void main(String argumendid[]){ AbstractButton[] b=new AbstractButton[5]; b[1]=new JToggleButton("nr 1"); b[2]=new JCheckBox("nr 2"); b[3]=new JRadioButton("nr 3"); b[4]=new JRadioButton("nr 4"); ButtonGroup bg=new ButtonGroup(); for(int i=2; i<5; i++){ bg.add(b[i]); } JFrame f=new JFrame("Nupuraam"); Container p=f.getContentPane(); p.setLayout(new GridLayout()); for(int i=1; i<5; i++) p.add(b[i]); f.pack(); f.setVisible(true); } }