From dffe04254f86d64d91d8fa392dd91ef0741a1ed0 Mon Sep 17 00:00:00 2001 From: mudabbir-ahmad Date: Tue, 4 Feb 2025 18:47:20 +0000 Subject: [PATCH] =?UTF-8?q?W2R2=20=E2=80=93Bring=20up=20a=20Dialog=20Box?= =?UTF-8?q?=20-=20finished=20everything=20for=20dialogue=20box.=20moving?= =?UTF-8?q?=20onto=20actions=20for=20dialogue=20box.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../userprofilebuilder/view/MainViewer.java | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/src/main/java/userprofilebuilder/view/MainViewer.java b/src/main/java/userprofilebuilder/view/MainViewer.java index 9f426cb..3962ea1 100644 --- a/src/main/java/userprofilebuilder/view/MainViewer.java +++ b/src/main/java/userprofilebuilder/view/MainViewer.java @@ -42,27 +42,47 @@ public class MainViewer { System.out.println("Row number: "+ row + " Has been created!"); - ActionListener buttonListener = new ActionListener() { + ActionListener EditListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.out.println("Edit Button clicked for Row: " + row + " with Radio Button Text as: " + JR.getText()); - DialogueBox(JR.getText()); + DialogueBox(JR.getText(), JR); } }; - - JEdit.addActionListener(buttonListener); + JEdit.addActionListener(EditListener); } - public void DialogueBox(String JRtext){ - JOptionPane pane = new JOptionPane(JRtext); // content of dialogue box - JDialog dialog = pane.createDialog("Change Name to what?"); // title of dialogue box + public void DialogueBox(String JRtext, JRadioButton JR){ + + + JTextField JT = new JTextField(JRtext); + JLabel JT1 = new JLabel("Enter new text:"); + + JPanel panel = new JPanel(); + panel.setLayout(new GridLayout(0,1)); + + panel.add(JT1); + panel.add(JT); + + + JOptionPane pane = new JOptionPane(panel, 3, 2); // content of dialogue box + 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. + + + + + } + + public void TabMaker(String Pname, JTabbedPane JT) { @@ -76,10 +96,6 @@ public class MainViewer { { CreateRow(i, page); } - - - - } public MainViewer() // main viewer window