diff --git a/src/main/java/userprofilebuilder/view/MainViewer.java b/src/main/java/userprofilebuilder/view/MainViewer.java index 3962ea1..3411ba5 100644 --- a/src/main/java/userprofilebuilder/view/MainViewer.java +++ b/src/main/java/userprofilebuilder/view/MainViewer.java @@ -67,15 +67,22 @@ public class MainViewer { panel.add(JT); - JOptionPane pane = new JOptionPane(panel, 3, 2); // content of dialogue box + //JOptionPane pane = new JOptionPane(panel, 3, 2); // content of dialogue box + JOptionPane pane = new JOptionPane(panel, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION); JDialog dialog = pane.createDialog("Rename Dialogue Box"); // title of dialogue box dialog.setVisible(true); // changed boiler plate code from .show() to .setVisible(true) because apparently IDE says it's better!! // actions. + int choice = (int) pane.getValue(); - - + if (choice == JOptionPane.OK_OPTION) + { + System.out.println("OK option pressed."); + JR.setText(JT.getText()); + } else if (choice == JOptionPane.CANCEL_OPTION) { + dialog.dispose(); + } }