SynthGraphicsUtils graphicsUtils = context.getStyle().getGraphicsUtils(context); String frameTitle = getTitle(); int title_w = frameTitle != null ? graphicsUtils.computeStringWidth(context, fm.getFont(), fm, frameTitle) : 0; int title_length = frameTitle != null ? frameTitle.length() : 0; int subtitle_w = graphicsUtils.computeStringWidth(context, fm.getFont(), fm, frameTitle.substring(0, 3) + "...");
Font font = style.getFont(context); FontMetrics fm = SwingUtilities2.getFontMetrics(progressBar, g, font); int strLength = style.getGraphicsUtils(context).computeStringWidth(context, font, fm, title); Rectangle bounds = progressBar.getBounds();
SynthGraphicsUtils graphicsUtils = context.getStyle().getGraphicsUtils(context); String frameTitle = frame.getTitle(); int title_w = frameTitle != null ? graphicsUtils.computeStringWidth(context, fm.getFont(), fm, frameTitle) : 0; int title_length = frameTitle != null ? frameTitle.length() : 0; int subtitle_w = graphicsUtils.computeStringWidth(context, fm.getFont(), fm, frameTitle.substring(0, 3) + "...");
/** * @inheritDoc */ @Override public Dimension getPreferredSize(JComponent c) { SeaGlassContext context = getContext(c); Insets insets = c.getInsets(); Dimension prefSize = new Dimension(insets.left + insets.right, insets.top + insets.bottom); String text = ((JToolTip) c).getTipText(); if (text != null) { View v = (c != null) ? (View) c.getClientProperty("html") : null; if (v != null) { prefSize.width += (int) v.getPreferredSpan(View.X_AXIS); prefSize.height += (int) v.getPreferredSpan(View.Y_AXIS); } else { Font font = context.getStyle().getFont(context); FontMetrics fm = c.getFontMetrics(font); prefSize.width += context.getStyle().getGraphicsUtils(context).computeStringWidth(context, font, fm, text); prefSize.height += fm.getHeight(); } } context.dispose(); return prefSize; }
width += tabContext.getStyle().getGraphicsUtils(tabContext).computeStringWidth(tabContext, metrics.getFont(), metrics, title);
int labelWidth = context.getStyle().getGraphicsUtils(context).computeStringWidth(context, g.getFont(), fm, "" + slider.getValue()); valueRect.x = thumbRect.x + (thumbRect.width - labelWidth) / 2;
int width = style.getGraphicsUtils(context).computeStringWidth(context, g.getFont(), fm, title);
int width = style.getGraphicsUtils(context).computeStringWidth(context, g.getFont(), fm, title);
valueRect.width = Math.max(synthGraphics.computeStringWidth(context, slider.getFont(), fm, "" + slider.getMaximum()), synthGraphics.computeStringWidth(context, slider.getFont(), fm, "" + slider.getMinimum()));
} else { SynthStyle style = accContext.getStyle(); acceleratorRect.width = style.getGraphicsUtils(accContext).computeStringWidth(accContext, fmAccel.getFont(), fmAccel, acceleratorText); acceleratorRect.height = fmAccel.getHeight();
getAccSize().setWidth(accGu.computeStringWidth(getAccContext(), getAccFontMetrics().getFont(), getAccFontMetrics(), getAccText())); } else { getTextSize().setWidth(gu.computeStringWidth(context, getFontMetrics().getFont(), getFontMetrics(), getText()));