Java Code Examples for com.sun.java.swing.plaf.windows.TMSchema.State

The following examples show how to use com.sun.java.swing.plaf.windows.TMSchema.State. 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
static void paintSkin(JComponent component, Skin skin,
                  Graphics g, int dx, int dy, int dw, int dh, State state) {
    if (VISTA_ANIMATION_DISABLED) {
        skin.paintSkinRaw(g, dx, dy, dw, dh, state);
        return;
    }
    triggerAnimation(component, skin.part, state);
    AnimationController controller = getAnimationController();
    synchronized (controller) {
        AnimationState animationState = null;
        Map<Part, AnimationState> map =
            controller.animationStateMap.get(component);
        if (map != null) {
            animationState = map.get(skin.part);
        }
        if (animationState != null) {
            animationState.paintSkin(skin, g, dx, dy, dw, dh, state);
        } else {
            skin.paintSkinRaw(g, dx, dy, dw, dh, state);
        }
    }
}
 
Example 2
void paintSkin(Skin skin, Graphics _g,
               int dx, int dy, int dw, int dh, State state) {
    assert SwingUtilities.isEventDispatchThread();

    updateProgress();
    if (! isDone()) {
        Graphics2D g = (Graphics2D) _g.create();
        skin.paintSkinRaw(g, dx, dy, dw, dh, startState);
        float alpha;
        if (isForward) {
            alpha = progress;
        } else {
            alpha = 1 - progress;
        }
        g.setComposite(AlphaComposite.SrcOver.derive(alpha));
        skin.paintSkinRaw(g, dx, dy, dw, dh, state);
        g.dispose();
    } else {
        skin.paintSkinRaw(_g, dx, dy, dw, dh, state);
    }
}
 
Example 3
void paintSkin(Skin skin, Graphics _g,
               int dx, int dy, int dw, int dh, State state) {
    assert SwingUtilities.isEventDispatchThread();

    updateProgress();
    if (! isDone()) {
        Graphics2D g = (Graphics2D) _g.create();
        skin.paintSkinRaw(g, dx, dy, dw, dh, startState);
        float alpha;
        if (isForward) {
            alpha = progress;
        } else {
            alpha = 1 - progress;
        }
        g.setComposite(AlphaComposite.SrcOver.derive(alpha));
        skin.paintSkinRaw(g, dx, dy, dw, dh, state);
        g.dispose();
    } else {
        skin.paintSkinRaw(_g, dx, dy, dw, dh, state);
    }
}
 
Example 4
static void paintSkin(JComponent component, Skin skin,
                  Graphics g, int dx, int dy, int dw, int dh, State state) {
    if (VISTA_ANIMATION_DISABLED) {
        skin.paintSkinRaw(g, dx, dy, dw, dh, state);
        return;
    }
    triggerAnimation(component, skin.part, state);
    AnimationController controller = getAnimationController();
    synchronized (controller) {
        AnimationState animationState = null;
        Map<Part, AnimationState> map =
            controller.animationStateMap.get(component);
        if (map != null) {
            animationState = map.get(skin.part);
        }
        if (animationState != null) {
            animationState.paintSkin(skin, g, dx, dy, dw, dh, state);
        } else {
            skin.paintSkinRaw(g, dx, dy, dw, dh, state);
        }
    }
}
 
Example 5
void paintSkin(Skin skin, Graphics _g,
               int dx, int dy, int dw, int dh, State state) {
    assert SwingUtilities.isEventDispatchThread();

    updateProgress();
    if (! isDone()) {
        Graphics2D g = (Graphics2D) _g.create();
        skin.paintSkinRaw(g, dx, dy, dw, dh, startState);
        float alpha;
        if (isForward) {
            alpha = progress;
        } else {
            alpha = 1 - progress;
        }
        g.setComposite(AlphaComposite.SrcOver.derive(alpha));
        skin.paintSkinRaw(g, dx, dy, dw, dh, state);
        g.dispose();
    } else {
        skin.paintSkinRaw(_g, dx, dy, dw, dh, state);
    }
}
 
