• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Animator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jdesktop.animation.timing.Animator的典型用法代码示例。如果您正苦于以下问题:Java Animator类的具体用法?Java Animator怎么用?Java Animator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Animator类属于org.jdesktop.animation.timing包,在下文中一共展示了Animator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: hideMessageLayer

import org.jdesktop.animation.timing.Animator; //导入依赖的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();
    }
}
 
开发者ID:freeseawind,项目名称:littleluck,代码行数:19,代码来源:Stacker.java


示例2: setExpanded

import org.jdesktop.animation.timing.Animator; //导入依赖的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();            
    }
}
 
开发者ID:freeseawind,项目名称:littleluck,代码行数:19,代码来源:AnimatingSplitPane.java


示例3: buildPulsatingField

import org.jdesktop.animation.timing.Animator; //导入依赖的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;
}
 
开发者ID:romainguy,项目名称:filthy-rich-clients,代码行数:19,代码来源:PulseFieldDemo.java


示例4: 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();
}
 
开发者ID:romainguy,项目名称:filthy-rich-clients,代码行数:26,代码来源:FadingDemo.java


示例5: HelpGlassPane

import org.jdesktop.animation.timing.Animator; //导入依赖的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();
        }
    });
}
 
开发者ID:romainguy,项目名称:filthy-rich-clients,代码行数:20,代码来源:FadingDemo.java


示例6: 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);
}
 
开发者ID:romainguy,项目名称:filthy-rich-clients,代码行数:27,代码来源:MotionDemo.java


示例7: setExpanded

import org.jdesktop.animation.timing.Animator; //导入依赖的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();
    }
}
 
开发者ID:Jakegogo,项目名称:concurrent,代码行数:22,代码来源:AnimatingSplitPane.java


示例8: animate

import org.jdesktop.animation.timing.Animator; //导入依赖的package包/类
/**
 * Performs the animation itself based on the parameters provided in the
 * constructor method. Keep in mind this method is synchronized. Check
 * the following example:
 * @code
 * JWindow window = new JWindow();
 * Notification note = new Notification(window, WindowPosition.BOTTOMRIGHT, 25, 25, 1000);
 * note.animate();
 * @endcode
 * Wherever possible, please use the new notification queue manager
 * <b>net.sf.jcarrierpigeon.NotificationQueue</b>.
 */
public synchronized void animate() {

    // set the animation state
    animationFrame = AnimationFrame.ONSHOW;

    // define some window properties
    setCurrentWindowAlwaysOnTop(true);
    setCurrentWindowVisible(true);

    // defines the animator handler from Timing Framework
    // first animator handler
    animatorHandlerOnShow = new Animator(timeToAnimate, 1, Animator.RepeatBehavior.LOOP, this);

    // start animation
    animatorHandlerOnShow.start();
}
 
开发者ID:mediathekview,项目名称:MediathekView,代码行数:29,代码来源:Notification.java


示例9: AnimationManager

import org.jdesktop.animation.timing.Animator; //导入依赖的package包/类
/**
 * Creates a new AnimationManager. Clients are expected to retrieve an
 * existing AnimationManager by calling the appropriate operation on their
 * application's VirtualSpaceManager, and not to create an AnimationManager
 * themselves.
 */
public AnimationManager(VirtualSpaceManager vsm) {
    pendingAnims = new LinkedList<Animation>();
    runningAnims = new LinkedList<Animation>();
    listsLock = new ReentrantLock();
    tickThread = new TickThread("tickThread");
    animationFactory = new AnimationFactory(this);
    started = new AtomicBoolean(false);

    //vsm is only useful for currentCamAnim
    currentCamAnim = new InteractiveCameraAnimation(vsm);
    Animation anim = createAnimation(Animator.INFINITE, 1d,
                                     Animation.RepeatBehavior.LOOP,
                                     currentCamAnim, //DUMMY subject: avoids conflicts
                                     Animation.Dimension.POSITION,
                                     currentCamAnim);
    startAnimation(anim, true);
}
 
开发者ID:sharwell,项目名称:zgrnbviewer,代码行数:24,代码来源:AnimationManager.java


示例10: init

