From 732156ac97e6eb85d559c827dd18e29f6355d4d9 Mon Sep 17 00:00:00 2001 From: mudabbir-ahmad Date: Tue, 4 Feb 2025 19:56:17 +0000 Subject: [PATCH] =?UTF-8?q?W2R3=20=E2=80=93=20Update=20the=20JRadioButton?= =?UTF-8?q?=20name=20--=20improved=20debugging=20in=20console=20to=20make?= =?UTF-8?q?=20it=20more=20human=20readable.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/userprofilebuilder/view/MainViewer.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/userprofilebuilder/view/MainViewer.java b/src/main/java/userprofilebuilder/view/MainViewer.java index ca2e304..391f32f 100644 --- a/src/main/java/userprofilebuilder/view/MainViewer.java +++ b/src/main/java/userprofilebuilder/view/MainViewer.java @@ -42,15 +42,20 @@ public class MainViewer { System.out.println("Row number: "+ row + " Has been created!"); ActionListener EditListener = e -> { - System.out.println("Edit Button clicked for Row: " + row + " with Radio Button Text as: " + JR.getText()); - DialogueBox(JR.getText(), JR); + System.out.println("Edit Button clicked for Row: " + row + "\n- with Radio Button Text as: " + JR.getText()); + DialogueBox(JR.getText(), JR, row); }; JEdit.addActionListener(EditListener); + ActionListener RadioListener = e -> { + System.out.println("Radio Button toggled for Row: " + row + "\n- with Radio Button Text as: " + JR.getText() + "\n- With state of radio button as: " + JR.isSelected()); + }; + JR.addActionListener(RadioListener); + } - public void DialogueBox(String JRtext, JRadioButton JR){ + public void DialogueBox(String JRtext, JRadioButton JR, int row){ JTextField JT = new JTextField(JRtext); @@ -74,7 +79,7 @@ public class MainViewer { if (choice == JOptionPane.OK_OPTION) { - System.out.println("OK option pressed and set text to: " + JT.getText()); + System.out.println("OK option pressed and set text to: " + JT.getText() + " for row :" + row); JR.setText(JT.getText()); } else if (choice == JOptionPane.CANCEL_OPTION) { System.out.println("Cancel option pressed.");