Example 6
Source Project: jdk8u60   Source File: AnimationController.java    License: GNU General Public License v2.0 6 votes vote down vote up
static void paintSkin(JComponent component, Skin skin,
                  Graphics g, int dx, int dy, int dw, int dh, State state) {
    if (VISTA_ANIMATION_DISABLED) {
        skin.paintSkinRaw(g, dx, dy, dw, dh, state);
        return;
    }
    triggerAnimation(component, skin.part, state);
    AnimationController controller = getAnimationController();
    synchronized (controller) {
        AnimationState animationState = null;
        Map<Part, AnimationState> map =
            controller.animationStateMap.get(component);
        if (map != null) {
            animationState = map.get(skin.part);
        }
        if (animationState != null) {
            animationState.paintSkin(skin, g, dx, dy, dw, dh, state);
        } else {
            skin.paintSkinRaw(g, dx, dy, dw, dh, state);
        }
    }
}
 
Example 7
Source Project: jdk8u60   Source File: AnimationController.java    License: GNU General Public License v2.0 6 votes vote down vote up
void paintSkin(Skin skin, Graphics _g,
               int dx, int dy, int dw, int dh, State state) {
    assert SwingUtilities.isEventDispatchThread();

    updateProgress();
    if (! isDone()) {
        Graphics2D g = (Graphics2D) _g.create();
        skin.paintSkinRaw(g, dx, dy, dw, dh, startState);
        float alpha;
        if (isForward) {
            alpha = progress;
        } else {
            alpha = 1 - progress;
        }
        g.setComposite(AlphaComposite.SrcOver.derive(alpha));
        skin.paintSkinRaw(g, dx, dy, dw, dh, state);
        g.dispose();
    } else {
        skin.paintSkinRaw(_g, dx, dy, dw, dh, state);
    }
}
 
Example 8
void paintSkin(Skin skin, Graphics _g,
               int dx, int dy, int dw, int dh, State state) {
    assert SwingUtilities.isEventDispatchThread();

    updateProgress();
    if (! isDone()) {
        Graphics2D g = (Graphics2D) _g.create();
        skin.paintSkinRaw(g, dx, dy, dw, dh, startState);
        float alpha;
        if (isForward) {
            alpha = progress;
        } else {
            alpha = 1 - progress;
        }
        g.setComposite(AlphaComposite.SrcOver.derive(alpha));
        skin.paintSkinRaw(g, dx, dy, dw, dh, state);
        g.dispose();
    } else {
        skin.paintSkinRaw(_g, dx, dy, dw, dh, state);
    }
}
 
Example 9
Source Project: hottub   Source File: AnimationController.java    License: GNU General Public License v2.0 6 votes vote down vote up
void paintSkin(Skin skin, Graphics _g,
               int dx, int dy, int dw, int dh, State state) {
    assert SwingUtilities.isEventDispatchThread();

    updateProgress();
    if (! isDone()) {
        Graphics2D g = (Graphics2D) _g.create();
        skin.paintSkinRaw(g, dx, dy, dw, dh, startState);
        float alpha;
        if (isForward) {
            alpha = progress;
        } else {
            alpha = 1 - progress;
        }
        g.setComposite(AlphaComposite.SrcOver.derive(alpha));
        skin.paintSkinRaw(g, dx, dy, dw, dh, state);
        g.dispose();
    } else {
        skin.paintSkinRaw(_g, dx, dy, dw, dh, state);
    }
}
 
Example 10
static void paintSkin(JComponent component, Skin skin,
                  Graphics g, int dx, int dy, int dw, int dh, State state) {
    if (VISTA_ANIMATION_DISABLED) {
        skin.paintSkinRaw(g, dx, dy, dw, dh, state);
        return;
    }
    triggerAnimation(component, skin.part, state);
    AnimationController controller = getAnimationController();
    synchronized (controller) {
        AnimationState animationState = null;
        Map<Part, AnimationState> map =
            controller.animationStateMap.get(component);
        if (map != null) {
            animationState = map.get(skin.part);
        }
        if (animationState != null) {
            animationState.paintSkin(skin, g, dx, dy, dw, dh, state);
        } else {
            skin.paintSkinRaw(g, dx, dy, dw, dh, state);
        }
    }
}
 
Example 11
static void paintSkin(JComponent component, Skin skin,
                  Graphics g, int dx, int dy, int dw, int dh, State state) {
    if (VISTA_ANIMATION_DISABLED) {
        skin.paintSkinRaw(g, dx, dy, dw, dh, state);
        return;
    }
    triggerAnimation(component, skin.part, state);
    AnimationController controller = getAnimationController();
    synchronized (controller) {
        AnimationState animationState = null;
        Map<Part, AnimationState> map =
            controller.animationStateMap.get(component);
        if (map != null) {
            animationState = map.get(skin.part);
        }
        if (animationState != null) {
            animationState.paintSkin(skin, g, dx, dy, dw, dh, state);
        } else {
            skin.paintSkinRaw(g, dx, dy, dw, dh, state);
        }
    }
}
 
