Skip to content

Commit 5b36511

Browse files
hansonrhansonr
authored andcommitted
fix for jquery object could be null in JSPopupMenu
1 parent 3cef167 commit 5b36511

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

sources/net.sf.j2s.java.core/src/swingjs/plaf/JSPopupMenuUI.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ public class JSPopupMenuUI extends JSPanelUI implements ContainerListener {
6666

6767
@Override
6868
public void propertyChange(PropertyChangeEvent e) {
69-
// String prop = e.getPropertyName();
70-
// System.out.println("jspopiupmenuui prop " + prop);
69+
String prop = e.getPropertyName();
70+
System.out.println("jspopiupmenuui prop " + prop);
7171
super.propertyChange(e);
7272
}
7373

@@ -124,6 +124,7 @@ public DOMNode updateDOMNode() {
124124
public void componentAdded(ContainerEvent e) {
125125
// OK, the idea here is that we detach all child nodes
126126
// and then reattach them.
127+
System.out.println("jspopupmenu componentadded " + e);
127128
DOMNode.detachAll(outerNode);
128129
setTainted();
129130
setHTMLElement();
@@ -134,6 +135,7 @@ public void componentAdded(ContainerEvent e) {
134135

135136
@Override
136137
public void componentRemoved(ContainerEvent e) {
138+
System.out.println("jspopupmenu componentremoved " + e);
137139
DOMNode.detachAll(outerNode);
138140
setTainted();
139141
setHTMLElement();
@@ -145,6 +147,7 @@ public void componentRemoved(ContainerEvent e) {
145147
@Override
146148
public boolean handleJSEvent(Object target, int eventType, Object jQueryEvent) {
147149
// we use == here because this will be JavaScript
150+
System.out.println("jspopupmenu JSEVent " + eventType);
148151
checkStopPopupMenuTimer(target, eventType, jQueryEvent);
149152
return super.handleJSEvent(target, eventType, jQueryEvent);
150153
}
@@ -181,6 +184,7 @@ protected void uninstallListeners() {
181184

182185
@Override
183186
public void setVisible(boolean b) {
187+
System.out.println("jspopupmenu setvis " + b);
184188
// TODO: We are not setting vis false when closing
185189
//if (b && menu != null && menu.isVisible())
186190
//b = false;
@@ -229,6 +233,7 @@ public Dimension getPreferredSize(JComponent jc) {
229233
}
230234

231235
public void updateMenu(boolean andShow) {
236+
System.out.println("jspopupmenu updateMenu andshow=" + andShow);
232237
setTainted();
233238
setHTMLElement();
234239
JSPopupMenuUI.j2sSwingMenu.updateMenu(menu, andShow);
@@ -1217,7 +1222,7 @@ public static void processJ2SMenuCmd(Object[] data) {
12171222
System.err.println("JSPopupMenu not processing " + trigger);
12181223
break;
12191224
}
1220-
if (eventID != 0 && c != null) {
1225+
if (e != null && eventID != 0 && c != null) {
12211226
JSMouse.retargetMouseEvent(e, base, c, c, eventID);
12221227
}
12231228
}

0 commit comments

Comments
 (0)