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(); } }