@Override @SuppressWarnings("deprecation") @SuppressForbidden public FontMetrics getFontMetrics(Font f) { return Toolkit.getDefaultToolkit().getFontMetrics(f); }
/** * Gets the font metrics for the specified font. * @return the font metrics for the specified font. * @param f the specified font * @see java.awt.Graphics#getFont * @see java.awt.FontMetrics * @see java.awt.Graphics#getFontMetrics() */ @SuppressWarnings("deprecation") @SuppressForbidden public FontMetrics getFontMetrics(Font f) { return Toolkit.getDefaultToolkit().getFontMetrics(f); }
public Dimension getPreferredSize() { FontMetrics fm = getToolkit().getFontMetrics(font); configureFormatter(); int minWidth = fm.stringWidth(longestString) + 5; Dimension bestSize = null; if (isVertical()) { bestSize = new Dimension(minWidth, getHeight()); } else { bestSize = new Dimension((int) (runningTime * getScaleFactor()), fm.getHeight()); minHalfDistance = minWidth; } return bestSize; }
FontMetrics fontMetrics = Toolkit.getDefaultToolkit().getFontMetrics(font); int fontHeight = fontMetrics.getHeight();
/** * Gets the font metrics for the specified font. * @return the font metrics for the specified font. * @param f the specified font * @see java.awt.Graphics#getFont * @see java.awt.FontMetrics * @see java.awt.Graphics#getFontMetrics() */ @SuppressWarnings("deprecation") public FontMetrics getFontMetrics(Font f) { return Toolkit.getDefaultToolkit().getFontMetrics(f); }
/** * Gets the fontmetrics. * * @deprecated * @param font to be used for retrieving fontmetrics * @return fontmetrics for given font */ public FontMetrics getFontMetrics(Font font) { return Toolkit.getDefaultToolkit().getFontMetrics(font); }
/** * Convenience method to get a legit FontMetrics object. Where possible, * override this any renderer subclass so that you're not using what's * returned by getDefaultToolkit() to get your metrics. */ @SuppressWarnings("deprecation") private FontMetrics getFontMetrics(Font font) { // ignore return Toolkit.getDefaultToolkit().getFontMetrics(font); }
/** XXX To keep the deprecated Toolkit.getFrontMetrics method separated. /* TODO Find out how actually is one suppose replace the Toolkit.getFontMetrics method. */ public static FontMetrics getFontMetrics(Font font) { return Toolkit.getDefaultToolkit().getFontMetrics(font); }
@SuppressWarnings("deprecation") public FontMetrics getFontMetrics(Font f) { return Toolkit.getDefaultToolkit().getFontMetrics(f); }
/** * Gets the fontmetrics. * * @deprecated * @param font to be used for retrieving fontmetrics * @return fontmetrics for given font */ public FontMetrics getFontMetrics(Font font) { return Toolkit.getDefaultToolkit().getFontMetrics(font); }
/** * Get Font metrics * * @param f Font * @return Font metrics. */ @Override @SuppressWarnings("deprecation") public FontMetrics getFontMetrics(Font f) { return (Toolkit.getDefaultToolkit().getFontMetrics(f)); }
@SuppressWarnings("deprecation") public FontMetrics getFontMetrics(Font f) { return Toolkit.getDefaultToolkit().getFontMetrics(f); }
@Override @SuppressWarnings("deprecation") @SuppressForbidden public FontMetrics getFontMetrics(Font f) { return Toolkit.getDefaultToolkit().getFontMetrics(f); }
protected FontMetrics getFontMetrics() { //Font font= tabPane.getFont(); Font font=UIManager.getFont("TabbedPane.selectedFont"); return Toolkit.getDefaultToolkit().getFontMetrics(font); }
private void calculateBaseUnits() { // This calculation comes from: // http://support.microsoft.com/default.aspx?scid=kb;EN-US;125681 FontMetrics metrics = Toolkit.getDefaultToolkit().getFontMetrics( UIManager.getFont("Button.font")); baseUnitX = metrics.stringWidth( "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"); baseUnitX = (baseUnitX / 26 + 1) / 2; // The -1 comes from experimentation. baseUnitY = metrics.getAscent() + metrics.getDescent() - 1; } }
public Dimension getPreferredSize(JComponent c) { Dimension d = super.getPreferredSize(c); String key = getAcceleratorString(); if (! (key.equals(""))) { FontMetrics fm = Toolkit.getDefaultToolkit().getFontMetrics(smallFont); d.width += fm.stringWidth(key) + padSpaceBetweenStrings; } return d; }
/** * Sets the font for this component. This is overridden to update the * cached font metrics and to recalculate which lines are visible. * @param font The font */ @SuppressWarnings("deprecation") public void setFont(Font font) { super.setFont(font); fm = Toolkit.getDefaultToolkit().getFontMetrics(font); textArea.recalculateVisibleLines(); }
/** * @param _comp a component if available, can be null * @param _font a font * @return the metrics of the font */ public static FontMetrics getFontMetrics(JComponent _comp, Font _font) { Toolkit tk = null; if (_comp != null) tk = _comp.getToolkit(); if (tk == null) tk = HELPER.getToolkit(); if (tk == null) tk = Toolkit.getDefaultToolkit(); return tk.getFontMetrics(_font); }
/** * Sets the font for this component. This is overridden to update the * cached font metrics and to recalculate which lines are visible. * @param font The font */ public void setFont(Font font) { super.setFont(font); fm = Toolkit.getDefaultToolkit().getFontMetrics(font); textArea.recalculateVisibleLines(); }
private void updateCursor( MouseEvent e ) { //noinspection deprecation FontMetrics fm = getToolkit().getFontMetrics( _editor.getFont() ); int iLineHeight = fm.getHeight(); if( _lineInfoMgr != null ) { setCursor( _lineInfoMgr.getCursor( (e.getY() - 2) / iLineHeight + 1 ) ); } } }