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(); g2.setFont(font); g2.setColor(style.getColor(context, ColorType.TEXT_FOREGROUND)); style.getGraphicsUtils(context).paintText(context, g, title, textPos.x, textPos.y, -1); } else { style.getGraphicsUtils(context).paintText(context, g, title, textRect.x, textRect.y, -1);
/** * @inheritDoc */ @Override protected void paintHorizontalLine(Graphics g, JComponent c, int y, int left, int right) { paintContext.getStyle().getGraphicsUtils(paintContext) .drawLine(paintContext, "Tree.horizontalLine", g, left, y, right, y, linesStyle); }
context.getStyle().getGraphicsUtils(context).layoutText(context, fm, label.getText(), label.getIcon(), label.getHorizontalAlignment(), label.getVerticalAlignment(), label.getHorizontalTextPosition(), label.getVerticalTextPosition(), viewRect, iconRect, textRect, label.getIconTextGap());
/** * DOCUMENT ME! * * @param context DOCUMENT ME! * @param g DOCUMENT ME! * @param c DOCUMENT ME! */ protected void paintPlaceholderText(SeaGlassContext context, Graphics g, JComponent c) { g.setColor(placeholderColor); g.setFont(c.getFont()); Rectangle innerArea = SwingUtilities.calculateInnerArea(c, null); Rectangle cancelBounds = getCancelButtonBounds(); context.getStyle().getGraphicsUtils(context).paintText(context, g, getPlaceholderText(g, innerArea.width + cancelBounds.width), innerArea.x, innerArea.y, -1); }
context.getStyle().getGraphicsUtils(context).layoutText(context, fm, text, icon, horizontalAlignment, verticalAlignment, horizontalTextPosition, verticalTextPosition, viewRect, iconRect, textRect, textIconGap); } else { SynthStyle style = accContext.getStyle(); acceleratorRect.width = style.getGraphicsUtils(accContext).computeStringWidth(accContext, fmAccel.getFont(), fmAccel, acceleratorText); acceleratorRect.height = fmAccel.getHeight();
valueRect.height = synthGraphics.getMaximumCharHeight(context); valueRect.height = 0; if (paintValue) { valueRect.height = synthGraphics.getMaximumCharHeight(context); valueRect.width = Math.max(synthGraphics.computeStringWidth(context, slider.getFont(), fm, "" + slider.getMaximum()), synthGraphics.computeStringWidth(context, slider.getFont(), fm, "" + slider.getMinimum()));
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) + "...");
public Dimension getPreferredSize(JComponent c) { JLabel label = (JLabel) c; Icon icon = (label.isEnabled()) ? label.getIcon() : label.getDisabledIcon(); SeaGlassContext context = getContext(c); Dimension size = context.getStyle().getGraphicsUtils(context).getPreferredSize(context, context.getStyle().getFont(context), label.getText(), icon, label.getHorizontalAlignment(), label.getVerticalAlignment(), label.getHorizontalTextPosition(), label.getVerticalTextPosition(), label.getIconTextGap(), label.getDisplayedMnemonicIndex()); context.dispose(); return size; }
public Dimension getMaximumSize(JComponent c) { JLabel label = (JLabel) c; Icon icon = (label.isEnabled()) ? label.getIcon() : label.getDisabledIcon(); SeaGlassContext context = getContext(c); Dimension size = context.getStyle().getGraphicsUtils(context).getMaximumSize(context, context.getStyle().getFont(context), label.getText(), icon, label.getHorizontalAlignment(), label.getVerticalAlignment(), label.getHorizontalTextPosition(), label.getVerticalTextPosition(), label.getIconTextGap(), label.getDisplayedMnemonicIndex()); context.dispose(); return size; }
public Dimension getMinimumSize(JComponent c) { JLabel label = (JLabel) c; Icon icon = (label.isEnabled()) ? label.getIcon() : label.getDisabledIcon(); SeaGlassContext context = getContext(c); Dimension size = context.getStyle().getGraphicsUtils(context).getMinimumSize(context, context.getStyle().getFont(context), label.getText(), icon, label.getHorizontalAlignment(), label.getVerticalAlignment(), label.getHorizontalTextPosition(), label.getVerticalTextPosition(), label.getIconTextGap(), label.getDisplayedMnemonicIndex()); context.dispose(); return size; }
if (paintValue) { SeaGlassContext context = getContext(slider); valueHeight = context.getStyle().getGraphicsUtils(context).getMaximumCharHeight(context); context.dispose(); if (paintValue) { SeaGlassContext context = getContext(slider); valueHeight = context.getStyle().getGraphicsUtils(context).getMaximumCharHeight(context); context.dispose();
static void paintAccText(Graphics g, SeaGlassMenuItemLayoutHelper lh, MenuItemLayoutHelper.LayoutResult lr) { String accText = lh.getAccText(); if (accText != null && !accText.equals("")) { g.setColor(lh.getAccStyle().getColor(lh.getAccContext(), ColorType.TEXT_FOREGROUND)); g.setFont(lh.getAccStyle().getFont(lh.getAccContext())); lh.getAccGraphicsUtils().paintText(lh.getAccContext(), g, accText, lr.getAccRect().x, lr.getAccRect().y, -1); } }
getAccSize().setWidth(accGu.computeStringWidth(getAccContext(), getAccFontMetrics().getFont(), getAccFontMetrics(), getAccText())); } else { getTextSize().setWidth(gu.computeStringWidth(context, getFontMetrics().getFont(), getFontMetrics(), getText())); Rectangle textRect = new Rectangle(); Rectangle iconRect = new Rectangle(); gu.layoutText(context, getFontMetrics(), getText(), getIcon(), getHorizontalAlignment(), getVerticalAlignment(), getHorizontalTextPosition(), getVerticalTextPosition(),
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) + "...");
/** * @see javax.swing.plaf.basic.BasicButtonUI#getPreferredSize(javax.swing.JComponent) */ public Dimension getPreferredSize(JComponent c) { if (c.getComponentCount() > 0 && c.getLayout() != null) { return null; } AbstractButton b = (AbstractButton) c; SeaGlassContext ss = getContext(c); SynthStyle style2 = ss.getStyle(); SynthGraphicsUtils graphicsUtils = style2.getGraphicsUtils(ss); Dimension size = graphicsUtils.getPreferredSize(ss, style2.getFont(ss), b.getText(), getSizingIcon(b), b.getHorizontalAlignment(), b.getVerticalAlignment(), b.getHorizontalTextPosition(), b.getVerticalTextPosition(), b.getIconTextGap(), b.getDisplayedMnemonicIndex()); ss.dispose(); // Make height odd. size.height &= ~1; return size; }
/** * @see javax.swing.plaf.basic.BasicButtonUI#getMaximumSize(javax.swing.JComponent) */ public Dimension getMaximumSize(JComponent c) { if (c.getComponentCount() > 0 && c.getLayout() != null) { return null; } AbstractButton b = (AbstractButton) c; SeaGlassContext ss = getContext(c); final SynthStyle style2 = ss.getStyle(); Dimension size = style2.getGraphicsUtils(ss).getMaximumSize(ss, style2.getFont(ss), b.getText(), getSizingIcon(b), b.getHorizontalAlignment(), b.getVerticalAlignment(), b.getHorizontalTextPosition(), b.getVerticalTextPosition(), b.getIconTextGap(), b.getDisplayedMnemonicIndex()); ss.dispose(); return size; }
/** * @see javax.swing.plaf.basic.BasicButtonUI#getMinimumSize(javax.swing.JComponent) */ public Dimension getMinimumSize(JComponent c) { if (c.getComponentCount() > 0 && c.getLayout() != null) { return null; } AbstractButton b = (AbstractButton) c; SeaGlassContext ss = getContext(c); final SynthStyle style2 = ss.getStyle(); Dimension size = style2.getGraphicsUtils(ss).getMinimumSize(ss, style2.getFont(ss), b.getText(), getSizingIcon(b), b.getHorizontalAlignment(), b.getVerticalAlignment(), b.getHorizontalTextPosition(), b.getVerticalTextPosition(), b.getIconTextGap(), b.getDisplayedMnemonicIndex()); ss.dispose(); return size; }
int labelWidth = context.getStyle().getGraphicsUtils(context).computeStringWidth(context, g.getFont(), fm, "" + slider.getValue()); valueRect.x = thumbRect.x + (thumbRect.width - labelWidth) / 2; context.getStyle().getGraphicsUtils(context).paintText(context, g, "" + slider.getValue(), valueRect.x, valueRect.y, -1);
protected void paint(SeaGlassContext context, Graphics g) { JLabel label = (JLabel) context.getComponent(); Icon icon = (label.isEnabled()) ? label.getIcon() : label.getDisabledIcon(); g.setColor(context.getStyle().getColor(context, ColorType.TEXT_FOREGROUND)); g.setFont(style.getFont(context)); context.getStyle().getGraphicsUtils(context).paintText(context, g, label.getText(), icon, label.getHorizontalAlignment(), label.getVerticalAlignment(), label.getHorizontalTextPosition(), label.getVerticalTextPosition(), label.getIconTextGap(), label.getDisplayedMnemonicIndex(), 0); }
protected void layoutIconAndTextInLabelRect(LayoutResult lr) { lr.setTextRect(new Rectangle()); lr.setIconRect(new Rectangle()); gu.layoutText(context, getFontMetrics(), getText(), getIcon(), getHorizontalAlignment(), getVerticalAlignment(), getHorizontalTextPosition(), getVerticalTextPosition(), lr.getLabelRect(), lr.getIconRect(), lr.getTextRect(), getGap()); }