?? splashscreen.java
字號:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class SplashScreen extends JWindow
{
JLabel l1,l2;
JProgressBar jp;
JPanel p1;
javax.swing.Timer timer;
public SplashScreen()
{
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
this.setSize(new Dimension(502, 272));
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
int x = (int) ((d.getWidth() - this.getWidth()) / 2);
int y = (int) ((d.getHeight() - this.getHeight()) / 2);
this.setLocation(x, y);
Container c=this.getContentPane();
l1=new JLabel(" Search Engine Staring Up....");
l1.setFont(new java.awt.Font("Monotype Corsiva", 1, 22));
l1.setForeground( Color.blue);
l1.setHorizontalAlignment(SwingConstants.CENTER);
l1.setBounds(new Rectangle(16, 200, 398, 70));
l2=new JLabel("By: ..... Sreedevi . M.....");
l2.setFont(new java.awt.Font("Monotype Corsiva", 1, 26));
l2.setForeground(Color.blue);
l2.setHorizontalAlignment(SwingConstants.CENTER);
l2.setBounds(new Rectangle(0, 4, 448, 203));
p1=new JPanel();
p1.setBorder(BorderFactory.createMatteBorder(0,0,800,0,new ImageIcon("splash.jpg")));
p1.setBackground(Color.black);
p1.setForeground(Color.white);
p1.setVisible(true);
jp = new JProgressBar(0,100);
jp.setBackground(Color.white);
jp.setForeground(Color.red);
jp.setStringPainted(true);
jp.setBounds(new Rectangle(91, 180, 297, 24));
p1.setLayout(null);
p1.add(l2, null);
p1.add(jp, null);
p1.add(l1, null);
c.add(p1);
setVisible(true);
try{
timer = new javax.swing.Timer(50, createLoadAction());
timer.setRepeats(false);
while(true)
{
timer.start();
}
}catch(Exception e1){System.out.println("TIME OUT");}
}
catch(Exception e) {}
}
public Action createLoadAction()
{
return new AbstractAction("loading...")
{
public void actionPerformed (ActionEvent e)
{
try{
if(jp.getValue() < jp.getMaximum())
{
jp.setValue(jp.getValue() + 1);
}
else
{
timer.stop();
timer=null;
dispose();
}
}catch(Exception a){}
}
};
}
public static void main(String[] args)
{
SplashScreen c1=new SplashScreen();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -