File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
sources/net.sf.j2s.java.core/src/javax/swing Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -1019,10 +1019,18 @@ private static String layoutCompoundLabelImpl(
10191019 if (ui .textNode == null ) {
10201020 textR .width = fm .stringWidth (text );
10211021 textR .height = fm .getHeight ();
1022+ } else if (text .length () == 0 ) {
1023+ textR .width = 1 ;
1024+ textR .height = fm .getHeight ();
10221025 } else {
1026+ String t = text .replace (' ' , '\u00A0' ); // no-break space
1027+ if (t != text )
1028+ DOMNode .setAttr (ui .textNode , "innerHTML" , t );
10231029 Dimension d = ui .getHTMLSize (ui .textNode );
1024- textR .width = d .width ;
1025- textR .height = d .height ;
1030+ if (t != text )
1031+ DOMNode .setAttr (ui .textNode , "innerHTML" , text );
1032+ textR .width = (d .width == 0 ? 1 : d .width );
1033+ textR .height = (d .height == 0 ? fm .getHeight () : d .height );
10261034 }
10271035 // Take into account the left and right side bearings.
10281036 // This gives more space than it is actually needed,
You can’t perform that action at this time.
0 commit comments