Class TextSize



  • public class TextSize
    extends Object
    • Constructor Detail

      • TextSize

        public TextSize()
    • Method Detail

      • truncate

        public static String truncate(String text,
                                      Font font,
                                      FontRenderContext frc,
                                      int width)
        Truncate a String to fit within the number of pixels provided.
        Parameters:
        text - the text to consider truncating
        font - the font used to render the string
        frc - the FontRenderContext in use
        width - the width (in pixels) the String should fit within.
        Returns:
        the original String, or if necessary a subset of the string with "..." appended.
      • getPreferredSize

        public static Dimension getPreferredSize(JTextArea textArea,
                                                 int preferredWidth)