Java Code Examples for sun.swing.plaf.synth.SynthIcon

The following examples show how to use sun.swing.plaf.synth.SynthIcon. 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: jdk1.8-source-analysis   Source File: SynthToolBarUI.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Paints the toolbar.
 *
 * @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) {
    if (handleIcon != null && toolBar.isFloatable()) {
        int startX = toolBar.getComponentOrientation().isLeftToRight() ?
            0 : toolBar.getWidth() -
                SynthIcon.getIconWidth(handleIcon, context);
        SynthIcon.paintIcon(handleIcon, context, g, startX, 0,
                SynthIcon.getIconWidth(handleIcon, context),
                SynthIcon.getIconHeight(handleIcon, context));
    }

    SynthContext subcontext = getContext(
            toolBar, Region.TOOL_BAR_CONTENT, contentStyle);
    paintContent(subcontext, g, contentRect);
    subcontext.dispose();
}
 
Example 2
/**
 * Paints the toolbar.
 *
 * @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) {
    if (handleIcon != null && toolBar.isFloatable()) {
        int startX = toolBar.getComponentOrientation().isLeftToRight() ?
            0 : toolBar.getWidth() -
                SynthIcon.getIconWidth(handleIcon, context);
        SynthIcon.paintIcon(handleIcon, context, g, startX, 0,
                SynthIcon.getIconWidth(handleIcon, context),
                SynthIcon.getIconHeight(handleIcon, context));
    }

    SynthContext subcontext = getContext(
            toolBar, Region.TOOL_BAR_CONTENT, contentStyle);
    paintContent(subcontext, g, contentRect);
    subcontext.dispose();
}
 
Example 3
Source Project: TencentKona-8   Source File: SynthToolBarUI.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Paints the toolbar.
 *
 * @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) {
    if (handleIcon != null && toolBar.isFloatable()) {
        int startX = toolBar.getComponentOrientation().isLeftToRight() ?
            0 : toolBar.getWidth() -
                SynthIcon.getIconWidth(handleIcon, context);
        SynthIcon.paintIcon(handleIcon, context, g, startX, 0,
                SynthIcon.getIconWidth(handleIcon, context),
                SynthIcon.getIconHeight(handleIcon, context));
    }

    SynthContext subcontext = getContext(
            toolBar, Region.TOOL_BAR_CONTENT, contentStyle);
    paintContent(subcontext, g, contentRect);
    subcontext.dispose();
}
 
Example 4
Source Project: jdk8u60   Source File: SynthToolBarUI.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Paints the toolbar.
 *
 * @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) {
    if (handleIcon != null && toolBar.isFloatable()) {
        int startX = toolBar.getComponentOrientation().isLeftToRight() ?
            0 : toolBar.getWidth() -
                SynthIcon.getIconWidth(handleIcon, context);
        SynthIcon.paintIcon(handleIcon, context, g, startX, 0,
                SynthIcon.getIconWidth(handleIcon, context),
                SynthIcon.getIconHeight(handleIcon, context));
    }

    SynthContext subcontext = getContext(
            toolBar, Region.TOOL_BAR_CONTENT, contentStyle);
    paintContent(subcontext, g, contentRect);
    subcontext.dispose();
}
 
Example 5
Source Project: JDKSourceCode1.8   Source File: SynthToolBarUI.java    License: MIT License 6 votes vote down vote up
/**
 * Paints the toolbar.
 *
 * @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) {
    if (handleIcon != null && toolBar.isFloatable()) {
        int startX = toolBar.getComponentOrientation().isLeftToRight() ?
            0 : toolBar.getWidth() -
                SynthIcon.getIconWidth(handleIcon, context);
        SynthIcon.paintIcon(handleIcon, context, g, startX, 0,
                SynthIcon.getIconWidth(handleIcon, context),
                SynthIcon.getIconHeight(handleIcon, context));
    }

    SynthContext subcontext = getContext(
            toolBar, Region.TOOL_BAR_CONTENT, contentStyle);
    paintContent(subcontext, g, contentRect);
    subcontext.dispose();
}
 
Example 6
Source Project: jdk8u_jdk   Source File: SynthToolBarUI.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Paints the toolbar.
 *
 * @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) {
    if (handleIcon != null && toolBar.isFloatable()) {
        int startX = toolBar.getComponentOrientation().isLeftToRight() ?
            0 : toolBar.getWidth() -
                SynthIcon.getIconWidth(handleIcon, context);
        SynthIcon.paintIcon(handleIcon, context, g, startX, 0,
                SynthIcon.getIconWidth(handleIcon, context),
                SynthIcon.getIconHeight(handleIcon, context));
    }

    SynthContext subcontext = getContext(
            toolBar, Region.TOOL_BAR_CONTENT, contentStyle);
    paintContent(subcontext, g, contentRect);
    subcontext.dispose();
}
 
Example 7
Source Project: openjdk-jdk8u   Source File: SynthToolBarUI.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Paints the toolbar.
 *
 * @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) {
    if (handleIcon != null && toolBar.isFloatable()) {
        int startX = toolBar.getComponentOrientation().isLeftToRight() ?
            0 : toolBar.getWidth() -
                SynthIcon.getIconWidth(handleIcon, context);
        SynthIcon.paintIcon(handleIcon, context, g, startX, 0,
                SynthIcon.getIconWidth(handleIcon, context),
                SynthIcon.getIconHeight(handleIcon, context));
    }

    SynthContext subcontext = getContext(
            toolBar, Region.TOOL_BAR_CONTENT, contentStyle);
    paintContent(subcontext, g, contentRect);
    subcontext.dispose();
}
 
Example 8
/**
 * Paints the toolbar.
 *
 * @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) {
    if (handleIcon != null && toolBar.isFloatable()) {
        int startX = toolBar.getComponentOrientation().isLeftToRight() ?
            0 : toolBar.getWidth() -
                SynthIcon.getIconWidth(handleIcon, context);
        SynthIcon.paintIcon(handleIcon, context, g, startX, 0,
                SynthIcon.getIconWidth(handleIcon, context),
                SynthIcon.getIconHeight(handleIcon, context));
    }

    SynthContext subcontext = getContext(
            toolBar, Region.TOOL_BAR_CONTENT, contentStyle);
    paintContent(subcontext, g, contentRect);
    subcontext.dispose();
}
 
Example 9
Source Project: jdk8u-jdk   Source File: SynthToolBarUI.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Paints the toolbar.
 *
 * @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) {
    if (handleIcon != null && toolBar.isFloatable()) {
        int startX = toolBar.getComponentOrientation().isLeftToRight() ?
            0 : toolBar.getWidth() -
                SynthIcon.getIconWidth(handleIcon, context);
        SynthIcon.paintIcon(handleIcon, context, g, startX, 0,
                SynthIcon.getIconWidth(handleIcon, context),
                SynthIcon.getIconHeight(handleIcon, context));
    }

    SynthContext subcontext = getContext(
            toolBar, Region.TOOL_BAR_CONTENT, contentStyle);
    paintContent(subcontext, g, contentRect);
    subcontext.dispose();
}
 
Example 10
/**
 * Paints the toolbar.
 *
 * @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) {
    if (handleIcon != null && toolBar.isFloatable()) {
        int startX = toolBar.getComponentOrientation().isLeftToRight() ?
            0 : toolBar.getWidth() -
                SynthIcon.getIconWidth(handleIcon, context);
        SynthIcon.paintIcon(handleIcon, context, g, startX, 0,
                SynthIcon.getIconWidth(handleIcon, context),
                SynthIcon.getIconHeight(handleIcon, context));
    }

    SynthContext subcontext = getContext(
            toolBar, Region.TOOL_BAR_CONTENT, contentStyle);
    paintContent(subcontext, g, contentRect);
    subcontext.dispose();
}
 
Example 11
Source Project: openjdk-8   Source File: SynthToolBarUI.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Paints the toolbar.
 *
 * @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) {
    if (handleIcon != null && toolBar.isFloatable()) {
        int startX = toolBar.getComponentOrientation().isLeftToRight() ?
            0 : toolBar.getWidth() -
                SynthIcon.getIconWidth(handleIcon, context);
        SynthIcon.paintIcon(handleIcon, context, g, startX, 0,
                SynthIcon.getIconWidth(handleIcon, context),
                SynthIcon.getIconHeight(handleIcon, context));
    }

    SynthContext subcontext = getContext(
            toolBar, Region.TOOL_BAR_CONTENT, contentStyle);
    paintContent(subcontext, g, contentRect);
    subcontext.dispose();
}
 
Example 12
Source Project: jdk1.8-source-analysis   Source File: NimbusLookAndFeel.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
    if (icon instanceof SynthIcon) {
        SynthIcon si = (SynthIcon)icon;
        BufferedImage img = EffectUtils.createCompatibleTranslucentImage(
                si.getIconWidth(), si.getIconHeight());
        Graphics2D gfx = img.createGraphics();
        si.paintIcon(component, gfx, 0, 0);
        gfx.dispose();
        return new ImageIconUIResource(GrayFilter.createDisabledImage(img));
    } else {
        return super.getDisabledIcon(component, icon);
    }
}
 
Example 13
Source Project: jdk1.8-source-analysis   Source File: SynthTreeUI.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void drawCentered(Component c, Graphics graphics, Icon icon,
                            int x, int y) {
    int w = SynthIcon.getIconWidth(icon, paintContext);
    int h = SynthIcon.getIconHeight(icon, paintContext);

    SynthIcon.paintIcon(icon, paintContext, graphics,
                        findCenteredX(x, w),
                        y - h/2, w, h);
}
 
Example 14
Source Project: jdk1.8-source-analysis   Source File: SynthTreeUI.java    License: Apache License 2.0 5 votes vote down vote up
public void paintIcon(SynthContext context, Graphics g, int x,
                      int y, int w, int h) {
    if (context == null) {
        context = getContext(tree);
        SynthIcon.paintIcon(expandedIcon, context, g, x, y, w, h);
        context.dispose();
    }
    else {
        SynthIcon.paintIcon(expandedIcon, context, g, x, y, w, h);
    }
}
 
Example 15
Source Project: openjdk-8   Source File: SynthTreeUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
public int getIconWidth(SynthContext context) {
    int width;
    if (context == null) {
        context = getContext(tree);
        width = SynthIcon.getIconWidth(expandedIcon, context);
        context.dispose();
    }
    else {
        width = SynthIcon.getIconWidth(expandedIcon, context);
    }
    return width;
}
 
Example 16
Source Project: jdk1.8-source-analysis   Source File: SynthTreeUI.java    License: Apache License 2.0 5 votes vote down vote up
public int getIconHeight(SynthContext context) {
    int height;
    if (context == null) {
        context = getContext(tree);
        height = SynthIcon.getIconHeight(expandedIcon, context);
        context.dispose();
    }
    else {
        height = SynthIcon.getIconHeight(expandedIcon, context);
    }
    return height;
}
 
Example 17
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
    if (icon instanceof SynthIcon) {
        SynthIcon si = (SynthIcon)icon;
        BufferedImage img = EffectUtils.createCompatibleTranslucentImage(
                si.getIconWidth(), si.getIconHeight());
        Graphics2D gfx = img.createGraphics();
        si.paintIcon(component, gfx, 0, 0);
        gfx.dispose();
        return new ImageIconUIResource(GrayFilter.createDisabledImage(img));
    } else {
        return super.getDisabledIcon(component, icon);
    }
}
 
Example 18
Source Project: dragonwell8_jdk   Source File: SynthTreeUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void drawCentered(Component c, Graphics graphics, Icon icon,
                            int x, int y) {
    int w = SynthIcon.getIconWidth(icon, paintContext);
    int h = SynthIcon.getIconHeight(icon, paintContext);

    SynthIcon.paintIcon(icon, paintContext, graphics,
                        findCenteredX(x, w),
                        y - h/2, w, h);
}
 
Example 19
Source Project: dragonwell8_jdk   Source File: SynthTreeUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void paintIcon(SynthContext context, Graphics g, int x,
                      int y, int w, int h) {
    if (context == null) {
        context = getContext(tree);
        SynthIcon.paintIcon(expandedIcon, context, g, x, y, w, h);
        context.dispose();
    }
    else {
        SynthIcon.paintIcon(expandedIcon, context, g, x, y, w, h);
    }
}
 
Example 20
Source Project: dragonwell8_jdk   Source File: SynthTreeUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
public int getIconWidth(SynthContext context) {
    int width;
    if (context == null) {
        context = getContext(tree);
        width = SynthIcon.getIconWidth(expandedIcon, context);
        context.dispose();
    }
    else {
        width = SynthIcon.getIconWidth(expandedIcon, context);
    }
    return width;
}
 
Example 21
Source Project: dragonwell8_jdk   Source File: SynthTreeUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
public int getIconHeight(SynthContext context) {
    int height;
    if (context == null) {
        context = getContext(tree);
        height = SynthIcon.getIconHeight(expandedIcon, context);
        context.dispose();
    }
    else {
        height = SynthIcon.getIconHeight(expandedIcon, context);
    }
    return height;
}
 
Example 22
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
    if (icon instanceof SynthIcon) {
        SynthIcon si = (SynthIcon)icon;
        BufferedImage img = EffectUtils.createCompatibleTranslucentImage(
                si.getIconWidth(), si.getIconHeight());
        Graphics2D gfx = img.createGraphics();
        si.paintIcon(component, gfx, 0, 0);
        gfx.dispose();
        return new ImageIconUIResource(GrayFilter.createDisabledImage(img));
    } else {
        return super.getDisabledIcon(component, icon);
    }
}
 
Example 23
Source Project: TencentKona-8   Source File: SynthTreeUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void drawCentered(Component c, Graphics graphics, Icon icon,
                            int x, int y) {
    int w = SynthIcon.getIconWidth(icon, paintContext);
    int h = SynthIcon.getIconHeight(icon, paintContext);

    SynthIcon.paintIcon(icon, paintContext, graphics,
                        findCenteredX(x, w),
                        y - h/2, w, h);
}
 
Example 24
Source Project: TencentKona-8   Source File: SynthTreeUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void paintIcon(SynthContext context, Graphics g, int x,
                      int y, int w, int h) {
    if (context == null) {
        context = getContext(tree);
        SynthIcon.paintIcon(expandedIcon, context, g, x, y, w, h);
        context.dispose();
    }
    else {
        SynthIcon.paintIcon(expandedIcon, context, g, x, y, w, h);
    }
}
 
Example 25
Source Project: TencentKona-8   Source File: SynthTreeUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
public int getIconWidth(SynthContext context) {
    int width;
    if (context == null) {
        context = getContext(tree);
        width = SynthIcon.getIconWidth(expandedIcon, context);
        context.dispose();
    }
    else {
        width = SynthIcon.getIconWidth(expandedIcon, context);
    }
    return width;
}
 
Example 26
Source Project: TencentKona-8   Source File: SynthTreeUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
public int getIconHeight(SynthContext context) {
    int height;
    if (context == null) {
        context = getContext(tree);
        height = SynthIcon.getIconHeight(expandedIcon, context);
        context.dispose();
    }
    else {
        height = SynthIcon.getIconHeight(expandedIcon, context);
    }
    return height;
}
 
Example 27
Source Project: jdk8u60   Source File: NimbusLookAndFeel.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
    if (icon instanceof SynthIcon) {
        SynthIcon si = (SynthIcon)icon;
        BufferedImage img = EffectUtils.createCompatibleTranslucentImage(
                si.getIconWidth(), si.getIconHeight());
        Graphics2D gfx = img.createGraphics();
        si.paintIcon(component, gfx, 0, 0);
        gfx.dispose();
        return new ImageIconUIResource(GrayFilter.createDisabledImage(img));
    } else {
        return super.getDisabledIcon(component, icon);
    }
}
 
Example 28
Source Project: openjdk-8   Source File: SynthTreeUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void drawCentered(Component c, Graphics graphics, Icon icon,
                            int x, int y) {
    int w = SynthIcon.getIconWidth(icon, paintContext);
    int h = SynthIcon.getIconHeight(icon, paintContext);

    SynthIcon.paintIcon(icon, paintContext, graphics,
                        findCenteredX(x, w),
                        y - h/2, w, h);
}
 
Example 29
Source Project: jdk8u60   Source File: SynthTreeUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void drawCentered(Component c, Graphics graphics, Icon icon,
                            int x, int y) {
    int w = SynthIcon.getIconWidth(icon, paintContext);
    int h = SynthIcon.getIconHeight(icon, paintContext);

    SynthIcon.paintIcon(icon, paintContext, graphics,
                        findCenteredX(x, w),
                        y - h/2, w, h);
}
 
Example 30
Source Project: jdk8u60   Source File: SynthTreeUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void paintIcon(SynthContext context, Graphics g, int x,
                      int y, int w, int h) {
    if (context == null) {
        context = getContext(tree);
        SynthIcon.paintIcon(expandedIcon, context, g, x, y, w, h);
        context.dispose();
    }
    else {
        SynthIcon.paintIcon(expandedIcon, context, g, x, y, w, h);
    }
}