如何设置“ JOptionPane.showMessageDialog”的位置

如何设置“ JOptionPane.showMessageDialog”的位置,第1张

如何设置“ JOptionPane.showMessageDialog”的位置
import javax.swing.JDialog;import javax.swing.JPanel;import javax.swing.Jframe;import javax.swing.JLabel;import javax.swing.JButton;public class CustomDialog extends JDialog {    private JPanel myPanel = null;    private JButton yesButton = null;    private JButton noButton = null;    public CustomDialog(Jframe frame, boolean modal, String myMessage) {    super(frame, modal);    myPanel = new JPanel();    getContentPane().add(myPanel);    myPanel.add(new JLabel(myMessage));    yesButton = new JButton("Yes");    myPanel.add(yesButton);    noButton = new JButton("No");    myPanel.add(noButton);    pack();    //setLocationRelativeTo(frame);    setLocation(200, 200); // <--    setVisible(true);    }}


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5428581.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-11
下一篇2022-12-11

发表评论

登录后才能评论

评论列表(0条)

    保存