/[classpath]/classpath/javax/swing/border/TitledBorder.java
ViewVC logotype

Diff of /classpath/javax/swing/border/TitledBorder.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by trebligd, Thu Jul 21 16:11:10 2005 UTC revision 1.10 by rabbit78, Mon Sep 19 09:59:59 2005 UTC
# Line 46  import java.awt.FontMetrics; Line 46  import java.awt.FontMetrics;
46  import java.awt.Graphics;  import java.awt.Graphics;
47  import java.awt.Insets;  import java.awt.Insets;
48  import java.awt.Shape;  import java.awt.Shape;
49    import java.awt.font.FontRenderContext;
50    import java.awt.font.LineMetrics;
51    import java.awt.geom.AffineTransform;
52    
53  import javax.swing.UIManager;  import javax.swing.UIManager;
54    
# Line 607  public class TitledBorder Line 610  public class TitledBorder
610      case TOP:      case TOP:
611      case DEFAULT_POSITION:      case DEFAULT_POSITION:
612      default:      default:
613        textY = y + mes.borderSpacing.top + mes.borderInsets.top - mes.textAscent;        textY = y + mes.borderSpacing.top + mes.borderInsets.top - mes.textAscent
614                  + mes.lineHeight;
615        break;        break;
616    
617      case BELOW_TOP:      case BELOW_TOP:
# Line 1000  public class TitledBorder Line 1004  public class TitledBorder
1004            
1005      m.textAscent = fmet.getAscent();      m.textAscent = fmet.getAscent();
1006      m.textDescent = fmet.getDescent();      m.textDescent = fmet.getDescent();
1007    
1008        FontRenderContext frc = new FontRenderContext(new AffineTransform(), false,
1009                                                      false);
1010        LineMetrics lmet = m.font.getLineMetrics(m.trimmedText, 0,
1011                                                 m.trimmedText.length(), frc);
1012        m.lineHeight = (int) lmet.getStrikethroughOffset();
1013        // Fallback in case that LineMetrics is not available/working.
1014        if (m.lineHeight == 0)
1015          m.lineHeight = (int) (0.3333 * (double) m.textAscent);
1016    
1017      if (m.trimmedText != null)      if (m.trimmedText != null)
1018        m.textWidth = fmet.stringWidth(m.trimmedText) + 3;        m.textWidth = fmet.stringWidth(m.trimmedText) + 3;
1019    
# Line 1072  public class TitledBorder Line 1086  public class TitledBorder
1086       */       */
1087      int textDescent;      int textDescent;
1088    
1089        /**
1090         * The number of pixels between the base line and the height where
1091         * a strike-through would be drawn.
1092         */
1093        int lineHeight;
1094    
1095      /**      /**
1096       * The title text after removing leading and trailing white space       * The title text after removing leading and trailing white space

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26