W2R2 –Bring up a Dialog Box - finished everything for dialogue box. moving onto actions for dialogue box.

This commit is contained in:
bobbert committed 2025-02-04 18:47:20 +00:00
1 parent d13f8db979
commit dffe04254f
1 file changed
+27 -11
@@ -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