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

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

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

JDialog.dispatchEvent介绍

暂无

代码示例

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

private static final KeyStroke escapeStroke = 
  KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); 
public static final String dispatchWindowClosingActionMapKey = 
  "com.spodding.tackline.dispatch:WINDOW_CLOSING"; 
public static void installEscapeCloseOperation(final JDialog dialog) { 
  Action dispatchClosing = new AbstractAction() { 
    public void actionPerformed(ActionEvent event) { 
      dialog.dispatchEvent(new WindowEvent( 
        dialog, WindowEvent.WINDOW_CLOSING 
      )); 
    } 
  }; 
  JRootPane root = dialog.getRootPane(); 
  root.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( 
    escapeStroke, dispatchWindowClosingActionMapKey 
  ); 
  root.getActionMap().put( dispatchWindowClosingActionMapKey, dispatchClosing 
  ); 
}

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

JDialog dialog = optionPane.createDialog("New Dialog");
 dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
 dialog.setVisible(true);
 dialog.dispatchEvent(new WindowEvent(dialog, WindowEvent.WINDOW_CLOSING));

代码示例来源:origin: com.dorkbox/SystemTray

void close() {
  hiddenDialog.setVisible(false);
  hiddenDialog.dispatchEvent(new WindowEvent(hiddenDialog, WindowEvent.WINDOW_CLOSING));
}

代码示例来源:origin: LearnLib/automatalib

@Override
  public void keyTyped(KeyEvent e) {
    if (e.getKeyChar() == KeyEvent.VK_ESCAPE) {
      frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING));
    }
  }
});

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

@Override
  public void actionPerformed(ActionEvent event) {
    dialog.dispatchEvent(new WindowEvent(dialog, WindowEvent.WINDOW_CLOSING));
  }
};

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

@Override
  public void actionPerformed(ActionEvent e) {
    dialog.dispatchEvent(
        new WindowEvent(dialog, WindowEvent.WINDOW_CLOSING
        ));
  }
};

代码示例来源:origin: com.tunnelvisionlabs/antlr4

@Override
  public void actionPerformed(ActionEvent e) {
    dialog.dispatchEvent(new WindowEvent(dialog, WindowEvent.WINDOW_CLOSING));
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/skinlf

/**
 * Description of the Method
 * 
 * @param event Description of Parameter
 */
public void dispatchEvent(AWTEvent event) {
 if (frame != null) {
  frame.dispatchEvent(event);
 } else if (dialog != null) {
  dialog.dispatchEvent(event);
 }
}

代码示例来源:origin: uk.co.nichesolutions/antlr4

@Override
  public void actionPerformed(ActionEvent e) {
    dialog.dispatchEvent(new WindowEvent(dialog, WindowEvent.WINDOW_CLOSING));
  }
}

代码示例来源:origin: Chatanga/Girinoscope

@Override
  public void actionPerformed(ActionEvent event) {
    dialog.dispatchEvent(new WindowEvent(dialog, WindowEvent.WINDOW_CLOSING));
  }
};

代码示例来源:origin: LearnLib/automatalib

@Override
  public void actionPerformed(ActionEvent e) {
    frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING));
  }
});

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/skinlf

/**
 * Sets the Closed attribute of the SkinWindowWindow object
 * 
 * @param b The new Closed value
 */
public void setClosed(boolean b) {
 if (frame != null)
  frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING));
 else if (dialog != null)
   dialog.dispatchEvent(new WindowEvent(dialog,
     WindowEvent.WINDOW_CLOSING));
}

相关文章

JDialog类方法