Java Code Examples for javax.swing.plaf.synth.SynthPainter

The following examples show how to use javax.swing.plaf.synth.SynthPainter. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: seaglass   Source File: SeaGlassToggleButtonUI.java    License: Apache License 2.0 5 votes vote down vote up
@Override
void paintBackground(SeaGlassContext context, Graphics g, JComponent c) {
    if (((AbstractButton) c).isContentAreaFilled()) {
        int x = 0, y = 0, w = c.getWidth(), h = c.getHeight();
        SynthPainter painter = context.getPainter();
        painter.paintToggleButtonBackground(context, g, x, y, w, h);
    }
}
 
Example 2
Source Project: seaglass   Source File: SeaGlassContext.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Convenience method to get the Painter from the current SynthStyle. This
 * will NEVER return null.
 *
 * @return the painter for the style and context, otherwise the empty
 *         painter.
 */
@SuppressWarnings("all")
public SynthPainter getPainter() {
    SynthPainter painter = getStyle().getPainter(this);

    if (painter != null) {
        return painter;
    }

    return EMPTY_PAINTER;
}
 
Example 3
Source Project: netbeans   Source File: GtkEditorTabCellRenderer.java    License: Apache License 2.0 4 votes vote down vote up
private static void paintTabBackground (Graphics g, int index, int state,
int x, int y, int w, int h) {
    if (dummyTab == null) {
        dummyTab = new JTabbedPane();
    }
    Region region = Region.TABBED_PANE_TAB;
    if( !(UIManager.getLookAndFeel() instanceof SynthLookAndFeel) ) {
        return; //#215311 - unsupported L&F installed
    }
    SynthLookAndFeel laf = (SynthLookAndFeel) UIManager.getLookAndFeel();
    SynthStyleFactory sf = laf.getStyleFactory();
    SynthStyle style = sf.getStyle(dummyTab, region);
    SynthContext context =
        new SynthContext(dummyTab, region, style, 
            state == SynthConstants.FOCUSED ? SynthConstants.SELECTED : state);
    SynthPainter painter = style.getPainter(context);
    long t1, t2;
    if (state == SynthConstants.DEFAULT) {
        t1 = System.currentTimeMillis();
        painter.paintTabbedPaneTabBackground(context, g, x, y, w, h, index);
        t2 = System.currentTimeMillis();
        if ((t2 - t1) > 200) {
            LOG.log(Level.WARNING, "painter.paintTabbedPaneTabBackground1 takes too long"
            + " x=" + x + " y=" + y + " w=" + w + " h=" + h + " index:" + index
            + " Time=" + (t2 - t1));
        }
    } else {
        BufferedImage bufIm = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2d = bufIm.createGraphics();
        g2d.setBackground(UIManager.getColor("Panel.background"));
        g2d.clearRect(0, 0, w, h);
        t1 = System.currentTimeMillis();
        painter.paintTabbedPaneTabBackground(context, g2d, 0, 0, w, h, index);
        t2 = System.currentTimeMillis();
        if ((t2 - t1) > 200) {
            LOG.log(Level.WARNING, "painter.paintTabbedPaneTabBackground1 takes too long"
            + " x=0" + " y=0" + " w=" + w + " h=" + h + " index:" + index
            + " Time=" + (t2 - t1));
        }
        // differentiate active and selected tabs, active tab made brighter,
        // selected tab darker
        RescaleOp op = state == SynthConstants.FOCUSED 
            ? new RescaleOp(1.08f, 0, null)
            : new RescaleOp(0.96f, 0, null); 
        BufferedImage img = op.filter(bufIm, null);
        g.drawImage(img, x, y, null);
    }

}
 
Example 4
Source Project: seaglass   Source File: SeaGlassStyleWrapper.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public SynthPainter getPainter(SynthContext ctx) {
    return painter;
}
 
Example 5
Source Project: jdk1.8-source-analysis   Source File: NimbusStyle.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * Returns the SynthPainter for this style, which ends up delegating to
 * the Painters installed in this style.
 */
@Override public SynthPainter getPainter(SynthContext ctx) {
    return painter;
}
 
Example 6
Source Project: dragonwell8_jdk   Source File: NimbusStyle.java    License: GNU General Public License v2.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * Returns the SynthPainter for this style, which ends up delegating to
 * the Painters installed in this style.
 */
@Override public SynthPainter getPainter(SynthContext ctx) {
    return painter;
}
 
Example 7
Source Project: TencentKona-8   Source File: NimbusStyle.java    License: GNU General Public License v2.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * Returns the SynthPainter for this style, which ends up delegating to
 * the Painters installed in this style.
 */
