Skip to content

Commit e698479

Browse files
hansonrhansonr
authored andcommitted
JSMenuUI fix for position:absolute lost
1 parent a66666c commit e698479

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,6 +1719,7 @@ private Dimension getTextSize(AbstractButton b) {
17191719
if (isAWT && t == "")
17201720
t = "\u00A0"; // AWT labels do not hide if ""
17211721
return (t == null || t == "" ? null : getHTMLSize(textNode));
1722+
17221723
}
17231724

17241725
/**
@@ -1796,8 +1797,8 @@ protected Dimension setHTMLSize1(DOMNode node, boolean addCSS, boolean usePrefer
17961797

17971798
// can't have these for getBoundingClientRect to work
17981799
DOMNode.setStyles(node, "position", null);
1799-
DOMNode.setStyles(this.textNode, "position", null);
1800-
DOMNode.setStyles(this.iconNode, "position", null);
1800+
DOMNode.setStyles(textNode, "position", null);
1801+
DOMNode.setStyles(iconNode, "position", null);
18011802
}
18021803
}
18031804

@@ -2748,7 +2749,10 @@ protected void setAlignments(AbstractButton b, boolean justGetPreferred) {
27482749
alignRight = !ltr;
27492750
alignHCenter = false;
27502751
textRight = ltr;
2751-
if (!isMenu) {
2752+
if (isMenu) {
2753+
// Correct for dimText calc losing position:absolute
2754+
DOMNode.setPositionAbsolute(textNode);
2755+
} else {
27522756
String accel = getAccelStr((JMenuItem) b);
27532757
DOMNode accelNode = menuAnchorNode;
27542758
accelNode = /** @j2sNative accelNode.children[1] || */null;

0 commit comments

Comments
 (0)