import java.awt.*:
import javax.swing.*;
public Main{
public static void main(String[] args){
JFrame frame = new JFrame("Radio Button");
JRadioButton rbApel = new JRadioButton("Apel");
JRadioButton rbNanas = new JRadioButton("Nanas");
JRadioButton rbJambu = new JRadioButton("Jambu"):
ButtonGroup group = new ButtonGroup();
group.add(rbApel);
group.add(rbNanas);
group.add(rbJambu);
frame.add(rbApel);
frame.add(rbNanas);
frame.add(rbJambu);
frame.setSize(400, 300);
frame.setLocation(200, 100);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
I liked this article very much. The content is very good. Keep posting.
ReplyDeleteVisit us: Java Training
Visit us: Java Course