@Override public SynthPainter getPainter(SynthContext ctx) {
    return painter;
}
 
Example 8
Source Project: jdk8u60   Source File: NimbusStyle.java    License: GNU General Public License v2.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * Returns the SynthPainter for this style, which ends up delegating to
 * the Painters installed in this style.
 */
@Override public SynthPainter getPainter(SynthContext ctx) {
    return painter;
}
 
Example 9
Source Project: JDKSourceCode1.8   Source File: NimbusStyle.java    License: MIT License 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * Returns the SynthPainter for this style, which ends up delegating to
 * the Painters installed in this style.
 */
@Override public SynthPainter getPainter(SynthContext ctx) {
    return painter;
}
 
Example 10
Source Project: openjdk-jdk8u   Source File: NimbusStyle.java    License: GNU General Public License v2.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * Returns the SynthPainter for this style, which ends up delegating to
 * the Painters installed in this style.
 */
@Override public SynthPainter getPainter(SynthContext ctx) {
    return painter;
}
 
Example 11
/**
 * {@inheritDoc}
 *
 * Returns the SynthPainter for this style, which ends up delegating to
 * the Painters installed in this style.
 */
@Override public SynthPainter getPainter(SynthContext ctx) {
    return painter;
}
 
Example 12
Source Project: Bytecoder   Source File: NimbusStyle.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * Returns the SynthPainter for this style, which ends up delegating to
 * the Painters installed in this style.
 */
@Override public SynthPainter getPainter(SynthContext ctx) {
    return painter;
}
 
Example 13
Source Project: openjdk-jdk9   Source File: NimbusStyle.java    License: GNU General Public License v2.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * Returns the SynthPainter for this style, which ends up delegating to
 * the Painters installed in this style.
 */
@Override public SynthPainter getPainter(SynthContext ctx) {
    return painter;
}
 
Example 14
Source Project: jdk8u-jdk   Source File: NimbusStyle.java    License: GNU General Public License v2.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * Returns the SynthPainter for this style, which ends up delegating to
 * the Painters installed in this style.
 */
@Override public SynthPainter getPainter(SynthContext ctx) {
    return painter;
}
 
Example 15
Source Project: Java8CN   Source File: NimbusStyle.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * Returns the SynthPainter for this style, which ends up delegating to
 * the Painters installed in this style.
 */
@Override public SynthPainter getPainter(SynthContext ctx) {
    return painter;
}
 
Example 16
Source Project: hottub   Source File: NimbusStyle.java    License: GNU General Public License v2.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * Returns the SynthPainter for this style, which ends up delegating to
 * the Painters installed in this style.
 */
@Override public SynthPainter getPainter(SynthContext ctx) {
    return painter;
}
 
Example 17
Source Project: openjdk-8-source   Source File: NimbusStyle.java    License: GNU General Public License v2.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * Returns the SynthPainter for this style, which ends up delegating to
 * the Painters installed in this style.
 */
@Override public SynthPainter getPainter(SynthContext ctx) {
    return painter;
}
 
Example 18
Source Project: openjdk-8   Source File: NimbusStyle.java    License: GNU General Public License v2.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * Returns the SynthPainter for this style, which ends up delegating to
 * the Painters installed in this style.
 */
@Override public SynthPainter getPainter(SynthContext ctx) {
    return painter;
}
 
Example 19
Source Project: jdk8u_jdk   Source File: NimbusStyle.java    License: GNU General Public License v2.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * Returns the SynthPainter for this style, which ends up delegating to
 * the Painters installed in this style.
 */
@Override public SynthPainter getPainter(SynthContext ctx) {
    return painter;
}
 
Example 20
Source Project: jdk8u-jdk   Source File: NimbusStyle.java    License: GNU General Public License v2.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * Returns the SynthPainter for this style, which ends up delegating to
 * the Painters installed in this style.
 */
@Override public SynthPainter getPainter(SynthContext ctx) {
    return painter;
}
 
Example 21
Source Project: seaglass   Source File: SeaGlassStyle.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Returns the <code>SynthPainter</code> that will be used for painting.
 * This ends up delegating to the Painters installed in this style. It may
 * return null;
 *
 * @param  ctx context SynthContext identifying requester
 *
 * @return SynthPainter to use
 */
@Override
public SynthPainter getPainter(SynthContext ctx) {
    return painter;
}
 
Example 22
Source Project: jdk8u-dev-jdk   Source File: NimbusStyle.java    License: GNU General Public License v2.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * Returns the SynthPainter for this style, which ends up delegating to
 * the Painters installed in this style.
 */
@Override public SynthPainter getPainter(SynthContext ctx) {
    return painter;
}