Example 12
void paintSkin(Skin skin, Graphics _g,
               int dx, int dy, int dw, int dh, State state) {
    assert SwingUtilities.isEventDispatchThread();

    updateProgress();
    if (! isDone()) {
        Graphics2D g = (Graphics2D) _g.create();
        skin.paintSkinRaw(g, dx, dy, dw, dh, startState);
        float alpha;
        if (isForward) {
            alpha = progress;
        } else {
            alpha = 1 - progress;
        }
        g.setComposite(AlphaComposite.SrcOver.derive(alpha));
        skin.paintSkinRaw(g, dx, dy, dw, dh, state);
        g.dispose();
    } else {
        skin.paintSkinRaw(_g, dx, dy, dw, dh, state);
    }
}
 
Example 13
private synchronized void startAnimation(JComponent component,
                                 Part part,
                                 State startState,
                                 State endState,
                                 long millis) {
    boolean isForwardAndReverse = false;
    if (endState == State.DEFAULTED) {
        isForwardAndReverse = true;
    }
    Map<Part, AnimationState> map = animationStateMap.get(component);
    if (millis <= 0) {
        if (map != null) {
            map.remove(part);
            if (map.size() == 0) {
                animationStateMap.remove(component);
            }
        }
        return;
    }
    if (map == null) {
        map = new EnumMap<Part, AnimationState>(Part.class);
        animationStateMap.put(component, map);
    }
    map.put(part,
            new AnimationState(startState, millis, isForwardAndReverse));
    if (! timer.isRunning()) {
        timer.start();
    }
}
 
Example 14
AnimationState(final State startState,
               final long milliseconds,
               boolean isForwardAndReverse) {
    assert startState != null && milliseconds > 0;
    assert SwingUtilities.isEventDispatchThread();

    this.startState = startState;
    this.duration = milliseconds * 1000000;
    this.startTime = System.nanoTime();
    this.isForwardAndReverse = isForwardAndReverse;
    progress = 0f;
}
 
Example 15
private synchronized void startAnimation(JComponent component,
                                 Part part,
                                 State startState,
                                 State endState,
                                 long millis) {
    boolean isForwardAndReverse = false;
    if (endState == State.DEFAULTED) {
        isForwardAndReverse = true;
    }
    Map<Part, AnimationState> map = animationStateMap.get(component);
    if (millis <= 0) {
        if (map != null) {
            map.remove(part);
            if (map.size() == 0) {
                animationStateMap.remove(component);
            }
        }
        return;
    }
    if (map == null) {
        map = new EnumMap<Part, AnimationState>(Part.class);
        animationStateMap.put(component, map);
    }
    map.put(part,
            new AnimationState(startState, millis, isForwardAndReverse));
    if (! timer.isRunning()) {
        timer.start();
    }
}
 
Example 16
AnimationState(final State startState,
               final long milliseconds,
               boolean isForwardAndReverse) {
    assert startState != null && milliseconds > 0;
    assert SwingUtilities.isEventDispatchThread();

    this.startState = startState;
    this.duration = milliseconds * 1000000;
    this.startTime = System.nanoTime();
    this.isForwardAndReverse = isForwardAndReverse;
    progress = 0f;
}
 
Example 17
@Override
public void paint(Graphics g, JComponent c) {
    XPStyle xp = XPStyle.getXP();
    if (WindowsMenuItemUI.isVistaPainting(xp)) {
        Skin skin = xp.getSkin(c, Part.MP_POPUPBACKGROUND);
        skin.paintSkin(g, 0, 0, c.getWidth(),c.getHeight(), State.NORMAL);
        int textOffset = getTextOffset(c);
        if (textOffset >= 0
                /* paint gutter only for leftToRight case */
                && isLeftToRight(c)) {
            skin = xp.getSkin(c, Part.MP_POPUPGUTTER);
            int gutterWidth = getGutterWidth();
            int gutterOffset =
                textOffset - getSpanAfterGutter() - gutterWidth;
            c.putClientProperty(GUTTER_OFFSET_KEY,
                Integer.valueOf(gutterOffset));
            Insets insets = c.getInsets();
            skin.paintSkin(g, gutterOffset, insets.top,
                gutterWidth, c.getHeight() - insets.bottom - insets.top,
                State.NORMAL);
        } else {
            if (c.getClientProperty(GUTTER_OFFSET_KEY) != null) {
                c.putClientProperty(GUTTER_OFFSET_KEY, null);
            }
        }
    } else {
        super.paint(g, c);
    }
}
 
