Update of /cvsroot/javaamp/javaamp/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24057/src
Modified Files:
JavaAmp.java
Added Files:
JavaAmpSplash.java
Log Message:
Splash
--- NEW FILE: JavaAmpSplash.java ---
import java.awt.*;
import java.awt.image.*;
import java.util.*;
public class JavaAmpSplash extends Frame {
Image splash, offscreen;
Graphics ofg;
int i;
boolean ip;
Timer timer;
public JavaAmpSplash() throws Exception {
splash = getToolkit().getImage(getClass().getResource("jasplash.png"));
MediaTracker mt = new MediaTracker(this);
mt.addImage(splash, 0);
setTitle("JavaAmp");
setSize(400, 150);
setResizable(false);
setUndecorated(true);
setLocation((getToolkit().getScreenSize().width - getWidth()) / 2,
(getToolkit().getScreenSize().height - getHeight()) / 2);
offscreen = new BufferedImage(400, 150, BufferedImage.TYPE_INT_RGB);
ofg = offscreen.getGraphics();
i = 0;
ip = true;
timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
public void run() {
if(ip)
i++;
else
i--;
if(i < 0) {
i = 0;
ip = true;
}
else if(i > 350) {
i = 350;
ip = false;
}
paint(getGraphics());
}
}, 0, 5);
mt.waitForAll();
}
public void paint(Graphics g) {
if(g == null || ofg == null)
return;
ofg.drawImage(splash, 0, 0, this);
ofg.copyArea(7, 130, 36, 5, i, 8);
ofg.setColor(Color.WHITE);
ofg.fillRect(7, 129, 36, 7);
g.drawImage(offscreen, 0, 0, this);
}
}
Index: JavaAmp.java
===================================================================
RCS file: /cvsroot/javaamp/javaamp/src/JavaAmp.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- JavaAmp.java 26 Mar 2006 11:18:05 -0000 1.16
+++ JavaAmp.java 26 Mar 2006 15:13:13 -0000 1.17
@@ -107,6 +107,14 @@
public final static void main(String[] args) {
Toolkit.getDefaultToolkit().setDynamicLayout(false);
System.setProperty("sun.awt.noerasebackground", "true");
+ JavaAmpSplash jasplash = null;
+ if(Settings.splash)
+ try {
+ jasplash = new JavaAmpSplash();
+ jasplash.setVisible(true);
+ }
+ catch(Exception e) {
+ }
try {
UIManager.setLookAndFeel(
"com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
@@ -119,5 +127,10 @@
catch(Exception e) {
error(e);
}
+ if(jasplash != null) {
+ jasplash.setVisible(false);
+ jasplash.timer.cancel();
+ jasplash = null;
+ }
}
}
\ No newline at end of file
|