FileDocCategorySizeDatePackage
GTKIconFactory.javaAPI DocJava SE 5 API15932Fri Aug 26 14:54:44 BST 2005com.sun.java.swing.plaf.gtk

GTKIconFactory

public class GTKIconFactory extends Object
version
1.23, 12/19/03

Fields Summary
private static SynthIcon
expandedIcon
private static SynthIcon
collapsedIcon
private static SynthIcon
radioButtonIcon
private static SynthIcon
checkBoxIcon
private static SynthIcon
menuArrowIcon
private static SynthIcon
menuCheckIcon
private static SynthIcon
menuItemArrowIcon
private static SynthIcon
menuItemCheckIcon
private static SynthIcon
checkBoxMenuItemArrowIcon
private static SynthIcon
checkBoxMenuItemCheckIcon
private static SynthIcon
radioButtonMenuItemArrowIcon
private static SynthIcon
radioButtonMenuItemCheckIcon
Constructors Summary
Methods Summary
public static javax.swing.plaf.synth.SynthIcongetCheckBoxIcon()

        if (checkBoxIcon == null) {
            checkBoxIcon = new DelegatingIcon("paintCheckBoxIcon", 13, 13);
        }
        return checkBoxIcon;
    
public static javax.swing.plaf.synth.SynthIcongetCheckBoxMenuItemArrowIcon()

        if (checkBoxMenuItemArrowIcon == null) {
            checkBoxMenuItemArrowIcon = new DelegatingIcon(
                "paintCheckBoxMenuItemArrowIcon", 13, 13);
        }
        return checkBoxMenuItemArrowIcon;
    
public static javax.swing.plaf.synth.SynthIcongetCheckBoxMenuItemCheckIcon()

        if (checkBoxMenuItemCheckIcon == null) {
            checkBoxMenuItemCheckIcon = new DelegatingIcon(
                "paintCheckBoxMenuItemCheckIcon", 13, 13);
        }
        return checkBoxMenuItemCheckIcon;
    
public static javax.swing.plaf.synth.SynthIcongetMenuArrowIcon()

        if (menuArrowIcon == null) {
            menuArrowIcon = new DelegatingIcon("paintMenuArrowIcon", 13, 13);
        }
        return menuArrowIcon;
    
public static javax.swing.plaf.synth.SynthIcongetMenuItemArrowIcon()

        if (menuItemArrowIcon == null) {
            menuItemArrowIcon = new DelegatingIcon("paintMenuItemArrowIcon",
                                                   13, 13);
        }
        return menuItemArrowIcon;
    
public static javax.swing.plaf.synth.SynthIcongetRadioButtonIcon()

        if (radioButtonIcon == null) {
            radioButtonIcon = new DelegatingIcon("paintRadioButtonIcon",
                                                 13, 13);
        }
        return radioButtonIcon;
    
public static javax.swing.plaf.synth.SynthIcongetRadioButtonMenuItemArrowIcon()

        if (radioButtonMenuItemArrowIcon == null) {
            radioButtonMenuItemArrowIcon = new DelegatingIcon(
                "paintRadioButtonMenuItemArrowIcon", 13, 13);
        }
        return radioButtonMenuItemArrowIcon;
    
public static javax.swing.plaf.synth.SynthIcongetRadioButtonMenuItemCheckIcon()

        if (radioButtonMenuItemCheckIcon == null) {
            radioButtonMenuItemCheckIcon = new DelegatingIcon(
                "paintRadioButtonMenuItemCheckIcon", 13, 13);
        }
        return radioButtonMenuItemCheckIcon;
    
public static javax.swing.plaf.synth.SynthIcongetToolBarHandleIcon()

        return new ToolBarHandleIcon();
    
public static javax.swing.plaf.synth.SynthIcongetTreeCollapsedIcon()

        if (collapsedIcon == null) {
            collapsedIcon =
                new SynthExpanderIcon("paintTreeCollapsedIcon");
        }
        return collapsedIcon;
    
public static javax.swing.plaf.synth.SynthIcongetTreeExpandedIcon()

        if (expandedIcon == null) {
            expandedIcon =
                new SynthExpanderIcon("paintTreeExpandedIcon");
        }
        return expandedIcon;
    
public static voidpaintCheckBoxIcon(javax.swing.plaf.synth.SynthContext context, java.awt.Graphics g, int x, int y, int w, int h)

        GTKStyle style = (GTKStyle)context.getStyle();
        int state = context.getComponentState();
        int shadowType = GTKConstants.SHADOW_OUT;
        if (((JCheckBox)context.getComponent()).isSelected()) {
            shadowType = GTKConstants.SHADOW_IN;
        }
        ((GTKStyle)context.getStyle()).getEngine(
                context).paintCheck(context, g,
                GTKLookAndFeel.synthStateToGTKState(context.getRegion(),
                context.getComponentState()), shadowType, "checkbutton",
                x, y, w, h);
    
public static voidpaintCheckBoxMenuItemArrowIcon(javax.swing.plaf.synth.SynthContext context, java.awt.Graphics g, int x, int y, int w, int h)

        // Don't paint anything.  We are just reserving space so we align the
        // menu items correctly.
    
