Create JRadioButtons ActionListener in java
How to Create JRadioButtons ActionListener in java. I Have two Calsses Main.Java and other Class MyFrame My Frame Extends JFrame it behaves it’s like a JFrame it also Implements ActionListener and Constructor. So going to create 4 JRadioButtons .Button names (window xp, windows 7, windows 8.1, windows 10). So we can actually limit the choice selection only one item. Create now ButtonGroup and we need add this RadioButton to this Group. We can use are ActionPerformed method to detect which Button was selected so with in are ActionPerformed method we can place as Simple if Statement. package javaFxProject; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JRadioButton; public class MyFrame extends JFrame implements ActionListener { JRadioButton winxp; JRadioButton win7; JRadioButton win8; JRadioButton win10; ...