List of utility methods to do Swing Font Metrics
String | getClippedText(String text, FontMetrics fm, int maxWidth) get Clipped Text if ((text == null) || (text.length() == 0)) { return ""; int width = SwingUtilities.computeStringWidth(fm, text); if (width > maxWidth) { int totalWidth = SwingUtilities.computeStringWidth(fm, ELLIPSIS); for (int i = 0; i < text.length(); i++) { totalWidth += fm.charWidth(text.charAt(i)); ... |
FontMetrics | getDefaultLabelFontMetrics() Returns default label font metrics. if (label == null) { label = new JLabel(); return label.getFontMetrics(label.getFont()); |
FontMetrics | getFontMetrics(final JComponent c, final Graphics g) Returns the FontMetrics for the current Font of the passed in Graphics. return getFontMetrics(c, g, g.getFont());
|
FontMetrics | getFontMetrics(Font font) Gets the font metrics for the specified font. return DUMMY_PANEL.getFontMetrics(font);
|
FontMetrics | getFontMetrics(Font font) Returns a suitabel screen font metrics for the font. return new JLabel().getFontMetrics(font); |
FontMetrics | getFontMetrics(Font font) Returns the font metrics object for a given font. return Toolkit.getDefaultToolkit().getFontMetrics(font);
|
FontMetrics | getFontMetrics(JComponent c, Graphics g) Returns the FontMetrics for the current Font of the passed in Graphics. return getFontMetrics(c, g, g.getFont());
|
FontMetrics | getFontMetrics(JComponent c, Graphics g) Returns the FontMetrics for the current Font of the passed in Graphics. return getFontMetrics(c, g, g.getFont());
|
FontMetrics | getFontMetrics(JComponent c, Graphics g) Copied from JDK's SwingUtilities2.java Returns the FontMetrics for the current Font of the passed in Graphics. return getFontMetrics(c, g, g.getFont());
|
FontMetrics | getFontMetrics(JComponent c, Graphics g) Returns the FontMetrics for the current Font of the passed in Graphics. return getFontMetrics(c, g, g.getFont());
|