@@ -1684,6 +1684,7 @@ protected Dimension setHTMLSize1(DOMNode node, boolean addCSS, boolean usePrefer
16841684 tempDiv .appendChild (node );
16851685 Rectangle r = tempDiv .getBoundingClientRect ();
16861686 tempDiv .removeChild (node );
1687+
16871688
16881689 // From the DOM; Will be Rectangle2D.double, actually.
16891690 // This is preferable to $(text).width() because that is rounded
@@ -2484,7 +2485,6 @@ protected void setAlignments(AbstractButton b, boolean justGetPreferred) {
24842485 int hCtr = Math .max (h , ih );
24852486 int wCtr = wIcon + gap + wText ;
24862487 int wAccel = 0 ;
2487- String accel = null ;
24882488 // But we need to slightly underestimate it so that the
24892489 // width of label + button does not go over the total calculated width
24902490
@@ -2537,27 +2537,28 @@ protected void setAlignments(AbstractButton b, boolean justGetPreferred) {
25372537 alignRight = !ltr ;
25382538 alignHCenter = false ;
25392539 textRight = ltr ;
2540- accel = (b instanceof JMenuItem ? getAccelStr ((JMenuItem ) b ) : null );
2541- DOMNode accelNode = menuAnchorNode ;
2542- accelNode = /** @j2sNative accelNode.children[1] || */
2543- null ;
2544- if ((accelNode == null ) != (accel == null )) {
2545- if (accel == null ) {
2546- DOMNode .remove (accelNode );
2547- } else {
2548- menuAnchorNode .appendChild (accelNode = DOMNode .createElement ("span" , id + "_acc" ));
2549- addClass (accelNode , "ui-j2smenu-accel" );
2550- DOMNode .setAttr (accelNode , "role" , "menuitem" );
2551- DOMNode .setStyles (accelNode , "font-size" , "10px" );
2552- setMenuItem (accelNode );
2540+ if (!isMenu ) {
2541+ String accel = getAccelStr ((JMenuItem ) b );
2542+ DOMNode accelNode = menuAnchorNode ;
2543+ accelNode = /** @j2sNative accelNode.children[1] || */ null ;
2544+ if ((accelNode == null ) != (accel == null )) {
2545+ if (accel == null ) {
2546+ DOMNode .remove (accelNode );
2547+ } else {
2548+ menuAnchorNode .appendChild (accelNode = DOMNode .createElement ("span" , id + "_acc" ));
2549+ addClass (accelNode , "ui-j2smenu-accel" );
2550+ DOMNode .setAttr (accelNode , "role" , "menuitem" );
2551+ DOMNode .setStyles (accelNode , "font-size" , "10px" );
2552+ setMenuItem (accelNode );
2553+ }
2554+ }
2555+ if (accel != null ) {
2556+ DOMNode .setStyles (accelNode , "float" , null );
2557+ DOMNode .setAttr (accelNode , "innerHTML" , accel );// = accel + "\u00A0\u00A0");
2558+ wAccel = getHTMLSize (accelNode ).width ;
2559+ DOMNode .setStyles (accelNode , "float" , ltr ? "right" : "left" , "text-align" , ltr ? "right" : "left" ,
2560+ "margin" , "0px 5px" , "transform" , "translateY(15%)" );
25532561 }
2554- }
2555- if (accel != null ) {
2556- DOMNode .setStyles (accelNode , "float" , null );
2557- DOMNode .setAttr (accelNode , "innerHTML" , accel );// = accel + "\u00A0\u00A0");
2558- wAccel = getHTMLSize (accelNode ).width ;
2559- DOMNode .setStyles (accelNode , "float" , ltr ? "right" : "left" , "text-align" , ltr ? "right" : "left" ,
2560- "margin" , "0px 5px" , "transform" , "translateY(15%)" );
25612562 }
25622563 DOMNode .setStyles (menuAnchorNode , "width" , "90%" , "min-width" ,
25632564 Math .max (75 , (wCtr + wAccel + margins .left + margins .right ) * 1.1 ) + "px" );
@@ -2587,8 +2588,9 @@ protected void setAlignments(AbstractButton b, boolean justGetPreferred) {
25872588 Object cssCtr = getJSObject (); // {...}
25882589 Object cssTxt = getJSObject ();
25892590 Object cssIcon = getJSObject ();
2590-
2591- addJSKeyVal (cssCtr , "position" , "absolute" , "top" , null , "left" , null , "transform" , null , "width" , wCtr + "px" , "height" , hCtr + "px" );
2591+
2592+ addJSKeyVal (cssCtr , "position" , "absolute" , "top" , null , "left" , null , "transform" , null , "width" , wCtr + "px" ,
2593+ "height" , hCtr + "px" );
25922594 addJSKeyVal (cssIcon , "position" , "absolute" , "top" , null , "left" , null , "transform" , null );
25932595 addJSKeyVal (cssTxt , "position" , "absolute" , "top" , null , "left" , null , "transform" , null );
25942596
@@ -2601,9 +2603,9 @@ protected void setAlignments(AbstractButton b, boolean justGetPreferred) {
26012603 fullyCenter (cssIcon );
26022604 fullyCenter (cssTxt );
26032605 } else {
2604-
2606+
26052607 // horizontal
2606-
2608+
26072609 int left = -1 ;
26082610
26092611 if (menuAnchorNode == null ) {
@@ -2663,7 +2665,7 @@ protected void setAlignments(AbstractButton b, boolean justGetPreferred) {
26632665 }
26642666
26652667 // vertical
2666-
2668+
26672669 h = c .getHeight ();
26682670
26692671 if (h == 0 ) {
@@ -2672,7 +2674,7 @@ protected void setAlignments(AbstractButton b, boolean justGetPreferred) {
26722674
26732675 if (menuAnchorNode == null ) {
26742676 int top ;
2675-
2677+
26762678 switch (vAlign ) {
26772679 case SwingConstants .TOP :
26782680 top = margins .top + myInsets .top ;
@@ -2686,7 +2688,9 @@ protected void setAlignments(AbstractButton b, boolean justGetPreferred) {
26862688 break ;
26872689 }
26882690
2689- //System.out.println("jscui.setAlignments " + b.getText() + " " + vAlign + " " + top + " " + h + " " + hCtr + " " + jc.getClass().getName() + " " + b.getFont() + " " + margins + " " + insets + " " + top);
2691+ // System.out.println("jscui.setAlignments " + b.getText() + " " + vAlign + " "
2692+ // + top + " " + h + " " + hCtr + " " + jc.getClass().getName() + " " +
2693+ // b.getFont() + " " + margins + " " + insets + " " + top);
26902694
26912695 addJSKeyVal (cssCtr , "top" , top + "px" );
26922696 int itop ;
@@ -2715,15 +2719,15 @@ protected void setAlignments(AbstractButton b, boolean justGetPreferred) {
27152719 "translateY(-" + itop + "%)" + (iscale == null ? "" : iscale ));
27162720 } else {
27172721 DOMNode .setStyles (menuAnchorNode , "height" , h + "px" );
2718- //addCSS(cssTxt, "top", "50%", "transform", "translateY(-50%)");
2722+ // addCSS(cssTxt, "top", "50%", "transform", "translateY(-50%)");
27192723 addJSKeyVal (cssIcon , "top" , "50%" , "transform" , "translateY(-65%) scale(0.6,0.6)" );
27202724 }
27212725
27222726 }
27232727 setCSS (cssCtr , centeringNode );
27242728 setCSS (cssIcon , iconNode );
2725- setCSS (cssTxt , textNode );
2726-
2729+ setCSS (cssTxt , textNode );
2730+
27272731 if (cellComponent != null )
27282732 updateCellNode ();
27292733 }
0 commit comments