How to use JDialog inside a JFrame from another Package?
<p>I'm trying to get a Message Box that explains the rules of my game to populate from a menu bar. I can get it to populate correctly when I use a JFrame, however, when I click Ok or the X, it still stays open outside of my game. And I have to close it again in order to use the game again. I read that I don't want to use JFrame that I would need to use JDialog but I am having trouble with it. </p>

<p>I'm trying to figure out how to use a JDialog and get it centered inside a JFrame from another package. I don't think I'm using JDialog correctly as I cannot get it to populate in the first place. My main game runs from a different package called simonish, and has it's own class called MainGame. And in MainGame there is a private variable JFrame frame.</p>

<pre><code>public class MainGame implements MouseListener, ActionListener{
    private JFrame frame = new JFrame("Simonish");
    private MenuBar menuBar = new MenuBar();
}
</code></pre>

<p>Of course, this isn't all the code but this is inside the package Simonish.</p>

<p>Now I have another package called Component, and inside I have a class called MenuBar:
    public class MenuBar extends JMenuBar implements MenuListener,     ActionListener{</p>

<pre><code>JMenuBar menuBar;
JMenu settings, stats, help;
JMenuItem chooseColor, chooseMode, highScoreList, history, about, rules;

public MenuBar() {

    //adding help to the menu bar
    help = new JMenu("Help");
    help.addMenuListener(this);
    this.add(help);

    //sub categories for help
    about = new JMenuItem("About");
    about.addActionListener(this);
    help.add(about);

    rules = new JMenuItem("Rules");
    rules.addActionListener(this);
    help.add(rules);


    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if(e.getSource().equals(about)){
            new PopupMenu();
        }
        if(e.getSource().equals(rules)){
            new RulesPopup();
        }
    }
}
</code></pre>

<p>I know, a lot of missing stuff, but trying to keep it short.</p>

<p>And in the same Component folder, I have a class called PopUpMenu, it's a terrible name that I will call PopUpAbout, but here is the code.</p>

<pre><code>public class PopupMenu {

    JFrame Popup;

    public PopupMenu(){
        Popup = new JFrame();
        Popup.pack();
        Popup.setVisible(true);


        JOptionPane.showMessageDialog(Popup, "Version 2\n\n" + "Added new features: \n\n" + "Color Customization\n" + "Different Game Modes\n" +
            "Menu Bar\n" + "Images\n" + "Sound Effects\n" + "History of Score", "About", JOptionPane.PLAIN_MESSAGE);
    }
}
</code></pre>

<p>So there lies my problem, I was trying to mess around in the class PopUpMenu, but I can't seem to get a JDialog to work at all. I have tried changing those to JDialog, and changing the arguments inside, but I can't get it to populate, or get it to populate inside the main game. </p>

<p>Does it need to be called inside the MainGame? Or does it need to be called in PopUpMenu?</p>