Skip to content

Commit 8b8f0aa

Browse files
hansonrhansonr
authored andcommitted
fix for popup menu not updating if it is changed while already open
Q: What happens in Java when you do this?
1 parent 8718d7f commit 8b8f0aa

File tree

7 files changed

+10
-5
lines changed

7 files changed

+10
-5
lines changed
26.9 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20191008173421
1+
20191014053250
26.9 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20191008173421
1+
20191014053250
26.9 KB
Binary file not shown.

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,9 +688,14 @@ public void pack() {
688688
*/
689689
@Override
690690
public void setVisible(boolean b) {
691-
if (b == isVisible())
691+
if (b == isVisible()) {
692+
if (b) {
693+
// need this for SwingJS to ensure a changed visible menu is updated
694+
getUI().setVisible(true);
695+
}
692696
return;
693-
this.getUI().setVisible(true);
697+
}
698+
getUI().setVisible(b);
694699
if (!b)
695700
popup = null;
696701
// /**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public class JSPopupMenuUI extends JSPanelUI implements ContainerListener {
6767
@Override
6868
public void propertyChange(PropertyChangeEvent e) {
6969
String prop = e.getPropertyName();
70-
//System.out.println("jspopiupmenuui prop " + prop);
70+
// System.out.println("jspopiupmenuui prop " + prop);
7171
super.propertyChange(e);
7272
}
7373

0 commit comments

Comments
 (0)