My MP3 Player
14.1.09
Splash Screen With Java Programming
package com.rangga.aplikasipenjualan;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.border.LineBorder;
public class SalesSplash extends JWindow
{
private JLabel lblJudul = new JLabel("Aplikasi penjualan menggunakan JAVA");
private JLabel lblImage = new JLabel(new ImageIcon("D:/Image/Icon/Icon.jpg"));
private JProgressBar progress;
private Timer timer;
int time=0;
private Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
public SalesSplash()
{
Container konten = getContentPane();
konten.setBackground(new Color(75,0,50));
lblJudul.setFont(new Font("Times New Roman",Font.BOLD,20));
lblJudul.setForeground(Color.white);
lblJudul.setHorizontalAlignment(SwingConstants.CENTER);
konten.add(lblJudul,BorderLayout.NORTH);
lblImage.setBorder(new LineBorder(Color.white,1));
konten.add(lblImage,BorderLayout.CENTER);
progress = new JProgressBar(0,50);
progress.setValue(0);
progress.setStringPainted(true);
progress.setPreferredSize(new Dimension(150,20));
konten.add(progress,BorderLayout.SOUTH);
timer = new Timer(100,new ActionListener()
{
public void actionPerformed(ActionEvent ae)
{
time++;
progress.setValue(time);
double batas = progress.getPercentComplete();
if(batas == 1.0)
{
timer.stop();
progress.setValue(progress.getMinimum());
setVisible(false);
dispose();
}
}
});
timer.start();
pack();
setSize(d.width/2-getWidth()/2,d.height/2-getHeight()/2);
setLocation(d.width/2-getWidth()/2,d.height/2-getHeight()/2);
setVisible(true);
}
public static void main(String[]args)
{
new SalesSplash();
}
}
Langganan:
Posting Komentar (Atom)
0 komentar:
B) :F :$ :J :( O: :K :D :M :S :) :O :P :@ :L :8
Posting Komentar