【问题标题】:How to open JDialog form in netbeans?如何在netbeans中打开JDialog表单?
【发布时间】:2015-04-17 10:53:59
【问题描述】:

我已经构建了 Swing GUI 类 JDialog form(diglog_promotion) 和一个按钮。我希望在单击按钮时显示JDialog 表单,所以我已经编码了

dialog_promotion f = new dialog_promotion();                  
f.setVisible(true);

点击按钮后,报错:

还不支持

我尝试将它与 eclip 一起使用它可以工作
我做错了什么?

【问题讨论】:

    标签: java netbeans jdialog


    【解决方案1】:
     Inside of your method Actionperformed for any particular case you want call JoptionPane.showMessageDialog(,); with the message you want. I have tried this in netbeans it works.
    private void btnSaveActionPerformed(java.awt.event.ActionEvent evt)
    {
     ...
     ...
     if(saveisclicked)
    {
      System.out.println("Please Fill user name");
      JOptionPane.showMessageDialog(null, "Please Enter  User Name field");
    
    }
    ...
    ...
    

    【讨论】:

    • 能否请您edit 解释一下为什么这段代码回答了这个问题?纯代码答案是 discouraged,因为它们不教授解决方案。
    • 我不是说 JOptionPane 我是说 JDialog 表单类
    猜你喜欢
    • 2015-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多