protected void processWindowEvent(WindowEvent e) {
   if (e.getID() == WindowEvent.WINDOW_CLOSING) {
     try {
       FocusManager fm = FocusManager.getCurrentManager();
       if (fm != null) {
         Component cmp = fm.getFocusOwner();
         if (cmp != null) {
           // フォーカスロスト前に×ボタンで閉じる場合を想定し、擬似的にFocusLostを発行する
           cmp.dispatchEvent(new FocusEvent(cmp, FocusEvent.FOCUS_LOST));
         }
       }
       if (canClose()) {
         // パラメータを渡し用HashMapに格納する
         paramas.put("ACT", "close");
         paramas.put("INSURER_NM", "");
         paramas.put("INSURER_NO", "");
         paramas.put("JIGYOUSHA_NO", "");
         closeWindow();
       } else {
         return;
       }
     } catch (Exception ex) {
       ex.printStackTrace();
     }
     super.processWindowEvent(e);
     closeWindow();
   }
   super.processWindowEvent(e);
 }
Esempio n. 2
0
 public void updateDispay() {
   categoryMenu.addItemListener(this);
   delKeyButton.addActionListener(this);
   addKeyButton.addActionListener(this);
   keyList.addListSelectionListener(this);
   defaultsButton.addActionListener(this);
   focusMgr = FocusManager.getCurrentManager();
   openHelpFile();
   for (int i = 0; i < categories.length; i++) categoryMenu.addItem(categories[i]);
 }
Esempio n. 3
0
  @Override
  public boolean dispatchKeyEvent(KeyEvent e) {

    if (!FocusManager.getCurrentManager()
        .getActiveWindow()
        .equals(model.getGUIManager().getParent())) return false;
    if (e.getID() == KeyEvent.KEY_PRESSED) {
      switch (e.getKeyCode()) {
        case KeyEvent.VK_HOME:
          start.actionPerformed(null);
          return true;
        case KeyEvent.VK_END:
          end.actionPerformed(null);
          return true;
        case KeyEvent.VK_LEFT:
        case KeyEvent.VK_NUMPAD4:
          left.actionPerformed(null);
          return true;
        case KeyEvent.VK_RIGHT:
        case KeyEvent.VK_NUMPAD6:
          right.actionPerformed(null);
          return true;
        case KeyEvent.VK_ADD:
        case KeyEvent.VK_UP:
        case KeyEvent.VK_PLUS:
        case KeyEvent.VK_EQUALS:
          zoomin.actionPerformed(null);
          return true;
        case KeyEvent.VK_SUBTRACT:
        case KeyEvent.VK_DOWN:
        case KeyEvent.VK_MINUS:
          zoomout.actionPerformed(null);
          return true;
        case KeyEvent.VK_DELETE:
        case KeyEvent.VK_BACK_SPACE:
          remove.actionPerformed(null);
          return true;
        default:
          return false;
          // do nothing
      }
    }
    return false;

    // /* zoom in */
    // inputs.put(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, 0),
    // "customZoomIn");
    // actions.put("customZoomIn", new AnnotationZoomInAction(model));
    // inputs.put(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, 0),
    // "customZoomOut");
    // actions.put("customZoomOut", new AnnotationZoomOutAction(model));
    //
    // /* select first from selection */
    // inputs.put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD7, 0),
    // "customSelectFirst");
    // inputs.put(KeyStroke.getKeyStroke(KeyEvent.VK_HOME, 0),
    // "customSelectFirst");
    // actions.put("customSelectFirst", new SelectFromSelectedFirst(model));
    //
    // /* select last from selection */
    // inputs.put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD1, 0),
    // "customSelectLast");
    // inputs.put(KeyStroke.getKeyStroke(KeyEvent.VK_END, 0),
    // "customSelectLast");
    // actions.put("customSelectLast", new SelectFromSelectedLast(model));
    //
    // /* move selection one location forward */
    // inputs.put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD9, 0),
    // "customSelectForward");
    // inputs.put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0),
    // "customSelectForward");
    // actions
    // .put("customSelectForward",
    // new SelectFromSelectedForward(model));
    //
    // /* move selection one location back */
    // inputs.put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD3, 0),
    // "customSelectBack");
    // inputs.put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0),
    // "customSelectBack");
    // actions.put("customSelectBack", new SelectFromSelectedBack(model));

  }