Refine search
public Insets getInsets(SynthContext context, Insets insets) { return style.getInsets(context, insets); }
public boolean getBoolean(SynthContext context, Object key, boolean defaultValue) { return style.getBoolean(context, key, defaultValue); }
public Color getColor(SynthContext context, ColorType type) { return style.getColor(context, type); }
JComponent c = context.getComponent(); SynthStyle style = context.getStyle(); int x, y, width, height; x = 0; y = 0; width = c.getWidth(); height = c.getHeight(); } else { x = bounds.x; boolean subregion = context.getRegion().isSubregion(); if ((subregion && style.isOpaque(context)) || (!subregion && c.isOpaque())) { g.setColor(style.getColor(context, ColorType.BACKGROUND)); g.fillRect(x, y, width, height);
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); } }
/** * @inheritDoc */ @Override protected void paintDropLine(Graphics g) { JTree.DropLocation loc = tree.getDropLocation(); if (!isDropLine(loc)) { return; } Color c = (Color) style.get(paintContext, "Tree.dropLineColor"); if (c != null) { g.setColor(c); Rectangle rect = getDropLineRect(loc); g.fillRect(rect.x, rect.y, rect.width, rect.height); } }
/** * 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); } }
JTree tree = new JTree(); return style.get(context, key); return style.getBoolean(context, key, defaultValue); return style.getColor(context, type); return style.getFont(context); return style.getGraphicsUtils(context); return style.getIcon(context, key); return style.getInsets(context, insets); return style.getInt(context, key, defaultValue); return style.getString(context, key, defaultValue); style.installDefaults(context); style.uninstallDefaults(context); return style.isOpaque(context);
/** * @inheritDoc */ @Override protected void uninstallDefaults() { SeaGlassContext context = getContext(getComponent(), ENABLED); JComponent c = getComponent(); c.putClientProperty("caretAspectRatio", null); style.uninstallDefaults(context); context.dispose(); style = null; Object clientProperty = c.getClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES); if (clientProperty == localTrue) { c.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.FALSE); } super.uninstallDefaults(); }
public static void paint(SynthContext context, SynthContext accContext, Graphics g, Icon checkIcon, Icon arrowIcon, String acceleratorDelimiter, int defaultTextIconGap, String propertyPrefix) { JMenuItem mi = (JMenuItem) context.getComponent(); SynthStyle style = context.getStyle(); g.setFont(style.getFont(context)); Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight()); boolean leftToRight = SeaGlassLookAndFeel.isLeftToRight(mi); applyInsets(viewRect, mi.getInsets(), leftToRight); SeaGlassMenuItemLayoutHelper lh = new SeaGlassMenuItemLayoutHelper(context, accContext, mi, checkIcon, arrowIcon, viewRect, defaultTextIconGap, acceleratorDelimiter, leftToRight, MenuItemLayoutHelper.useCheckAndArrow(mi), propertyPrefix); MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem(); paintMenuItem(g, lh, lr); }
/** * @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; }
/** * @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; }
/** * A convenience method to return where the foreground should be painted for * the Component identified by the passed in AbstractSynthContext. * * @param state the SynthContext representing the current state. * @param insets an Insets object to be filled with the painting insets. * * @return the insets object passed in and filled with the painting insets. */ public static Insets getPaintingInsets(SynthContext state, Insets insets) { if (state.getRegion().isSubregion()) { insets = state.getStyle().getInsets(state, insets); } else { insets = state.getComponent().getInsets(insets); } return insets; }
style.uninstallDefaults(getContext(ENABLED)); style.installDefaults(getContext(ENABLED)); list.setSelectionBackground(style.getColor( selectedContext, ColorType.TEXT_BACKGROUND)); list.setSelectionForeground(style.getColor( selectedContext, ColorType.TEXT_FOREGROUND)); int height = style.getInt(selectedContext, "List.cellHeight", -1); if (height != -1) { list.setFixedCellHeight(height); useListColors = style.getBoolean(selectedContext, "List.rendererUseListColors", true); useUIBorder = style.getBoolean(selectedContext, "List.rendererUseUIBorder", true);
/** * @see javax.swing.plaf.ComponentUI#getPreferredSize(javax.swing.JComponent) */ public Dimension getPreferredSize(JComponent c) { SeaGlassContext context = getContext(c); int thickness = style.getInt(context, "Separator.thickness", 5); Insets insets = c.getInsets(); Dimension size; if (((JSeparator) c).getOrientation() == JSeparator.VERTICAL) { size = new Dimension(insets.left + insets.right + thickness, insets.top + insets.bottom); } else { size = new Dimension(insets.left + insets.right, insets.top + insets.bottom + thickness); } context.dispose(); return size; }
FontMetrics fm = context.getComponent().getFontMetrics(context.getStyle().getFont(context)); context.getStyle().getGraphicsUtils(context).layoutText(context, fm, label.getText(), label.getIcon(), label.getHorizontalAlignment(), label.getVerticalAlignment(), label.getHorizontalTextPosition(), label.getVerticalTextPosition(), viewRect, iconRect, textRect, label.getIconTextGap());
public void uninstallDefaults(SynthContext context) { style.uninstallDefaults(context); }
/** * Returns a SynthPainter from the context's style. Fall-back to default if * none available. * * @param context SynthContext containing the style, must not be null. * @return a SynthPainter from the context's style, or a default if null. */ public static SynthPainter getPainter(SynthContext context) { SynthPainter painter = context.getStyle().getPainter(context); return painter != null ? painter : NULL_PAINTER; }
Color sbg = list.getSelectionBackground(); if (sbg == null || sbg instanceof UIResource) { list.setSelectionBackground(style.getColor( context, ColorType.TEXT_BACKGROUND)); list.setSelectionForeground(style.getColor( context, ColorType.TEXT_FOREGROUND)); useListColors = style.getBoolean(context, "List.rendererUseListColors", true); useUIBorder = style.getBoolean(context, "List.rendererUseUIBorder", true); int height = style.getInt(context, "List.cellHeight", -1); if (height != -1) { list.setFixedCellHeight(height);