W2R3 – Update the JRadioButton name -- improved debugging in console to make it more human readable.

This commit is contained in:
bobbert committed 2025-02-04 19:56:17 +00:00
1 parent 7c91864b96
commit 732156ac97
1 file changed
+9 -4
@@ -42,15 +42,20 @@ public class MainViewer {
System.out.println("Row number: "+ row + " Has been created!"); System.out.println("Row number: "+ row + " Has been created!");
ActionListener EditListener = e -> { ActionListener EditListener = e -> {
System.out.println("Edit Button clicked for Row: " + row + " with Radio Button Text as: " + JR.getText()); System.out.println("Edit Button clicked for Row: " + row + "\n- with Radio Button Text as: " + JR.getText());
DialogueBox(JR.getText(), JR); DialogueBox(JR.getText(), JR, row);
}; };
JEdit.addActionListener(EditListener); 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); JTextField JT = new JTextField(JRtext);
@@ -74,7 +79,7 @@ public class MainViewer {
if (choice == JOptionPane.OK_OPTION) 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()); JR.setText(JT.getText());
} else if (choice == JOptionPane.CANCEL_OPTION) { } else if (choice == JOptionPane.CANCEL_OPTION) {
System.out.println("Cancel option pressed."); System.out.println("Cancel option pressed.");