public SynthGraphicsUtils getGraphicsUtils(SynthContext context) { return style.getGraphicsUtils(context); }
/** * @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); }
/** * @inheritDoc */ @Override protected void paintVerticalLine(Graphics g, JComponent c, int x, int top, int bottom) { paintContext.getStyle().getGraphicsUtils(paintContext) .drawLine(paintContext, "Tree.verticalLine", g, x, top, x, bottom, linesStyle); }
/** * 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); }
public SeaGlassMenuItemLayoutHelper(SynthContext context, SynthContext accContext, JMenuItem mi, Icon checkIcon, Icon arrowIcon, Rectangle viewRect, int gap, String accDelimiter, boolean isLeftToRight, boolean useCheckAndArrow, String propertyPrefix) { this.context = context; this.accContext = accContext; this.style = context.getStyle(); this.accStyle = accContext.getStyle(); this.gu = style.getGraphicsUtils(context); this.accGu = accStyle.getGraphicsUtils(accContext); this.alignAcceleratorText = getAlignAcceleratorText(propertyPrefix); reset(mi, checkIcon, arrowIcon, viewRect, gap, accDelimiter, isLeftToRight, style.getFont(context), accStyle.getFont(accContext), useCheckAndArrow, propertyPrefix); setLeadingGap(0); }
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); }
/** * Paints the specified component. * * @param context * context for the component being painted * @param g * the {@code Graphics} object used for painting * @see #update(Graphics,JComponent) */ protected void paint(SynthContext context, Graphics g) { JToolTip tip = (JToolTip) context.getComponent(); Insets insets = tip.getInsets(); View v = (View) tip.getClientProperty(BasicHTML.propertyKey); if (v != null) { Rectangle paintTextR = new Rectangle(insets.left, insets.top, tip.getWidth() - (insets.left + insets.right), tip.getHeight() - (insets.top + insets.bottom)); v.paint(g, paintTextR); } else { g.setColor(context.getStyle().getColor(context, ColorType.TEXT_FOREGROUND)); g.setFont(style.getFont(context)); context.getStyle().getGraphicsUtils(context).paintText(context, g, tip.getTipText(), insets.left, insets.top, -1); } }
/** * Paint the label text for a tab. * * @param ss the SynthContext. * @param g the Graphics context. * @param tabPlacement the side the tabs are on. * @param font the font to use. * @param metrics the font metrics. * @param tabIndex the index of the tab to lay out. * @param title the text for the label, if any. * @param textRect Rectangle to place text in * @param isSelected is the tab selected? */ protected void paintText(SeaGlassContext ss, Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected) { g.setFont(font); View v = getTextViewForTab(tabIndex); if (v != null) { // html v.paint(g, textRect); } else { // plain text int mnemIndex = tabPane.getDisplayedMnemonicIndexAt(tabIndex); FontMetrics fm = SwingUtilities2.getFontMetrics(tabPane, g); title = SwingUtilities2.clipStringIfNecessary(tabPane, fm, title, textRect.width); g.setColor(ss.getStyle().getColor(ss, ColorType.TEXT_FOREGROUND)); ss.getStyle().getGraphicsUtils(ss).paintText(ss, g, title, textRect, mnemIndex); } }
/** * @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; }
/** * Paint the button. * * @param context the Synth context. * @param g the Graphics context. */ protected void paint(SeaGlassContext context, Graphics g) { AbstractButton b = (AbstractButton) context.getComponent(); g.setColor(context.getStyle().getColor(context, ColorType.TEXT_FOREGROUND)); g.setFont(style.getFont(context)); context.getStyle().getGraphicsUtils(context).paintText(context, g, b.getText(), getIcon(b), b.getHorizontalAlignment(), b.getVerticalAlignment(), b.getHorizontalTextPosition(), b.getVerticalTextPosition(), b.getIconTextGap(), b.getDisplayedMnemonicIndex(), getTextShiftOffset(context)); }
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);
width += tabContext.getStyle().getGraphicsUtils(tabContext).computeStringWidth(tabContext, metrics.getFont(), metrics, title);
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 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 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; }
ss.getStyle().getGraphicsUtils(ss).layoutText(ss, metrics, title, icon, SwingUtilities.CENTER, SwingUtilities.CENTER, SwingUtilities.LEADING, SwingUtilities.TRAILING, tabRect, iconRect, textRect, textIconGap);
/** * @see javax.swing.plaf.basic.BasicTabbedPaneUI#getBaseline(int) */ protected int getBaseline(int tab) { if (tabPane.getTabComponentAt(tab) != null || getTextViewForTab(tab) != null) { return super.getBaseline(tab); } String title = tabPane.getTitleAt(tab); Font font = tabContext.getStyle().getFont(tabContext); FontMetrics metrics = getFontMetrics(font); Icon icon = getIconForTab(tab); textRect.setBounds(0, 0, 0, 0); iconRect.setBounds(0, 0, 0, 0); calcRect.setBounds(0, 0, Short.MAX_VALUE, maxTabHeight); tabContext.getStyle().getGraphicsUtils(tabContext).layoutText(tabContext, metrics, title, icon, SwingUtilities.CENTER, SwingUtilities.CENTER, SwingUtilities.LEADING, SwingUtilities.TRAILING, calcRect, iconRect, textRect, textIconGap); return textRect.y + metrics.getAscent() + getBaselineOffset(); }
/** * @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; }
/** * @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#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; }