public static voidpaintCheckBoxMenuItemCheckIcon(javax.swing.plaf.synth.SynthContext context, java.awt.Graphics g, int x, int y, int w, int h)

        GTKStyle style = (GTKStyle)context.getStyle();
        int state = context.getComponentState();
        int shadowType = GTKConstants.SHADOW_OUT;
        int gtkState = GTKLookAndFeel.synthStateToGTKState(
                                      context.getRegion(), state);
        if ((state & SynthConstants.MOUSE_OVER) != 0) {
            gtkState = SynthConstants.MOUSE_OVER;
        }
        if ((state & SynthConstants.SELECTED) != 0) {
            shadowType = GTKConstants.SHADOW_IN;
        }
        style.getEngine(context).paintCheck(context, g, gtkState,
                    shadowType, "check", x, y, w, h);
    
public static voidpaintMenuArrowIcon(javax.swing.plaf.synth.SynthContext context, java.awt.Graphics g, int x, int y, int w, int h)

        GTKStyle style = (GTKStyle)context.getStyle();
        int gtkState = GTKLookAndFeel.synthStateToGTKState(
                context.getRegion(), context.getComponentState());
        int shadow = GTKConstants.SHADOW_OUT;
        if (gtkState == SynthConstants.MOUSE_OVER) {
            shadow = GTKConstants.SHADOW_IN;
        }
        int arrowDir;
        if (context.getComponent().getComponentOrientation().isLeftToRight()) {
            arrowDir = GTKConstants.ARROW_RIGHT;
        }
        else {
            arrowDir = GTKConstants.ARROW_LEFT;
        }
        style.getEngine(context).paintArrow(context, g, gtkState,
             shadow, arrowDir, "menuitem", x + 3, y + 3, 7, 7);
    
public static voidpaintMenuItemArrowIcon(javax.swing.plaf.synth.SynthContext context, java.awt.Graphics g, int x, int y, int w, int h)

        // Don't paint anything.  We are just reserving space so we align the
        // menu items correctly.
    
public static voidpaintRadioButtonIcon(javax.swing.plaf.synth.SynthContext context, java.awt.Graphics g, int x, int y, int w, int h)

        GTKStyle style = (GTKStyle)context.getStyle();
        int state = context.getComponentState();
        int gtkState = GTKLookAndFeel.synthStateToGTKState(context.getRegion(),
                                                           state);
        int shadowType = GTKConstants.SHADOW_OUT;
        // RadioButton painting appears to be special cased to pass
        // SELECTED into the engine even though text colors are PRESSED.
        if ((state & SynthConstants.SELECTED) != 0) {
            gtkState = SynthConstants.SELECTED;
        }
        if (gtkState == SynthConstants.SELECTED) {
            shadowType = GTKConstants.SHADOW_IN;
        }
        ((GTKStyle)context.getStyle()).getEngine(
                context).paintOption(context, g, gtkState, shadowType,
                    "radiobutton", x, y, w, h);
    
public static voidpaintRadioButtonMenuItemArrowIcon(javax.swing.plaf.synth.SynthContext context, java.awt.Graphics g, int x, int y, int w, int h)

        // Don't paint anything.  We are just reserving space so we align the
        // menu items correctly.
    
public static voidpaintRadioButtonMenuItemCheckIcon(javax.swing.plaf.synth.SynthContext context, java.awt.Graphics g, int x, int y, int w, int h)

        GTKStyle style = (GTKStyle)context.getStyle();
        int state = context.getComponentState();
        int gtkState = GTKLookAndFeel.synthStateToGTKState(
                                      context.getRegion(), state);
        if ((state & SynthConstants.MOUSE_OVER) != 0) {
            gtkState = SynthConstants.MOUSE_OVER;
        }
        int shadowType = GTKConstants.SHADOW_OUT;
        if ((state & SynthConstants.SELECTED) != 0) {
            shadowType = GTKConstants.SHADOW_IN;
        }
        ((GTKStyle)context.getStyle()).getEngine(
                context).paintOption(context, g, gtkState, shadowType,
                    "option", x, y, w, h);
    
public static voidpaintToolBarHandleIcon(javax.swing.plaf.synth.SynthContext context, java.awt.Graphics g, int x, int y, int w, int h)

        int orientation =
            ((JToolBar)context.getComponent()).getOrientation() ==
                JToolBar.HORIZONTAL ?
                    GTKConstants.HORIZONTAL : GTKConstants.VERTICAL;
        GTKStyle style = (GTKStyle)context.getStyle();
        int gtkState = GTKLookAndFeel.synthStateToGTKState(
                context.getRegion(), context.getComponentState());
        style.getEngine(context).paintHandle(context, g, gtkState,
                    GTKConstants.SHADOW_OUT, "handlebox", x, y, w, h,
                    orientation);
    
public static voidpaintTreeCollapsedIcon(javax.swing.plaf.synth.SynthContext context, java.awt.Graphics g, int x, int y, int w, int h)

        ((GTKStyle)context.getStyle()).getEngine(context).paintExpander(
               context, g, GTKLookAndFeel.synthStateToGTKState(
               context.getRegion(), context.getComponentState()),
               GTKConstants.EXPANDER_COLLAPSED, "treeview", x, y, w, h);
    
public static voidpaintTreeExpandedIcon(javax.swing.plaf.synth.SynthContext context, java.awt.Graphics g, int x, int y, int w, int h)

        ((GTKStyle)context.getStyle()).getEngine(context).paintExpander(
               context, g, GTKLookAndFeel.synthStateToGTKState(
               context.getRegion(), context.getComponentState()),
               GTKConstants.EXPANDER_EXPANDED, "treeview", x, y, w, h);