How to set the location of “JOptionPane.showMessageDialog”

前端 未结 3 1534
闹比i
闹比i 2020-12-06 18:41

I want to make JOptionPane.showMessageDialog message appear

  • Any place in the screen.
  • Relative to JFrame. (not at the centre of the JFram
3条回答
  •  旧时难觅i
    2020-12-06 19:01

    What you need is

        final JOptionPane pane = new JOptionPane("Hello");
        final JDialog d = pane.createDialog((JFrame)null, "Title");
        d.setLocation(10,10);
        d.setVisible(true);
    

提交回复
热议问题