JDialog框中的GUI错误?

时间:2018-04-30 13:26:34

标签: java swing drag-and-drop joptionpane jdialog

目前正在制作一个DnD实用程序,它调用一个窗口来掷骰子。当你关闭窗口并重新打开它时,很多用户界面被移动并且不起作用。我哪里出错了?

correct box

correct box

bugged box

bugged box ////////////////////////////////////////////////// ////////

mntmDiceRoller.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            DisplayRollPanel();
        }

        private void DisplayRollPanel() {
            Delta.rollPane.main(null);

        }
    });

/////////////////////////////////////////////// ///////////

/**
 * Launch the application.
 */
public static void main(String[] args) {
    try {
        rollPane dialog = new rollPane();
        dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
        dialog.setVisible(true);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

/**
 * Create the dialog.
 */
public rollPane() {
    setResizable(false);
    setName("DiceRollerDialog");
    setType(Type.POPUP);
    setTitle("Dice Roller");
    setBounds(100, 100, 450, 350);
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new MigLayout("", "[][grow][][grow][][19.00,grow][][grow][][][][grow][][]", "[][][][][][][][][][][]"));

/////////////其余代码省略///////////////////////////// ////

0 个答案:

没有答案