Example 18
private synchronized void startAnimation(JComponent component,
                                 Part part,
                                 State startState,
                                 State endState,
                                 long millis) {
    boolean isForwardAndReverse = false;
    if (endState == State.DEFAULTED) {
        isForwardAndReverse = true;
    }
    Map<Part, AnimationState> map = animationStateMap.get(component);
    if (millis <= 0) {
        if (map != null) {
            map.remove(part);
            if (map.size() == 0) {
                animationStateMap.remove(component);
            }
        }
        return;
    }
    if (map == null) {
        map = new EnumMap<Part, AnimationState>(Part.class);
        animationStateMap.put(component, map);
    }
    map.put(part,
            new AnimationState(startState, millis, isForwardAndReverse));
    if (! timer.isRunning()) {
        timer.start();
    }
}
 
Example 19
@Override
public void paint(Graphics g, JComponent c) {
    XPStyle xp = XPStyle.getXP();
    if (WindowsMenuItemUI.isVistaPainting(xp)) {
        Skin skin = xp.getSkin(c, Part.MP_POPUPBACKGROUND);
        skin.paintSkin(g, 0, 0, c.getWidth(),c.getHeight(), State.NORMAL);
        int textOffset = getTextOffset(c);
        if (textOffset >= 0
                /* paint gutter only for leftToRight case */
                && isLeftToRight(c)) {
            skin = xp.getSkin(c, Part.MP_POPUPGUTTER);
            int gutterWidth = getGutterWidth();
            int gutterOffset =
                textOffset - getSpanAfterGutter() - gutterWidth;
            c.putClientProperty(GUTTER_OFFSET_KEY,
                Integer.valueOf(gutterOffset));
            Insets insets = c.getInsets();
            skin.paintSkin(g, gutterOffset, insets.top,
                gutterWidth, c.getHeight() - insets.bottom - insets.top,
                State.NORMAL);
        } else {
            if (c.getClientProperty(GUTTER_OFFSET_KEY) != null) {
                c.putClientProperty(GUTTER_OFFSET_KEY, null);
            }
        }
    } else {
        super.paint(g, c);
    }
}
 
Example 20
AnimationState(final State startState,
               final long milliseconds,
               boolean isForwardAndReverse) {
    assert startState != null && milliseconds > 0;
    assert SwingUtilities.isEventDispatchThread();

    this.startState = startState;
    this.duration = milliseconds * 1000000;
    this.startTime = System.nanoTime();
    this.isForwardAndReverse = isForwardAndReverse;
    progress = 0f;
}
 
Example 21
@Override
public void paint(Graphics g, JComponent c) {
    XPStyle xp = XPStyle.getXP();
    if (WindowsMenuItemUI.isVistaPainting(xp)) {
        Skin skin = xp.getSkin(c, Part.MP_POPUPBACKGROUND);
        skin.paintSkin(g, 0, 0, c.getWidth(),c.getHeight(), State.NORMAL);
        int textOffset = getTextOffset(c);
        if (textOffset >= 0
                /* paint gutter only for leftToRight case */
                && isLeftToRight(c)) {
            skin = xp.getSkin(c, Part.MP_POPUPGUTTER);
            int gutterWidth = getGutterWidth();
            int gutterOffset =
                textOffset - getSpanAfterGutter() - gutterWidth;
            c.putClientProperty(GUTTER_OFFSET_KEY,
                Integer.valueOf(gutterOffset));
            Insets insets = c.getInsets();
            skin.paintSkin(g, gutterOffset, insets.top,
                gutterWidth, c.getHeight() - insets.bottom - insets.top,
                State.NORMAL);
        } else {
            if (c.getClientProperty(GUTTER_OFFSET_KEY) != null) {
                c.putClientProperty(GUTTER_OFFSET_KEY, null);
            }
        }
    } else {
        super.paint(g, c);
    }
}
 
Example 22
AnimationState(final State startState,
               final long milliseconds,
               boolean isForwardAndReverse) {
    assert startState != null && milliseconds > 0;
    assert SwingUtilities.isEventDispatchThread();

    this.startState = startState;
    this.duration = milliseconds * 1000000;
    this.startTime = System.nanoTime();
    this.isForwardAndReverse = isForwardAndReverse;
    progress = 0f;
}
 
