Skip to content

Commit 4126f6a

Browse files
hansonrhansonr
authored andcommitted
reverting to give buttons same offset as labels. It's a no-win game
1 parent 8471fa1 commit 4126f6a

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,7 @@ protected void revalidate() {
11161116
*
11171117
*/
11181118
public void setTainted() {
1119-
isTainted = true;
1119+
setTainted(true);
11201120
}
11211121

11221122
/**
@@ -1775,7 +1775,8 @@ public void update(Graphics g, JComponent c) {
17751775
System.out.println("drawing " + c.getWidth() + " " + c.getHeight());
17761776
}
17771777
setHTMLElement();
1778-
setAlignment();
1778+
if (allowTextAlignment && centeringNode != null)
1779+
setAlignments((AbstractButton)jc, false);
17791780
paint(g, c);
17801781
}
17811782

@@ -2342,11 +2343,6 @@ public void setButtonRectangles(boolean isPreferred) {
23422343
iconR.x = iconR.y = textR.x = textR.y = 0;
23432344
}
23442345

2345-
protected void setAlignment() {
2346-
if (allowTextAlignment && centeringNode != null)
2347-
setAlignments((AbstractButton)jc, false);
2348-
}
2349-
23502346
protected void addCentering(DOMNode node) {
23512347
if (iconNode == null)
23522348
iconNode = newDOMObject("span", id + "_icon");
@@ -2634,11 +2630,11 @@ protected void setAlignments(AbstractButton b, boolean justGetPreferred) {
26342630
}
26352631

26362632
protected void fullyCenter(DOMNode node, boolean isCtr) {
2637-
if (isLabel)
2633+
// if (isLabel)
26382634
DOMNode.setStyles(node, "width", null, "top", "50%", "left", "50%", "transform",
26392635
"translateX(-50%)translateY(-50%)translateY(0.5px)translateX(0.5px)", "position", "absolute");
2640-
else
2641-
DOMNode.setStyles(node, "width", null, "top", null, "left", null, "transform", null, "position", null, "height", null);
2636+
// no, this causes the label to be offset too much
2637+
// DOMNode.setStyles(node, "width", null, "top", null, "left", null, "transform", null, "position", null, "height", null);
26422638
}
26432639

26442640

0 commit comments

Comments
 (0)