I am new to coding and I am trying to figure out how to write a radio button selection to an excel file. So far I am able to create an excel file with the string that I wrote myself, but I am having trouble with the logic that connects the jFrame radio button to the excel file.

Essentially, my code allows a user to select a radio button. The radio button text gets printed in a text field. The user can click the close button and the jFrame closes itself. I would like to achieve having the radio button selection stored in an excel file after it is selected. Currently, I see no errors in running individually, I'm just not sure how to connect the two together.

Code:
package javaapplication6;
import javax.swing.ButtonGroup;


public class NewJFrame1 extends javax.swing.JFrame {

   
    public NewJFrame1() {
        initComponents();
        btngp1();
    }

private void btngp1() {
        ButtonGroup bg1 = new ButtonGroup();
    
        bg1.add(rbtn1);
        bg1.add(rbtn2);
        bg1.add(rbtn3);       
}
    
    private void rbtn1ActionPerformed(java.awt.event.ActionEvent evt) {                                      
        tfld1.setText("1");
    }                                     

    private void rbtn2ActionPerformed(java.awt.event.ActionEvent evt) {                                      
        tfld1.setText("2");
    }                                     

    private void rbtn3ActionPerformed(java.awt.event.ActionEvent evt) {                                      
        tfld1.setText("3");
    }                                     

    private void closebtnActionPerformed(java.awt.event.ActionEvent evt) {                                         
        this.dispose();

public static void main(String args[])

  // Variables declaration - do not modify                     
    private javax.swing.ButtonGroup btngp1;
    private javax.swing.JButton closebtn;
    private javax.swing.JRadioButton rbtn1;
    private javax.swing.JRadioButton rbtn2;
    private javax.swing.JRadioButton rbtn3;
    private javax.swing.JTextField tfld1;
    // End of variables declaration                   
}
Code:
package Writer;

import java.io.File;
import java.io.IOException;
import jxl.*;
import jxl.write.*;
import jxl.write.Number;
class writeExcel 
{
    public static void main(String args[]) throws IOException, WriteException
    {
    try {
        String fileName = "C:\\Users\\kevin\\Desktop\\Project.xls";
        WritableWorkbook workbook = Workbook.createWorkbook(new File(fileName));
        WritableSheet sheet = workbook.createSheet("Sheet1", 0);
        
        Label label = new Label(0,0, btngp1);
        sheet.addCell(btngp1);
        
   
        workbook.write();
        workbook.close();
    } catch (WriteException e) {
 
    }}}