本文整理汇总了Java中org.jdesktop.animation.timing.interpolation.PropertySetter类的典型用法代码示例。如果您正苦于以下问题:Java PropertySetter类的具体用法?Java PropertySetter怎么用?Java PropertySetter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertySetter类属于org.jdesktop.animation.timing.interpolation包,在下文中一共展示了PropertySetter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hideMessageLayer
import org.jdesktop.animation.timing.interpolation.PropertySetter; //导入依赖的package包/类
/**
* 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();
}
}
示例2: setExpanded
import org.jdesktop.animation.timing.interpolation.PropertySetter; //导入依赖的package包/类
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();
}
}
示例3: buildPulsatingField
import org.jdesktop.animation.timing.interpolation.PropertySetter; //导入依赖的package包/类
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;
}
示例4: setTextAndAnimate
import org.jdesktop.animation.timing.interpolation.PropertySetter; //导入依赖的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();
}
示例5: HelpGlassPane
import org.jdesktop.animation.timing.interpolation.PropertySetter; //导入依赖的package包/类
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();
}
});
}
示例6: configureAnimations
import org.jdesktop.animation.timing.interpolation.PropertySetter; //导入依赖的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);
}
示例7: SpherePanel
import org.jdesktop.animation.timing.interpolation.PropertySetter; //导入依赖的package包/类
/**
* Load the named image and create the animator that will bounce the
* image down and back up in this panel.
*/
SpherePanel(String filename) {
try {
URL url = getClass().getResource("images/" + filename);
sphereImage = ImageIO.read(url);
} catch (Exception e) {
System.out.println("Problem loading image " + filename + ": " + e);
return;
}
setPreferredSize(new Dimension(sphereImage.getWidth() + 2 * PADDING,
PANEL_HEIGHT));
bouncer = PropertySetter.createAnimator(2000, this, "sphereY",
0, (PANEL_HEIGHT - sphereImage.getHeight()), 0);
bouncer.setAcceleration(.5f);
bouncer.setDeceleration(.5f);
}
示例8: setExpanded
import org.jdesktop.animation.timing.interpolation.PropertySetter; //导入依赖的package包/类
public void setExpanded(boolean expanded) {
if (expanded != this.firstExpanded) {
if (!this.firstExpanded) {
this.lastDividerLocation = getDividerLocation();
}
this.firstExpanded = expanded;
Animator animator = new Animator(500,
new PropertySetter(this, "dividerLocation",
new Integer[]{
getDividerLocation(),
expanded ? getHeight() : this.lastDividerLocation
}));
animator.setStartDelay(10);
animator.setAcceleration(0.2F);
animator.setDeceleration(0.3F);
animator.start();
}
}
示例9: ScreenTransition
import org.jdesktop.animation.timing.interpolation.PropertySetter; //导入依赖的package包/类
/**
* Constructor for ScreenTransition. The application must supply the JComponent that they wish
* to transition and the TransitionTarget which supplies the callback methods called during the
* transition process.
*
* @param transitionComponent JComponent in which the application wishes to run the transition.
* @param transitionTarget Implementation of <code>TransitionTarget</code> interface which
* will be called during transition process.
*/
private ScreenTransition(JComponent transitionComponent, TransitionTarget transitionTarget)
{
containerLayer = transitionComponent;
this.transitionTarget = transitionTarget;
animationManager = new AnimationManager(transitionComponent);
animationLayer = new AnimationLayer(this);
animationLayer.setVisible(false);
// Hack: pre-warm PropertySetter just to get some static initializers out of the way that will
// be needed before the first transition can start.
new PropertySetter(transitionComponent, "location", new Point(0, 0));
containerLayer.addComponentListener(new ContainerSizeListener());
createTransitionImages();
}
示例10: DemoPanel
import org.jdesktop.animation.timing.interpolation.PropertySetter; //导入依赖的package包/类
public DemoPanel(Demo demo) {
this.demo = demo;
setLayout(new BorderLayout());
// remind(aim): how to access resourceMap?
//resourceMap = getContext().getResourceMap();
LoadAnimationPanel loadAnimationPanel = new LoadAnimationPanel();
add(loadAnimationPanel);
loadAnimationPanel.setAnimating(true);
LoadedDemoPanel demoPanel = new LoadedDemoPanel(demo);
try {
loadAnimationPanel.setAnimating(false);
Animator fadeOutAnimator = new Animator(400,
new FadeOut(DemoPanel.this,
loadAnimationPanel, demoPanel));
fadeOutAnimator.setAcceleration(.2f);
fadeOutAnimator.setDeceleration(.3f);
Animator fadeInAnimator = new Animator(400,
new PropertySetter(DemoPanel.this, "alpha", 0.3f, 1.0f));
TimingTrigger.addTrigger(fadeOutAnimator, fadeInAnimator, TimingTriggerEvent.STOP);
fadeOutAnimator.start();
} catch (Exception ignore) {
System.err.println(ignore);
ignore.printStackTrace();
}
}
示例11: LoadAnimationPanel
import org.jdesktop.animation.timing.interpolation.PropertySetter; //导入依赖的package包/类
public LoadAnimationPanel() {
super(10);
setBorder(roundedBorder);
setBackground(Utilities.deriveColorHSB(
UIManager.getColor("Panel.background"), 0, 0, -.06f));
// remind(aim): get from resource map
message = "demo loading";
PropertySetter rotator = new PropertySetter(this, "triState", 0, 3);
animator = new Animator(500, Animator.INFINITE,
Animator.RepeatBehavior.LOOP, rotator);
// Don't animate gears if loading is quick
animator.setStartDelay(200);
}
示例12: showMessageLayer
import org.jdesktop.animation.timing.interpolation.PropertySetter; //导入依赖的package包/类
/**
* Fades in the specified message component in the top layer of this
* layered pane.
* @param message the component to be displayed in the message layer
* @param finalAlpha the alpha value of the component when fade in is complete
*/
public void showMessageLayer(JComponent message, final float finalAlpha) {
messageLayer = new JPanel();
messageLayer.setOpaque(false);
GridBagLayout gridbag = new GridBagLayout();
messageLayer.setLayout(gridbag);
GridBagConstraints c = new GridBagConstraints();
c.anchor = GridBagConstraints.CENTER;
messageAlpha = new JXPanel();
messageAlpha.setOpaque(false);
messageAlpha.setAlpha(0.0f);
gridbag.addLayoutComponent(messageAlpha, c);
messageLayer.add(messageAlpha);
messageAlpha.add(message);
add(messageLayer, JLayeredPane.POPUP_LAYER);
revalidate();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Animator animator = new Animator(2000,
new PropertySetter(messageAlpha, "alpha", 0.0f, finalAlpha));
animator.setStartDelay(200);
animator.setAcceleration(.2f);
animator.setDeceleration(.5f);
animator.start();
}
});
}
示例13: slideTextIn
import org.jdesktop.animation.timing.interpolation.PropertySetter; //导入依赖的package包/类
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();
}
示例14: slideTextOut
import org.jdesktop.animation.timing.interpolation.PropertySetter; //导入依赖的package包/类
public void slideTextOut() {
Animator animator = new Animator(600,
new PropertySetter(introText, "x", introText.getX(), -introText.getWidth()));
animator.setStartDelay(10);
animator.setAcceleration(.5f);
animator.setDeceleration(.2f);
animator.start();
}
示例15: slideTextIn
import org.jdesktop.animation.timing.interpolation.PropertySetter; //导入依赖的package包/类
@Action
public void slideTextIn() {
Animator animator = new Animator(800,
new PropertySetter(textImagePainter, "x", getWidth(), 30));
animator.setStartDelay(800);
animator.setAcceleration(.2f);
animator.setDeceleration(.5f);
animator.start();
// </snip>
}