W2R3 – Update the JRadioButton name - updated code. fixed using lambda for action listener on edit button and changed jframe to public to get rid of warnings.

This commit is contained in:
bobbert committed 2025-02-04 19:49:26 +00:00
1 parent d5168f01f4
commit f2ea5de2da
1 file changed
+3 -2
@@ -34,7 +34,7 @@ public class MainViewer {
JRadioButton JR = new JRadioButton(name); // temporary use of name as label for JRadioButton - to allow for the use of text being manipulated // changed.
JButton JEdit = new JButton("Edit");
JButton JDelete = new JButton("Delete");
jp.add(JR);
jp.add(JEdit);
jp.add(JDelete);
@@ -74,9 +74,10 @@ public class MainViewer {
if (choice == JOptionPane.OK_OPTION)
{
System.out.println("OK option pressed.");
System.out.println("OK option pressed and set text to: " + JT.getText());
JR.setText(JT.getText());
} else if (choice == JOptionPane.CANCEL_OPTION) {
System.out.println("Cancel option pressed.");
dialog.dispose();
}