org.jdesktop.animation.timing.Animator Java Examples
The following examples show how to use
org.jdesktop.animation.timing.Animator.
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 File: AnimatingSplitPane.java From Darcula with Apache License 2.0 | 6 votes |
public void setExpanded(boolean expanded) { if (expanded != firstExpanded) { if (!firstExpanded) { lastDividerLocation = getDividerLocation(); } this.firstExpanded = expanded; Animator animator = new Animator(500, new PropertySetter(this, "dividerLocation", getDividerLocation(), (expanded? getHeight() : lastDividerLocation))); animator.setStartDelay(10); animator.setAcceleration(.2f); animator.setDeceleration(.3f); animator.start(); } }
Example #2
Source File: AnimationUtils.java From ghidra with Apache License 2.0 | 6 votes |
public static Animator createPaintingAnimator(Component window, AnimationPainter painter) { if (!animationEnabled) { return null; } Component paneComponent = getGlassPane(window); if (paneComponent == null) { // could happen if the given component has not yet been realized return null; } if (!(paneComponent instanceof GGlassPane)) { Msg.debug(AnimationUtils.class, "Cannot animate without a " + GGlassPane.class.getName() + " installed"); return null; // shouldn't happen } GGlassPane glassPane = (GGlassPane) paneComponent; BasicAnimationDriver driver = new BasicAnimationDriver(glassPane, new UserDefinedPainter(painter)); return driver.animator; }
Example #3
Source File: DockableHeader.java From ghidra with Apache License 2.0 | 6 votes |
private Animator emphasizeDockableComponent() { ComponentPlaceholder placeholder = dockComp.getComponentWindowingPlaceholder(); ComponentNode node = placeholder.getNode(); WindowNode windowNode = node.getTopLevelNode(); Set<ComponentNode> componentNodes = new HashSet<>(); getComponents(windowNode, componentNodes); //@formatter:off Set<Component> components = componentNodes.stream() .map(cn -> cn.getComponent()) .filter(c -> c != null) .filter(c -> !SwingUtilities.isDescendingFrom(component, c)) .collect(Collectors.toSet()) ; //@formatter:on components.remove(component); EmphasizeDockableComponentAnimationDriver driver = new EmphasizeDockableComponentAnimationDriver(component, components); return driver.animator; }
Example #4
Source File: AnimationUtils.java From ghidra with Apache License 2.0 | 6 votes |
public static Animator transitionFromComponentToComponent(Component fromComponent, Component toComponent) { if (!animationEnabled) { return null; } if (!componentsAreInTheSameWindow(fromComponent, toComponent)) { throw new IllegalArgumentException( "The fromComponent and the component to focus " + "must be in the same window"); } GGlassPane glassPane = getGlassPane(fromComponent); if (glassPane == null) { // could happen if the given component has not yet been realized return null; } ComponentToComponentDriver driver = new ComponentToComponentDriver(glassPane, fromComponent, toComponent); return driver.animator; }
Example #5
Source File: RelayoutFunctionGraphJob.java From ghidra with Apache License 2.0 | 6 votes |
@Override protected Animator createAnimator() { initializeVertexLocations(); clearLocationCache(); if (!useAnimation) { return null; } updateOpacity(0); Animator newAnimator = PropertySetter.createAnimator(duration, this, "percentComplete", 0.0, 1.0); newAnimator.setAcceleration(0f); newAnimator.setDeceleration(0.8f); return newAnimator; }
Example #6
Source File: AbstractGraphVisibilityTransitionJob.java From ghidra with Apache License 2.0 | 6 votes |
@Override protected Animator createAnimator() { if (!useAnimation) { return null; } updateOpacity(0); Animator newAnimator = PropertySetter.createAnimator(duration, this, "percentComplete", 0.0, 1.0); newAnimator.setAcceleration(0f); newAnimator.setDeceleration(0.8f); return newAnimator; }
Example #7
Source File: SplitVertexFunctionGraphJob.java From ghidra with Apache License 2.0 | 6 votes |
@Override protected Animator createAnimator() { // don't paint these vertices initially parentVertex.setAlpha(0D); childVertex.setAlpha(0D); initializeVertexLocations(); if (!useAnimation) { return null; } updateOpacity(0); Animator newAnimator = PropertySetter.createAnimator(DURATION, this, "percentComplete", 0.0, 1.0); newAnimator.setAcceleration(0f); newAnimator.setDeceleration(0.8f); return newAnimator; }
Example #8
Source File: Stacker.java From littleluck with Apache License 2.0 | 6 votes |
/** * Fades out and removes the current message component */ public void hideMessageLayer() { if (messageLayer != null && messageLayer.isShowing()) { Animator animator = new Animator(500, new PropertySetter(messageAlpha, "alpha", messageAlpha.getAlpha(), 0.0f) { public void end() { remove(messageLayer); revalidate(); } }); animator.setStartDelay(300); animator.setAcceleration(.2f); animator.setDeceleration(.5f); animator.start(); } }
Example #9
Source File: DockableHeader.java From ghidra with Apache License 2.0 | 6 votes |
protected Animator createEmphasizingAnimator(JFrame parentFrame) { double random = Math.random(); int choices = 7; int value = (int) (choices * random); switch (value) { case 0: return AnimationUtils.shakeComponent(component); case 1: return AnimationUtils.rotateComponent(component); case 2: return AnimationUtils.pulseComponent(component); case 3: return AnimationUtils.showTheDragonOverComponent(component); case 4: return AnimationUtils.focusComponent(component); case 5: return emphasizeDockableComponent(); default: return raiseComponent(parentFrame); } }
Example #10
Source File: AnimatingSplitPane.java From beautyeye with Apache License 2.0 | 6 votes |
public void setExpanded(boolean expanded) { if (expanded != firstExpanded) { if (!firstExpanded) { lastDividerLocation = getDividerLocation(); } this.firstExpanded = expanded; Animator animator = new Animator(500, new PropertySetter(this, "dividerLocation", getDividerLocation(), (expanded? getHeight() : lastDividerLocation))); animator.setStartDelay(10); animator.setAcceleration(.2f); animator.setDeceleration(.3f); animator.start(); } }
Example #11
Source File: PulseFieldDemo.java From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License | 6 votes |
private JComponent buildPulsatingField() { JTextField field = new JTextField(20); PulsatingBorder border = new PulsatingBorder(field); field.setBorder(new CompoundBorder(field.getBorder(), border)); PropertySetter setter = new PropertySetter( border, "thickness", 0.0f, 1.0f); Animator animator = new Animator(900, Animator.INFINITE, Animator.RepeatBehavior.REVERSE, setter); animator.start(); JPanel panel = new JPanel(new FlowLayout()); panel.add(field); panel.add(new JButton("OK")); panel.add(new JButton("Cancel")); return panel; }
Example #12
Source File: FadingDemo.java From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License | 6 votes |
public static void setTextAndAnimate(final JTextComponent textComponent, final String text) { Color c = textComponent.getForeground(); KeyFrames keyFrames = new KeyFrames(KeyValues.create( new Color(c.getRed(), c.getGreen(), c.getBlue(), 255), new Color(c.getRed(), c.getGreen(), c.getBlue(), 0), new Color(c.getRed(), c.getGreen(), c.getBlue(), 255) )); PropertySetter setter = new PropertySetter(textComponent, "foreground", keyFrames); Animator animator = new Animator(200, setter); animator.addTarget(new TimingTargetAdapter() { private boolean textSet = false; public void timingEvent(float fraction) { if (fraction >= 0.5f && !textSet) { textComponent.setText(text); textSet = true; } } }); animator.start(); }
Example #13
Source File: FadingDemo.java From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License | 6 votes |
private HelpGlassPane() { try { helpImage = GraphicsUtilities.loadCompatibleImage( getClass().getResource("images/help.png")); } catch (IOException ex) { ex.printStackTrace(); } addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { Animator animator = new Animator(200); animator.addTarget(new PropertySetter( HelpGlassPane.this, "alpha", 0.0f)); animator.setAcceleration(0.2f); animator.setDeceleration(0.4f); animator.start(); } }); }
Example #14
Source File: MotionDemo.java From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void configureAnimations() { Animator leftAnimator = new Animator(200); leftAnimator.setAcceleration(0.3f); leftAnimator.setDeceleration(0.2f); leftAnimator.addTarget(new PropertySetter( saveButton, "location", new Point(16, 16))); leftAnimator.addTarget(new PropertySetter( openButton, "location", new Point(16, openButton.getY()))); leftAnimator.addTarget(new PropertySetter( textArea, "location", new Point(16 + saveButton.getWidth() + 6, 16))); ActionTrigger.addTrigger(leftLayoutButton, leftAnimator); Animator rightAnimator = new Animator(200); rightAnimator.setAcceleration(0.3f); rightAnimator.setDeceleration(0.2f); rightAnimator.addTarget(new PropertySetter( saveButton, "location", saveButton.getLocation())); rightAnimator.addTarget(new PropertySetter( openButton, "location", openButton.getLocation())); rightAnimator.addTarget(new PropertySetter( textArea, "location", textArea.getLocation())); ActionTrigger.addTrigger(rightLayoutButton, rightAnimator); }
Example #15
Source File: Stacker.java From Darcula with Apache License 2.0 | 6 votes |
/** * Fades out and removes the current message component */ public void hideMessageLayer() { if (messageLayer != null && messageLayer.isShowing()) { Animator animator = new Animator(500, new PropertySetter(messageAlpha, "alpha", messageAlpha.getAlpha(), 0.0f) { public void end() { remove(messageLayer); revalidate(); } }); animator.setStartDelay(300); animator.setAcceleration(.2f); animator.setDeceleration(.5f); animator.start(); } }
Example #16
Source File: AnimatingSplitPane.java From littleluck with Apache License 2.0 | 6 votes |
public void setExpanded(boolean expanded) { if (expanded != firstExpanded) { if (!firstExpanded) { lastDividerLocation = getDividerLocation(); } this.firstExpanded = expanded; Animator animator = new Animator(500, new PropertySetter(this, "dividerLocation", getDividerLocation(), (expanded? getHeight() : lastDividerLocation))); animator.setStartDelay(10); animator.setAcceleration(.2f); animator.setDeceleration(.3f); animator.start(); } }
Example #17
Source File: Stacker.java From beautyeye with Apache License 2.0 | 6 votes |
/** * Fades out and removes the current message component */ public void hideMessageLayer() { if (messageLayer != null && messageLayer.isShowing()) { Animator animator = new Animator(500, new PropertySetter(messageAlpha, "alpha", messageAlpha.getAlpha(), 0.0f) { public void end() { remove(messageLayer); revalidate(); } }); animator.setStartDelay(300); animator.setAcceleration(.2f); animator.setDeceleration(.5f); animator.start(); } }
Example #18
Source File: IntroPanel.java From Darcula with Apache License 2.0 | 5 votes |
public void slideTextIn() { Animator animator = new Animator(800, new PropertySetter(introText, "x", getWidth(), 30)); animator.setStartDelay(800); animator.setAcceleration(.2f); animator.setDeceleration(.5f); animator.start(); }
Example #19
Source File: FadingDemo.java From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void next() { Animator animator = new Animator(1000); animator.addTarget(new PropertySetter(this, "alpha", 1.0f)); animator.setAcceleration(0.2f); animator.setDeceleration(0.4f); animator.start(); }
Example #20
Source File: DialogComponentProvider.java From ghidra with Apache License 2.0 | 5 votes |
private void doAlertMessage(Callback alertFinishedCallback) { // must be on Swing; this allows us to synchronize the 'alerting' flag SystemUtilities.assertThisIsTheSwingThread( "Alerting must be performed on the Swing thread"); if (isAlerting) { return; } isAlerting = true; // Note: manually call validate() so the 'statusLabel' updates its bounds after // the text has been setStatusText() (validation is buffered which means the // normal Swing mechanism may not have yet happened). mainPanel.validate(); statusLabel.setVisible(false); // disable painting in this dialog so we don't see double Animator animator = AnimationUtils.pulseComponent(statusLabel, 1); animator.addTarget(new TimingTargetAdapter() { @Override public void end() { statusLabel.setVisible(true); alertFinishedCallback.call(); isAlerting = false; } }); }
Example #21
Source File: AnimationUtils.java From ghidra with Apache License 2.0 | 5 votes |
/** * Focuses the current component by graying out all other components but the given one and * bringing that component to the middle of the screen. * * @param component The component to focus * @return the new animator */ public static Animator focusComponent(Component component) { if (!animationEnabled) { return null; } GGlassPane glassPane = getGlassPane(component); if (glassPane == null) { // could happen if the given component has not yet been realized return null; } FocusDriver driver = new FocusDriver(glassPane, component); return driver.animator; }
Example #22
Source File: AnimationUtils.java From ghidra with Apache License 2.0 | 5 votes |
public static Animator transitionUserFocusToComponent(Component activeComponent, Component toFocusComponent) { if (!animationEnabled) { return null; } if (activeComponent == null) { // this can happen in the testing environment Msg.error(AnimationUtils.class, "No active component for animation!"); return null; } if (!componentsAreInTheSameWindow(activeComponent, toFocusComponent)) { throw new IllegalArgumentException( "The active component and the component to focus must be in the same window"); } GGlassPane glassPane = getGlassPane(activeComponent); if (glassPane == null) { // could happen if the given component has not yet been realized return null; } PointToComponentDriver driver = new PointToComponentDriver(glassPane, activeComponent, toFocusComponent); return driver.animator; }
Example #23
Source File: MorphingDemo.java From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void previous() { Animator animator = new Animator(500); animator.addTarget(new PropertySetter(this, "alpha", 0.0f)); animator.setAcceleration(0.2f); animator.setDeceleration(0.4f); animator.start(); }
Example #24
Source File: MorphingDemo.java From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void next() { Animator animator = new Animator(500); animator.addTarget(new PropertySetter(this, "alpha", 1.0f)); animator.setAcceleration(0.2f); animator.setDeceleration(0.4f); animator.start(); }
Example #25
Source File: MorphingDemo.java From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void setupTriggers() { Animator animator = PropertySetter.createAnimator( 150, this, "morphing", 0.0f, 1.0f); animator.setAcceleration(0.2f); animator.setDeceleration(0.3f); MouseTrigger.addTrigger(this, animator, MouseTriggerEvent.ENTER, true); }
Example #26
Source File: FadingButtonTF.java From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** Creates a new instance of FadingButtonTF */ public FadingButtonTF(String label) { super(label); setOpaque(false); animator = new Animator(animationDuration/2, Animator.INFINITE, RepeatBehavior.REVERSE, this); animator.setStartFraction(1.0f); animator.setStartDirection(Direction.BACKWARD); addActionListener(this); }
Example #27
Source File: SplineInterpolatorTest.java From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static void main(String args[]) { Animator animator = new Animator(DURATION, new SplineInterpolatorTest()); SplineInterpolator interpolator = new SplineInterpolator(1f, 0f, 0f, 1f); animator.setInterpolator(interpolator); // Note that you could get similar behavior by setting the following // acceleration/deceleration properties instead of the interpolator // above: //animator.setAcceleration(.5f); //animator.setDeceleration(.5f); animator.setStartDelay(1000); animator.setResolution(DURATION / 10); animator.start(); }
Example #28
Source File: BasicRace.java From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** Creates a new instance of BasicRace */ public BasicRace(String appName) { RaceGUI basicGUI = new RaceGUI(appName); controlPanel = basicGUI.getControlPanel(); controlPanel.addListener(this); track = basicGUI.getTrack(); animator = new Animator(RACE_TIME, this); }
Example #29
Source File: AnimationUtils.java From ghidra with Apache License 2.0 | 5 votes |
public static Animator showTheDragonOverComponent(Component component) { if (!animationEnabled) { return null; } GGlassPane glassPane = getGlassPane(component); if (glassPane == null) { // could happen if the given component has not yet been realized return null; } DragonImageDriver pulser = new DragonImageDriver(component); return pulser.animator; }
Example #30
Source File: FadingDemo.java From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void previous() { Animator animator = new Animator(1000); animator.addTarget(new PropertySetter(this, "alpha", 0.0f)); animator.setAcceleration(0.2f); animator.setDeceleration(0.4f); animator.start(); }