javax.swing.JDialog.dispose()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(195)

本文整理了Java中javax.swing.JDialog.dispose()方法的一些代码示例,展示了JDialog.dispose()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JDialog.dispose()方法的具体详情如下:
包路径:javax.swing.JDialog
类名称:JDialog
方法名:dispose

JDialog.dispose介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-util

@Override public void actionPerformed(java.awt.event.ActionEvent ev) {
    if (javax.swing.JFileChooser.APPROVE_SELECTION.equals(ev.getActionCommand())) {
      retValue[0] = javax.swing.JFileChooser.APPROVE_OPTION;
    }
    dialog.setVisible(false);
    dialog.dispose();
  }
};

代码示例来源:origin: stackoverflow.com

final JOptionPane optionPane = new JOptionPane("Hello world", JOptionPane.INFORMATION_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[]{}, null);

final JDialog dialog = new JDialog();
dialog.setTitle("Message");
dialog.setModal(true);

dialog.setContentPane(optionPane);

dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
dialog.pack();

//create timer to dispose of dialog after 5 seconds
Timer timer = new Timer(5000, new AbstractAction() {
  @Override
  public void actionPerformed(ActionEvent ae) {
    dialog.dispose();
  }
});
timer.setRepeats(false);//the timer should only go off once

//start timer to close JDialog as dialog modal we must start the timer before its visible
timer.start();

dialog.setVisible(true);

代码示例来源:origin: deathmarine/Luyten

/**
 * Show font selection dialog.
 * 
 * @param parent
 *            Dialog's Parent component.
 * @return OK_OPTION, CANCEL_OPTION or ERROR_OPTION
 *
 * @see #OK_OPTION
 * @see #CANCEL_OPTION
 * @see #ERROR_OPTION
 **/
public int showDialog(Component parent) {
  dialogResultValue = ERROR_OPTION;
  JDialog dialog = createDialog(parent);
  dialog.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
      dialogResultValue = CANCEL_OPTION;
    }
  });
  dialog.setVisible(true);
  dialog.dispose();
  dialog = null;
  return dialogResultValue;
}

代码示例来源:origin: libgdx/libgdx

dialog.setVisible(true);
dialog.dispose();

代码示例来源:origin: libgdx/libgdx

dialog.setVisible(true);
dialog.dispose();

代码示例来源:origin: libgdx/libgdx

dialog.setVisible(true);
dialog.dispose();

代码示例来源:origin: libgdx/libgdx

dialog.setVisible(true);
dialog.dispose();

代码示例来源:origin: org.netbeans.api/org-openide-util-ui

@Override public void actionPerformed(java.awt.event.ActionEvent ev) {
    if (javax.swing.JFileChooser.APPROVE_SELECTION.equals(ev.getActionCommand())) {
      retValue[0] = javax.swing.JFileChooser.APPROVE_OPTION;
    }
    dialog.setVisible(false);
    dialog.dispose();
  }
};

代码示例来源:origin: nodebox/nodebox

public int show(JFrame frame) {
  dialog = new JDialog(frame, "Save Changes", true);
  Container contentPane = dialog.getContentPane();
  contentPane.setLayout(new BorderLayout());
  contentPane.add(this, BorderLayout.CENTER);
  dialog.setResizable(false);
  dialog.pack();
  dialog.setLocationRelativeTo(frame);
  dialog.getRootPane().setDefaultButton(saveButton);
  dialog.setVisible(true);
  dialog.dispose();
  return selectedValue;
}

代码示例来源:origin: stackoverflow.com

final JDialog waitForTrans = new JDialog((JFrame) null, true);

SwingWorker worker = new SwingWorker() {

 public String doInBackground() throws Exception {
  Thread.sleep(5000);
  return null;
 }

 public void done() {
  SwingUtilities.invokeLater(new Runnable() {
   public void run() {
    waitForTrans.setVisible(false);
    waitForTrans.dispose();
   }
  });
 }

};

worker.execute();
SwingUtilities.invokeLater(new Runnable() {
 public void run() {
  waitForTrans.add(new JLabel("Please Wait..."));
  waitForTrans.setMinimumSize(new Dimension(300, 100));
  waitForTrans.setVisible(true);
 }
});

代码示例来源:origin: magefree/mage

colorsChooser.setEnabled(false);
  selectedColors = (String) colorsChooser.getSelectedItem();
  dlg.setVisible(false);
  MageFrame.getPreferences().put("genDeckColor", selectedColors);
});
btnCancel = new JButton("Cancel");
btnCancel.addActionListener(e -> {
  dlg.setVisible(false);
  selectedColors = null;
});
dlg = optionPane.createDialog("Generating Deck");
dlg.setResizable(false);
dlg.setVisible(true);
dlg.dispose();

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd

private void closeAction(JDialog dialog, int ret) {
  if (dialog != null) {
    dialog.setVisible(false);
    dialog.dispose();
    returnValue = ret;
  }
}

代码示例来源:origin: cytoscape.coreplugins/cpath2

public void actionPerformed(ActionEvent actionEvent) {
    dialog.setVisible(false);
    dialog.dispose();
  }
});

代码示例来源:origin: nz.ac.waikato.cms.weka/meka

@Override
 public void actionPerformed(ActionEvent e) {
dialog.setVisible(false);
dialog.dispose();
 }
});

代码示例来源:origin: ontop/ontop

public void run(){
    parent.setVisible(false);
    parent.dispose();
  }
};

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-j2eeserver

public void run() {
    finished = true;
    if (dialog != null) {
      dialog.setVisible(false);
      dialog.dispose();
      dialog = null;
    }
  }
});

代码示例来源:origin: net.sf.squirrel-sql.plugins/mysql

private void buttonCancelActionPerformed(@SuppressWarnings("unused")
java.awt.event.ActionEvent evt)
{
  jd.setVisible(false);
  jd.dispose();
}

代码示例来源:origin: net.sf.squirrel-sql.plugins/mysql

/** Closes the dialog */
private void closeDialog(@SuppressWarnings("unused")
java.awt.event.WindowEvent evt)
{
  jd.setVisible(false);
  jd.dispose();
}

代码示例来源:origin: otros-systems/otroslogviewer

@Override
 public void actionPerformed(ActionEvent e) {
  dialog.setVisible(false);
  dialog.dispose();
 }
}));

代码示例来源:origin: net.sf.meka/meka

@Override
  public void actionPerformed(ActionEvent e) {
    dialog.setVisible(false);
    dialog.dispose();
  }
});

相关文章

JDialog类方法