1 30 31 package com.jgoodies.animation.examples.intro; 32 33 import java.awt.Color ; 34 import java.awt.Font ; 35 36 import javax.swing.JPanel ; 37 38 import com.jgoodies.animation.Animation; 39 import com.jgoodies.animation.Animations; 40 import com.jgoodies.animation.animations.BasicTextAnimation; 41 import com.jgoodies.animation.animations.BasicTextAnimations; 42 import com.jgoodies.animation.components.BasicTextLabel; 43 44 54 55 public final class IntroPage { 56 57 private BasicTextLabel label1; 59 private BasicTextLabel label2; 60 61 64 private Animation animation; 65 66 67 69 74 public Animation animation() { 75 return animation; 76 } 77 78 79 81 84 private void initComponents() { 85 Font font = getAnimationFont(); 86 label1 = new BasicTextLabel(" "); 87 label1.setFont(font); 88 label1.setBounds(0, 0, 350, 100); 89 label1.setOpaque(false); 90 91 label2 = new BasicTextLabel(" "); 92 label2.setFont(font); 93 label2.setBounds(0, 0, 350, 100); 94 label2.setOpaque(false); 95 } 96 97 102 public JPanel build() { 103 initComponents(); 104 animation = createAnimation(); 105 106 JPanel panel = new JPanel (null); 107 panel.setBounds(0, 0, 350, 100); 108 panel.setBackground(Color.white); 109 110 panel.add(label1); 111 panel.add(label2); 112 113 return panel; 114 } 115 116 118 123 private Animation createAnimation() { 124 Animation welcome = 125 BasicTextAnimation.defaultFade( 126 label1, 127 2500, 128 "Welcome To", 129 Color.darkGray); 130 131 Animation theJGoodiesAnimation = 132 BasicTextAnimation.defaultFade( 133 label1, 134 3000, 135 "The JGoodies Animation", 136 Color.darkGray); 137 138 Animation description = 139 BasicTextAnimations.defaultFade( 140 label1, 141 label2, 142 2000, 143 -100, 144 "An open source framework|" + 145 "for time-based|real-time animations|in Java.", 146 Color.darkGray); 147 148 Animation features = 149 BasicTextAnimations.defaultFade( 150 label1, 151 label2, 152 3000, 153 500, 154 "Main Features:", 155 Color.darkGray); 156 157 Animation featureList = 158 BasicTextAnimations.defaultFade( 159 label1, 160 label2, 161 1750, 162 0, 163 "Seamless|flexible|and powerful integration|with Java.|" + 164 "small library size", 165 Color.darkGray); 166 167 Animation all = 168 Animations.sequential( 169 new Animation[] { 170 Animations.pause(1000), 171 welcome, 172 Animations.pause(1000), 173 theJGoodiesAnimation, 174 Animations.pause(1000), 175 description, 176 Animations.pause(1000), 177 features, 178 Animations.pause(1000), 179 featureList, 180 Animations.pause(1500), 181 }); 182 183 return all; 184 } 185 186 188 194 private Font getAnimationFont() { 195 return new Font ("Tahoma", Font.BOLD, 18); 196 } 197 198 } | Popular Tags |