3.3で各コンポーネントのイベントクラスの整理を行った際、getInputMapの処理が2種類あったのをまとめてしまった。
子コンポーネントがフォーカスされた場合も対象にするには、"WHEN_ANCESTOR_OF_FOCUSED_COMPONENT"を指定する(デフォルトはWHEN_FOCUSED)。本件の2つのダイアログは、これを指定する必要があった。
JComponent c = ...; c.getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(keyStroke, actionMapKey);
3.3で追加したメソッドを使う場合に、オプション指定できるようにすれば良いが、APIの修正は見送りとする。
パッチ
Index: src/net/argius/stew/ui/window/ConnectorMapEditDialog.java =================================================================== --- src/net/argius/stew/ui/window/ConnectorMapEditDialog.java (revision 283) +++ src/net/argius/stew/ui/window/ConnectorMapEditDialog.java (working copy) @@ -110,7 +110,9 @@ p.c.fill = GridBagConstraints.NONE; p.addComponent(p2, false); // [イベントの設定] - ActionUtility.bindAction(rootPane, this, cmdCancel, getKeyStroke(VK_ESCAPE, 0)); + final KeyStroke ksESC = getKeyStroke(VK_ESCAPE, 0); + ActionUtility.bindAction(rootPane, this, cmdCancel, ksESC); + rootPane.getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ksESC, cmdCancel); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { Index: src/net/argius/stew/ui/window/ConnectorEditDialog.java =================================================================== --- src/net/argius/stew/ui/window/ConnectorEditDialog.java (revision 269) +++ src/net/argius/stew/ui/window/ConnectorEditDialog.java (working copy) @@ -149,7 +149,9 @@ p.c.anchor = GridBagConstraints.CENTER; p.addComponent(p2, false); pack(); - ActionUtility.bindAction(rootPane, this, cmdCancel, KeyStroke.getKeyStroke(VK_ESCAPE, 0)); + final KeyStroke ksESC = KeyStroke.getKeyStroke(VK_ESCAPE, 0); + ActionUtility.bindAction(rootPane, this, cmdCancel, ksESC); + rootPane.getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ksESC, cmdCancel); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) {
バージョン4では修正されているので、クローズとする。
どうしてもバージョン3.3.0を使いたい場合は、パッチを充てて使ってください。ごめんなさい。
接続設定一覧ダイアログと接続設定編集ダイアログにおいて、ボタンやテキストボックスがフォーカス状態の場合はESCキーが利かなくなる。
3.2までは利いていた。