public Color getColor(SynthContext context, ColorType type) { return style.getColor(context, type); }
/** * {@inheritDoc} */ @Override public Color getColorForState(SynthContext ctx, ColorType type) { return style.getColor(ctx, type); }
private void updateStyles() { SynthStyle ss = SynthLookAndFeel.getStyle(this, Region.BUTTON); SynthContext sc = new SynthContext(this, Region.BUTTON, ss, getSynthComponentState()); for (Component c : getComponents()) { c.setFont(ss.getFont(sc)); c.setBackground(ss.getColor(sc, ColorType.BACKGROUND)); c.setForeground(ss.getColor(sc, ColorType.FOREGROUND)); // ... and so on if you have other style elements to be changed. } }
if ((subregion && style.isOpaque(context)) || (!subregion && c.isOpaque())) { g.setColor(style.getColor(context, ColorType.BACKGROUND)); g.fillRect(x, y, width, height);
if ((subregion && style.isOpaque(context)) || (!subregion && c.isOpaque())) { g.setColor(style.getColor(context, ColorType.BACKGROUND)); g.fillRect(x, y, width, height);
if ((subregion && style.isOpaque(context)) || (!subregion && c.isOpaque())) { g.setColor(style.getColor(context, ColorType.BACKGROUND)); g.fillRect(x, y, width, height);
if ((subregion && style.isOpaque(context)) || (!subregion && c.isOpaque())) { g.setColor(style.getColor(context, ColorType.BACKGROUND)); g.fillRect(x, y, width, height);
g.setColor(style.getColor(state, ColorType.BACKGROUND)); g.fillRect(x, y, width, height);
g2.setColor(style.getColor(context, ColorType.TEXT_FOREGROUND)); style.getGraphicsUtils(context).paintText(context, g, title, textPos.x, textPos.y, -1); } else { g.setColor(style.getColor(context, ColorType.TEXT_FOREGROUND)); g.setFont(font); style.getGraphicsUtils(context).paintText(context, g, title, textRect.x, textRect.y, -1);
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); } }
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); } }
/** * 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)); }
static void paintText(Graphics g, SeaGlassMenuItemLayoutHelper lh, MenuItemLayoutHelper.LayoutResult lr) { if (!lh.getText().equals("")) { if (lh.getHtmlView() != null) { // Text is HTML lh.getHtmlView().paint(g, lr.getTextRect()); } else { // Text isn't HTML g.setColor(lh.getStyle().getColor( lh.getContext(), ColorType.TEXT_FOREGROUND)); g.setFont(lh.getStyle().getFont(lh.getContext())); lh.getGraphicsUtils().paintText(lh.getContext(), g, lh.getText(), lr.getTextRect().x, lr.getTextRect().y, lh.getMenuItem().getDisplayedMnemonicIndex()); } } }
g.setColor(context.getStyle().getColor(context, ColorType.TEXT_FOREGROUND)); context.getStyle().getGraphicsUtils(context).paintText(context, g, "" + slider.getValue(), valueRect.x, valueRect.y, -1);
dtcr.setBorderSelectionColor(style.getColor(cellContext, ColorType.FOCUS));