Example 23
AnimationState(final State startState,
               final long milliseconds,
               boolean isForwardAndReverse) {
    assert startState != null && milliseconds > 0;
    assert SwingUtilities.isEventDispatchThread();

    this.startState = startState;
    this.duration = milliseconds * 1000000;
    this.startTime = System.nanoTime();
    this.isForwardAndReverse = isForwardAndReverse;
    progress = 0f;
}
 
Example 24
AnimationState(final State startState,
               final long milliseconds,
               boolean isForwardAndReverse) {
    assert startState != null && milliseconds > 0;
    assert SwingUtilities.isEventDispatchThread();

    this.startState = startState;
    this.duration = milliseconds * 1000000;
    this.startTime = System.nanoTime();
    this.isForwardAndReverse = isForwardAndReverse;
    progress = 0f;
}
 
Example 25
Source Project: jdk8u60   Source File: WindowsPopupMenuUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public void paint(Graphics g, JComponent c) {
    XPStyle xp = XPStyle.getXP();
    if (WindowsMenuItemUI.isVistaPainting(xp)) {
        Skin skin = xp.getSkin(c, Part.MP_POPUPBACKGROUND);
        skin.paintSkin(g, 0, 0, c.getWidth(),c.getHeight(), State.NORMAL);
        int textOffset = getTextOffset(c);
        if (textOffset >= 0
                /* paint gutter only for leftToRight case */
                && isLeftToRight(c)) {
            skin = xp.getSkin(c, Part.MP_POPUPGUTTER);
            int gutterWidth = getGutterWidth();
            int gutterOffset =
                textOffset - getSpanAfterGutter() - gutterWidth;
            c.putClientProperty(GUTTER_OFFSET_KEY,
                Integer.valueOf(gutterOffset));
            Insets insets = c.getInsets();
            skin.paintSkin(g, gutterOffset, insets.top,
                gutterWidth, c.getHeight() - insets.bottom - insets.top,
                State.NORMAL);
        } else {
            if (c.getClientProperty(GUTTER_OFFSET_KEY) != null) {
                c.putClientProperty(GUTTER_OFFSET_KEY, null);
            }
        }
    } else {
        super.paint(g, c);
    }
}
 
Example 26
Source Project: openjdk-8   Source File: WindowsPopupMenuUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public void paint(Graphics g, JComponent c) {
    if (WindowsMenuItemUI.isVistaPainting()) {
        XPStyle xp = XPStyle.getXP();
        Skin skin = xp.getSkin(c, Part.MP_POPUPBACKGROUND);
        skin.paintSkin(g, 0, 0, c.getWidth(),c.getHeight(), State.NORMAL);
        int textOffset = getTextOffset(c);
        if (textOffset >= 0
                /* paint gutter only for leftToRight case */
                && isLeftToRight(c)) {
            skin = xp.getSkin(c, Part.MP_POPUPGUTTER);
            int gutterWidth = getGutterWidth();
            int gutterOffset =
                textOffset - getSpanAfterGutter() - gutterWidth;
            c.putClientProperty(GUTTER_OFFSET_KEY,
                Integer.valueOf(gutterOffset));
            Insets insets = c.getInsets();
            skin.paintSkin(g, gutterOffset, insets.top,
                gutterWidth, c.getHeight() - insets.bottom - insets.top,
                State.NORMAL);
        } else {
            if (c.getClientProperty(GUTTER_OFFSET_KEY) != null) {
                c.putClientProperty(GUTTER_OFFSET_KEY, null);
            }
        }
    } else {
        super.paint(g, c);
    }
}
 
Example 27
Source Project: JDKSourceCode1.8   Source File: WindowsPopupMenuUI.java    License: MIT License 5 votes vote down vote up
@Override
public void paint(Graphics g, JComponent c) {
    XPStyle xp = XPStyle.getXP();
    if (WindowsMenuItemUI.isVistaPainting(xp)) {
        Skin skin = xp.getSkin(c, Part.MP_POPUPBACKGROUND);
        skin.paintSkin(g, 0, 0, c.getWidth(),c.getHeight(), State.NORMAL);
        int textOffset = getTextOffset(c);
        if (textOffset >= 0
                /* paint gutter only for leftToRight case */
                && isLeftToRight(c)) {
            skin = xp.getSkin(c, Part.MP_POPUPGUTTER);
            int gutterWidth = getGutterWidth();
            int gutterOffset =
                textOffset - getSpanAfterGutter() - gutterWidth;
            c.putClientProperty(GUTTER_OFFSET_KEY,
                Integer.valueOf(gutterOffset));
            Insets insets = c.getInsets();
            skin.paintSkin(g, gutterOffset, insets.top,
                gutterWidth, c.getHeight() - insets.bottom - insets.top,
                State.NORMAL);
        } else {
            if (c.getClientProperty(GUTTER_OFFSET_KEY) != null) {
                c.putClientProperty(GUTTER_OFFSET_KEY, null);
            }
        }
    } else {
        super.paint(g, c);
    }
}
 
