Skip to content

Commit 7945ad4

Browse files
hansonrhansonr
authored andcommitted
focus and key events, menu accelerators and mnemonics, j2smenu work
1 parent 5afffbd commit 7945ad4

25 files changed

+750
-232
lines changed
-2.79 KB
Binary file not shown.
0 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20190116234645
1+
20190118024414
-2.79 KB
Binary file not shown.
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20190116234645
1+
20190118024414
-2.79 KB
Binary file not shown.

sources/net.sf.j2s.java.core/src/javax/swing/JComponent.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,8 +1932,6 @@ private void registerWithKeyboardManager(boolean onlyIfNew) {
19321932
KeyStroke[] strokes;
19331933
Hashtable registered = (Hashtable) getClientProperty(WHEN_IN_FOCUSED_WINDOW_BINDINGS);
19341934

1935-
System.out.println(">>>>JComponent registering " + this + " " + inputMap);
1936-
19371935
if (inputMap != null) {
19381936
// Push any new KeyStrokes to the KeyboardManager.
19391937
strokes = inputMap.allKeys();

sources/net.sf.j2s.java.core/src/javax/swing/JMenu.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,17 @@ public void updateUI() {
223223

224224
}
225225

226+
/**
227+
* SwingJS added
228+
*/
229+
@Override
230+
public void addNotify() {
231+
super.addNotify();
232+
if (popupMenu != null)
233+
popupMenu.addNotify();
234+
}
235+
236+
226237

227238
// public void repaint(long tm, int x, int y, int width, int height) {
228239
// Thread.currentThread().dumpStack();
@@ -531,6 +542,7 @@ private void ensurePopupMenuCreated() {
531542
this.popupMenu = new JPopupMenu();
532543
popupMenu.setInvoker(this);
533544
popupListener = createWinListener(popupMenu);
545+
popupMenu.addNotify();// BH SwingJS
534546
}
535547
}
536548

@@ -596,6 +608,7 @@ public Component add(Component c) {
596608
public Component add(Component c, int index) {
597609
ensurePopupMenuCreated();
598610
popupMenu.add(c, index);
611+
599612
firePropertyChange("JSitem", null, c);
600613
return c;
601614
}

sources/net.sf.j2s.java.core/src/javax/swing/KeyboardManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ public static void setCurrentManager(KeyboardManager km) {
9999
public void registerKeyStroke(KeyStroke k, JComponent c) {
100100

101101

102-
//System.out.println(">>>>>>>KM>>>>>reg " + k + " " + c);
103102

104103

105104
Hashtable keyMap = getKeyMap(c, k);
106105
if (keyMap == null)
107106
return;
108107
Object tmp = keyMap.get(k);
109108
if (tmp == null) {
109+
System.out.println(">>>>>>>KM>>>>>reg " + k + " " + c);
110110
keyMap.put(k,c);
111111
} else if (tmp instanceof Vector) { // if there's a Vector there then add to it.
112112
Vector v = (Vector)tmp;

0 commit comments

Comments
 (0)