Пример #1
0
 @Override
 public void paint(Graphics g) {
   super.paint(g);
   if (!introText.isVisible()) {
     introText.setLocation(1000, 80);
     introText.setVisible(true);
     slideTextIn();
   }
 }
Пример #2
0
  @Override
  public void doLayout() {
    Dimension size = getSize();
    Insets insets = getInsets();
    int w = size.width - insets.left - insets.right;

    Dimension prefSize = introImage.getPreferredSize();
    introImage.setBounds(0, 0, prefSize.width, prefSize.height);

    if (introText.isVisible()) {
      prefSize = introText.getPreferredSize();
      introText.setBounds(introText.getX(), introText.getY(), prefSize.width, prefSize.height);
    }
  }
Пример #3
0
 /** 修改人:张孟志 修改日期:2015-05-22 修改说明:调整动画效果,后来决定废弃这个方法 */
 public void slideTextOut() {
   /*
   modify by zhangmz 2015-05-22 调整动画滑动样式
         Animator animator = new Animator(600,
                 new PropertySetter(introText, "x", introText.getX(), -introText.getWidth()));
         */
   Animator animator =
       new Animator(3000, new PropertySetter(introText, "x", -introText.getWidth(), 0));
   animator.setStartDelay(10);
   animator.setAcceleration(.5f);
   animator.setDeceleration(.2f);
   animator.start();
 }
Пример #4
0
  public IntroPanel() {
    setLayout(null);
    setOpaque(false);

    introImage =
        new JLabel(
            new ImageIcon(Paradisaeidae.class.getResource("resources/images/home_notext.png")));
    introImage.setVerticalAlignment(JLabel.TOP);

    introText =
        new SlidingLabel(
            new ImageIcon(Paradisaeidae.class.getResource("resources/images/home_text.png")));
    introText.setVisible(false);

    introImage.addMouseListener(
        new MouseAdapter() {
          public void mousePressed(MouseEvent event) {
            slideTextIn();
          }
        });

    add(introText);
    add(introImage);
  }