Example 28
Source Project: jdk8u_jdk   Source File: WindowsPopupMenuUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public void paint(Graphics g, JComponent c) {
    XPStyle xp = XPStyle.getXP();
    if (WindowsMenuItemUI.isVistaPainting(xp)) {
        Skin skin = xp.getSkin(c, Part.MP_POPUPBACKGROUND);
        skin.paintSkin(g, 0, 0, c.getWidth(),c.getHeight(), State.NORMAL);
        int textOffset = getTextOffset(c);
        if (textOffset >= 0
                /* paint gutter only for leftToRight case */
                && isLeftToRight(c)) {
            skin = xp.getSkin(c, Part.MP_POPUPGUTTER);
            int gutterWidth = getGutterWidth();
            int gutterOffset =
                textOffset - getSpanAfterGutter() - gutterWidth;
            c.putClientProperty(GUTTER_OFFSET_KEY,
                Integer.valueOf(gutterOffset));
            Insets insets = c.getInsets();
            skin.paintSkin(g, gutterOffset, insets.top,
                gutterWidth, c.getHeight() - insets.bottom - insets.top,
                State.NORMAL);
        } else {
            if (c.getClientProperty(GUTTER_OFFSET_KEY) != null) {
                c.putClientProperty(GUTTER_OFFSET_KEY, null);
            }
        }
    } else {
        super.paint(g, c);
    }
}
 
Example 29
private static void triggerAnimation(JComponent c,
                       Part part, State newState) {
    if (c instanceof javax.swing.JTabbedPane
        || part == Part.TP_BUTTON) {
        //idk: we can not handle tabs animation because
        //the same (component,part) is used to handle all the tabs
        //and we can not track the states
        //Vista theme might have transition duration for toolbar buttons
        //but native application does not seem to animate them
        return;
    }
    AnimationController controller =
        AnimationController.getAnimationController();
    State oldState = controller.getState(c, part);
    if (oldState != newState) {
        controller.putState(c, part, newState);
        if (newState == State.DEFAULTED) {
            // it seems for DEFAULTED button state Vista does animation from
            // HOT
            oldState = State.HOT;
        }
        if (oldState != null) {
            long duration;
            if (newState == State.DEFAULTED) {
                //Only button might have DEFAULTED state
                //idk: do not know how to get the value from Vista
                //one second seems plausible value
                duration = 1000;
            } else {
                 duration = XPStyle.getXP().getThemeTransitionDuration(
                       c, part,
                       normalizeState(oldState),
                       normalizeState(newState),
                       Prop.TRANSITIONDURATIONS);
            }
            controller.startAnimation(c, part, oldState, newState, duration);
        }
    }
}
 
Example 30
@Override
public void paint(Graphics g, JComponent c) {
    XPStyle xp = XPStyle.getXP();
    if (WindowsMenuItemUI.isVistaPainting(xp)) {
        Skin skin = xp.getSkin(c, Part.MP_POPUPBACKGROUND);
        skin.paintSkin(g, 0, 0, c.getWidth(),c.getHeight(), State.NORMAL);
        int textOffset = getTextOffset(c);
        if (textOffset >= 0
                /* paint gutter only for leftToRight case */
                && isLeftToRight(c)) {
            skin = xp.getSkin(c, Part.MP_POPUPGUTTER);
            int gutterWidth = getGutterWidth();
            int gutterOffset =
                textOffset - getSpanAfterGutter() - gutterWidth;
            c.putClientProperty(GUTTER_OFFSET_KEY,
                Integer.valueOf(gutterOffset));
            Insets insets = c.getInsets();
            skin.paintSkin(g, gutterOffset, insets.top,
                gutterWidth, c.getHeight() - insets.bottom - insets.top,
                State.NORMAL);
        } else {
            if (c.getClientProperty(GUTTER_OFFSET_KEY) != null) {
                c.putClientProperty(GUTTER_OFFSET_KEY, null);
            }
        }
    } else {
        super.paint(g, c);
    }
}