Hii,i was writing a code for making radiobutton but the yes button is invisible and becomes visible if i move cursor on it,Can someone explain mistake in my code.
Code:
import javax.swing.*;
class r{
public static void main(String args[])
{
JFrame f = new JFrame();
f.setSize(200,200);
JRadioButton b1 = new JRadioButton("Yes");
JRadioButton b2 = new JRadioButton("No");
b1.setBounds(30,50,50,20);
b2.setBounds(30,80,50,20);
f.add(b1);
f.add(b2);
ButtonGroup bg = new ButtonGroup();
bg.add(b1);
bg.add(b2);
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
Comment