本文整理汇总了Java中org.jdesktop.animation.timing.Animator.addTarget方法的典型用法代码示例。如果您正苦于以下问题:Java Animator.addTarget方法的具体用法?Java Animator.addTarget怎么用?Java Animator.addTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jdesktop.animation.timing.Animator
的用法示例。
在下文中一共展示了Animator.addTarget方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setTextAndAnimate
import org.jdesktop.animation.timing.Animator; //导入方法依赖的package包/类
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();
}
示例2: configureAnimations
import org.jdesktop.animation.timing.Animator; //导入方法依赖的package包/类
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);
}
示例3: next
import org.jdesktop.animation.timing.Animator; //导入方法依赖的package包/类
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();
}
示例4: previous
import org.jdesktop.animation.timing.Animator; //导入方法依赖的package包/类
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();
}
示例5: next
import org.jdesktop.animation.timing.Animator; //导入方法依赖的package包/类
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();
}
示例6: previous
import org.jdesktop.animation.timing.Animator; //导入方法依赖的package包/类
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();
}
示例7: init
import org.jdesktop.animation.timing.Animator; //导入方法依赖的package包/类
/**
* Initializes animation to vary the location during the transition.
*/
@Override
public void init(Animator animator, org.jdesktop.animation.transitions.Effect parentEffect) {
org.jdesktop.animation.transitions.Effect targetEffect = (parentEffect == null) ? this : parentEffect;
ps = new PropertySetter(targetEffect, "location",
startLocation, new Point(getEnd().getX(), getEnd().getY()));
animator.addTarget(ps);
super.init(animator, parentEffect);
}
示例8: setAnimator
import org.jdesktop.animation.timing.Animator; //导入方法依赖的package包/类
/**
* Sets animator that drives this ScreenTransition. Animator cannot be null. Animator also cannot
* be running when this method is called (because important setup information for
* ScreenTransition happens at Animator start time). Transition will start if either {@link
* #start} is called or {@link Animator#start} is called.
*
* @param animator non-null Animator object that will drive this ScreenTransition. Animator
* cannot be running when this is called.
* @throws IllegalStateException if animator is already running
* @throws IllegalArgumentException animator must be non-null
* @see Animator#isRunning()
*/
public void setAnimator(Animator animator)
{
if (animator == null) {
throw new IllegalArgumentException("Animator must be non-null");
}
if (animator.isRunning()) {
throw new IllegalStateException("Cannot perform this operation while animator is running");
}
this.animator = animator;
animator.addTarget(transitionTimingTarget);
}
示例9: init
import org.jdesktop.animation.timing.Animator; //导入方法依赖的package包/类
/**
* Initializes the effect, adding an animation target that will rotate the component of the
* effect from the start to the end state during the course of the transition.
*/
@Override
public void init(Animator animator, Effect parentEffect)
{
ps = new PropertySetter<Double>(this, "radians", 0.0, endRadians);
animator.addTarget(ps);
super.init(animator, null);
}
示例10: init
import org.jdesktop.animation.timing.Animator; //导入方法依赖的package包/类
/**
* Initializes the effect, adding an animation target that will fade the component of the effect
* in from transparent to opaque during the course of the transition.
*/
@Override
public void init(Animator animator, Effect parentEffect)
{
ps = new PropertySetter<Float>(this, "opacity", 0.0f, 1.0f);
animator.addTarget(ps);
setOpacity(0.0f);
super.init(animator, null);
}
示例11: init
import org.jdesktop.animation.timing.Animator; //导入方法依赖的package包/类
/**
* Initializes the effect, adding animation targets that will scale the component of the effect
* from the start to the end sizes during the course of the transition.
*/
@Override
public void init(Animator animator, Effect parentEffect)
{
Effect targetEffect = parentEffect == null ? this : parentEffect;
psWidth = new PropertySetter<Integer>(targetEffect, "width", getStart().getWidth(), getEnd().getWidth());
animator.addTarget(psWidth);
psHeight = new PropertySetter<Integer>(targetEffect, "height", getStart().getHeight(), getEnd().getHeight());
animator.addTarget(psHeight);
super.init(animator, null);
}
示例12: init
import org.jdesktop.animation.timing.Animator; //导入方法依赖的package包/类
/**
* Initializes the effect, adding an animation target that will move the component of the effect
* from the start to the end point during the course of the transition.
*/
@Override
public void init(Animator animator, Effect parentEffect)
{
Effect targetEffect = parentEffect == null ? this : parentEffect;
Point startPoint = new Point(getStart().getX(), getStart().getY());
Point endPoint = new Point(getEnd().getX(), getEnd().getY());
ps = new PropertySetter<Point>(targetEffect, "location", startPoint, endPoint);
animator.addTarget(ps);
super.init(animator, null);
}