import org.jdesktop.animation.timing.Animator; //导入依赖的package包/类
/**
 * Initialize this effect. This method is called at transition start time, to enable the effect
 * to set up any necessary state prior to the animation, such as animations that vary properties
 * of the Effect during the transition.
 * <p/>
 * Subclasses of <code>Effect</code> will typically call this superclass method if they override
 * <code>init()</code>, as many effects will depend on the state that is set up in this method.
 */
public void init(Animator animator, Effect parentEffect)
{
   bounds = new Rectangle();

   if (start != null) {
      setBounds(start.getX(), start.getY(), start.getWidth(), start.getHeight());
   }
   else {
      setBounds(end.getX(), end.getY(), end.getWidth(), end.getHeight());
   }

   // If this effect already has a snapshot image of the component, but it's not the size that we
   // need, flush it now and it will be created later during the first setup() call.
   if (
      componentImage != null &&
      (start != null && start.getWidth() != componentImage.getWidth(null) ||
       end != null && end.getWidth() != componentImage.getWidth(null))
   ) {
      componentImage.flush();
      componentImage = null;
   }
}
 
开发者ID:royosherove,项目名称:javatdddemo,代码行数:31,代码来源:Effect.java


示例11: init

import org.jdesktop.animation.timing.Animator; //导入依赖的package包/类
/**
 * Called just prior to running the transition.  This method examines the start and end states
 * as well as the Effect repository to determine the appropriate Effect to use during the
 * transition for this AnimationState.  If there is an existing custom effect defined for the
 * component for this type of transition, that effect will be used, Otherwise, the system will
 * use the appropriate default effect (fading in, fading out, or moving/resizing).
 */
void init(Animator animator)
{
   if (start == null) {
      initializeStateForComponentThatAppearsDuringTransition();
   }
   else if (end == null) {
      initializeStateForComponentThatDisappearsDuringTransition();
   }
   else {
      initializeStateForComponentThatIsInBothScreens();
   }

   // Initialize the effect that we are about to run in the transition.
   effect.init(animator, null);
}
 
开发者ID:royosherove,项目名称:javatdddemo,代码行数:23,代码来源:AnimationState.java


示例12: DemoPanel

import org.jdesktop.animation.timing.Animator; //导入依赖的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();
    }
}
 
开发者ID:freeseawind,项目名称:littleluck,代码行数:30,代码来源:DemoPanel.java


示例13: LoadAnimationPanel

import org.jdesktop.animation.timing.Animator; //导入依赖的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);
}
 
开发者ID:freeseawind,项目名称:littleluck,代码行数:16,代码来源:DemoPanel.java


示例14: showMessageLayer

import org.jdesktop.animation.timing.Animator; //导入依赖的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();
        }
    });
}
 
开发者ID:freeseawind,项目名称:littleluck,代码行数:35,代码来源:Stacker.java


示例15: slideTextIn

import org.jdesktop.animation.timing.Animator; //导入依赖的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();
}
 
开发者ID:freeseawind,项目名称:littleluck,代码行数:9,代码来源:IntroPanel.java


示例16: slideTextOut

import org.jdesktop.animation.timing.Animator; //导入依赖的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();        
}
 
开发者ID:freeseawind,项目名称:littleluck,代码行数:9,代码来源:IntroPanel.java


示例17: slideTextIn

import org.jdesktop.animation.timing.Animator; //导入依赖的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>
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:11,代码来源:IntroPanelDemo.java


示例18: slideTextOut

import org.jdesktop.animation.timing.Animator; //导入依赖的package包/类
public void slideTextOut() {
    Animator animator = new Animator(600, 
            new PropertySetter(textImagePainter, "x", textImagePainter.getX(), -getWidth()));
    animator.setStartDelay(10);
    animator.setAcceleration(.5f);
    animator.setDeceleration(.2f);
    animator.start();        
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:9,代码来源:IntroPanelDemo.java


示例19: LoadAnimationPanel

import org.jdesktop.animation.timing.Animator; //导入依赖的package包/类
public LoadAnimationPanel() {
    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);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:15,代码来源:DemoXPanel.java


示例20: BasicRace

import org.jdesktop.animation.timing.Animator; //导入依赖的package包/类
/** 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);
}
 
开发者ID:romainguy,项目名称:filthy-rich-clients,代码行数:9,代码来源:BasicRace.java



注:本文中的org.jdesktop.animation.timing.Animator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CacheKey类代码示例发布时间:2022-05-21
下一篇:
Java LinkDirection类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap