/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
public Dimension getPreferredSize(JComponent c) { SynthContext context = getContext(c); Dimension dim = null; if (context.getComponent().getName() == "ScrollBar.button") { //... } if (dim == null) { // For all other cases (including Spinner, ComboBox), we will // fall back on the single ArrowButton.size value to create // a square return value int size = context.getStyle().getInt(context, "ArrowButton.size", 16); dim = new Dimension(size, size); } //...
public Object getDefault(JComponent c, ComponentUI ui, String key) { if (!(ui instanceof SynthUI)) { Object value = super.getDefault(c, ui, key); return value; } SynthContext context = ((SynthUI)ui).getContext(c); Object value = context.getStyle().get(context, key); // line 27 context.dispose(); return value; }
@Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { JComponent jc = (JComponent)c; SynthContext context = ui.getContext(jc); SynthStyle style = context.getStyle(); if (style == null) { assert false: "SynthBorder is being used outside after the UI " + "has been uninstalled"; return; } ui.paintBorder(context, g, x, y, width, height); }
@Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { JComponent jc = (JComponent)c; SynthContext context = ui.getContext(jc); SynthStyle style = context.getStyle(); if (style == null) { assert false: "SynthBorder is being used outside after the UI " + "has been uninstalled"; return; } ui.paintBorder(context, g, x, y, width, height); }
@Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { JComponent jc = (JComponent)c; SynthContext context = ui.getContext(jc); SynthStyle style = context.getStyle(); if (style == null) { assert false: "SynthBorder is being used outside after the UI " + "has been uninstalled"; return; } ui.paintBorder(context, g, x, y, width, height); }
@Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { JComponent jc = (JComponent)c; SynthContext context = ui.getContext(jc); SynthStyle style = context.getStyle(); if (style == null) { assert false: "SynthBorder is being used outside after the UI " + "has been uninstalled"; return; } ui.paintBorder(context, g, x, y, width, height); }
/** * @param context * @param style * @return */ public static SynthContext getContext(SynthContext context, SynthStyle style) { if (context.getStyle().equals(style)) return context; return getContext(context.getComponent(), context.getRegion(), style, context.getComponentState()); } /**
/** * @param context * @param style * @return */ public static SynthContext getContext(SynthContext context, SynthStyle style) { if (context.getStyle().equals(style)) return context; return getContext(context.getComponent(), context.getRegion(), style, context.getComponentState()); } /**
/** * @param context * @param style * @return */ public static SynthContext getContext(SynthContext context, SynthStyle style) { if (context.getStyle().equals(style)) return context; return getContext(context.getComponent(), context.getRegion(), style, context.getComponentState()); } /**
/** * @param context * @param style * @return */ public static SynthContext getContext(SynthContext context, SynthStyle style) { if (context.getStyle().equals(style)) return context; return getContext(context.getComponent(), context.getRegion(), style, context.getComponentState()); } /**
/** * Returns a context with the given component state and all other fields same as input context. * * @param context the context, must not be null * @param state the component state. * @return a context with the given component state and other fields as inpu context. */ public static SynthContext getContext(SynthContext context, int state) { if (context.getComponentState() == state) return context; return getContext(context.getComponent(), context.getRegion(), context.getStyle(), state); }
/** * Returns a context with the given component state and all other fields same as input context. * * @param context the context, must not be null * @param state the component state. * @return a context with the given component state and other fields as inpu context. */ public static SynthContext getContext(SynthContext context, int state) { if (context.getComponentState() == state) return context; return getContext(context.getComponent(), context.getRegion(), context.getStyle(), state); }
/** * Returns a context with the given component state and all other fields same as input context. * * @param context the context, must not be null * @param state the component state. * @return a context with the given component state and other fields as inpu context. */ public static SynthContext getContext(SynthContext context, int state) { if (context.getComponentState() == state) return context; return getContext(context.getComponent(), context.getRegion(), context.getStyle(), state); }
/** * Returns a context with the given component state and all other fields same as input context. * * @param context the context, must not be null * @param state the component state. * @return a context with the given component state and other fields as inpu context. */ public static SynthContext getContext(SynthContext context, int state) { if (context.getComponentState() == state) return context; return getContext(context.getComponent(), context.getRegion(), context.getStyle(), state); }
/** * 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; }
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); }