本文整理了Java中javax.swing.JDialog.addWindowListener()
方法的一些代码示例,展示了JDialog.addWindowListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JDialog.addWindowListener()
方法的具体详情如下:
包路径:javax.swing.JDialog
类名称:JDialog
方法名:addWindowListener
暂无
代码示例来源: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: kiegroup/optaplanner
public ConferenceCFPImportWorker(SolutionBusiness<ConferenceSolution> solutionBusiness,
SolutionPanel<ConferenceSolution> solutionPanel, String conferenceBaseUrl) {
this.solutionBusiness = solutionBusiness;
this.solutionPanel = solutionPanel;
this.conferenceBaseUrl = conferenceBaseUrl;
dialog = new JDialog(solutionPanel.getSolverAndPersistenceFrame(), true);
JPanel contentPane = new JPanel(new BorderLayout(10, 10));
contentPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
contentPane.add(new JLabel("Importing CFP data in progress..."), BorderLayout.NORTH);
JProgressBar progressBar = new JProgressBar(SwingConstants.HORIZONTAL);
progressBar.setIndeterminate(true);
contentPane.add(progressBar, BorderLayout.CENTER);
JButton button = new JButton("Cancel");
button.addActionListener(e -> cancel(false));
contentPane.add(button, BorderLayout.SOUTH);
dialog.setContentPane(contentPane);
dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
cancel(false);
}
});
dialog.pack();
dialog.setLocationRelativeTo(solutionPanel.getSolverAndPersistenceFrame());
}
代码示例来源:origin: geotools/geotools
final JDialog dialog = new JDialog((Frame) owner, title);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.addWindowListener(listener);
dialog.getContentPane().add(panel);
dialog.pack();
final JDialog dialog = new JDialog((Dialog) owner, title);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.addWindowListener(listener);
dialog.getContentPane().add(panel);
dialog.pack();
代码示例来源:origin: magefree/mage
d.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
代码示例来源:origin: stackoverflow.com
JDialog dialog = ...;
dialog.addWindowListener(new WindowAdapter() {
@Override public void windowClosed(WindowEvent e) {
System.exit(0);
}
});
代码示例来源:origin: info.aduna.commons/aduna-commons-swing
public void addWindowListener(WindowListener listener) {
if (listener != null) {
synchronized (windowListeners) {
windowListeners.add(listener);
}
if (dialog != null) {
dialog.addWindowListener(listener);
}
}
}
代码示例来源:origin: stackoverflow.com
JDialog dialog = new JDialog(...);
dialog.addWindowListener(new WindowAdaper() {
@Override
public void windowOpened(WindowEvent e) {
super.windowOpened(e);
// do something
}
});
代码示例来源:origin: lbalazscs/Pixelitor
public static void setupCancelWhenTheDialogIsClosed(JDialog d, Runnable cancelAction) {
d.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
d.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
// the user pressed the X button...
cancelAction.run();
}
});
}
代码示例来源:origin: stackoverflow.com
private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {
JDialog paymentDialog = new JDialog();
MyFirstFrame.this.setEnabled(false);
paymentDialog.setVisible(true);
paymentDialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
MyFirstFrame.this.setEnabled(true);
}
});
}
代码示例来源:origin: com.github.haifengl/smile-plot
@Override
public void actionPerformed(ActionEvent e) {
JDialog dialog = createPropertyDialog();
dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
}
});
dialog.setVisible(true);
dialog.dispose();
dialog = null;
}
}
代码示例来源:origin: stackoverflow.com
JDialog dialog = pane.createDialog("Error");
dialog.addWindowListener(null);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
Timer timer = new Timer(10000, new ActionListener() { // 10 sec
public void actionPerformed(ActionEvent e) {
dialog.setVisible(false);
dialog.dispose();
}
});
timer.start();
dialog.setVisible(true);
代码示例来源:origin: stackoverflow.com
public class Test {
public static void main(String[] args) {
final JDialog jd1 = new JDialog((JFrame) null, "Dialog 1", false);
jd1.setVisible(true);
JDialog jd2 = new JDialog((JFrame) null, "Dialog 2", false);
jd2.setVisible(true);
jd2.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent we) {
jd1.dispose();
}
});
}
}
代码示例来源:origin: freeplane/freeplane
protected EditDialog(final EditNodeBase base, final String title, final RootPaneContainer frame) {
dialog = frame instanceof Frame ? new JDialog((Frame)frame, title, /*modal=*/true) : new JDialog((JDialog)frame, title, /*modal=*/true);
dialog.getContentPane().setLayout(new BorderLayout());
dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
final DialogWindowListener dfl = new DialogWindowListener();
dialog.addWindowListener(dfl);
this.base = base;
}
代码示例来源:origin: org.opentcs.thirdparty.dockingframes/docking-frames-common
/**
* Creates a new window.
* @param owner the parent of the dialog
* @param panel the owner of the dialog
*/
public DialogWindow( Component owner, CPanelPopup panel ){
this.panel = panel;
dialog = createDialog( owner );
dialog.setDefaultCloseOperation( JDialog.DO_NOTHING_ON_CLOSE );
dialog.addWindowListener( listener );
}
代码示例来源:origin: org.ihtsdo/wb-api
public NewRefsetSpecWizard(Frame owner) {
wizardDialog = new JDialog(owner);
wizardDialog.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
createData = false;
wizardDialog.dispose();
}
});
initComponents();
}
代码示例来源:origin: xyz.cofe/docking-frames-common
/**
* Creates a new window.
* @param owner the parent of the dialog
* @param panel the owner of the dialog
*/
public DialogWindow( Component owner, CPanelPopup panel ){
this.panel = panel;
dialog = createDialog( owner );
dialog.setDefaultCloseOperation( JDialog.DO_NOTHING_ON_CLOSE );
dialog.addWindowListener( listener );
}
代码示例来源:origin: org.nuiton.jaxx/jaxx-swing-action
@Override
public synchronized void addWindowListener(WindowListener l) {
super.addWindowListener(l);
if (log.isDebugEnabled()) {
log.debug("after added (" + getWindowListeners().length + ") : " + l);
}
}
代码示例来源:origin: com.anrisoftware.prefdialog/prefdialog-dialog
private void setupDialog() {
dialog.add(getAWTComponent());
dialog.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
cancelAction.actionPerformed(null);
}
});
}
代码示例来源:origin: org.protege/protege-editor-core-application
private static JDialog createDialog(Component parent, String title, JOptionPane optionPane, final JComponent defaultFocusedComponent) {
JDialog dlg = optionPane.createDialog(parent, title);
dlg.addWindowListener(new WindowAdapter() {
public void windowOpened(WindowEvent e) {
if (defaultFocusedComponent != null) {
defaultFocusedComponent.requestFocusInWindow();
}
}
});
dlg.setLocationRelativeTo(parent);
dlg.setResizable(true);
dlg.pack();
return dlg;
}
代码示例来源:origin: igvteam/igv
@Override
protected JDialog createDialog(Component parent) throws HeadlessException {
JDialog dialog = super.createDialog(parent);
dialog.setLocation(300, 200);
dialog.setResizable(false);
dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
if (!accepted) {
setSelectedFile(null);
}
}
});
return dialog;
}
内容来源于网络,如有侵权,请联系作者删除!