MENJALANKAN PROGRESS DI JAVA

Posted: February 16, 2009 in MASHUDI

HARAP DIJALANKAN DI JCREATOR…..AKAN MENAMPILKAN PROGRESS….

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.border.LineBorder;

public class SisInven extends JWindow {
private Dimension dimensi1 = Toolkit.getDefaultToolkit().getScreenSize();
private JLabel labelLogo1 = new JLabel(new ImageIcon (“logo .jpg”));
private JProgressBar barisProgres1= new JProgressBar();
private int time1 = 0;
private Timer timer1;

public SisInven ()
{
Color Warna = Color.blue;
barisProgres1.setValue(0);
barisProgres1.setPreferredSize(new Dimension(100,15));
barisProgres1.setBackground(Color.white);
barisProgres1.setForeground(Color.red);
barisProgres1.setStringPainted(true);
barisProgres1.setBorder(new LineBorder (Warna, 1));
labelLogo1.setBorder (new LineBorder (Warna, 1));
getContentPane().add(labelLogo1, BorderLayout.NORTH);
getContentPane().add(barisProgres1,BorderLayout.CENTER);
timer1=new Timer(50,new ActionListener()
{
public void actionPerformed(ActionEvent evt)
{
time1++;
barisProgres1.setValue(time1);
if(barisProgres1.getPercentComplete()==1.0)
{
timer1.stop();
setVisible(false);
new Menu_Utama();
}
}
});
timer1.start();
pack();
setLocation (dimensi1.width / 2 – getWidth() / 2, dimensi1.height / 2 – getHeight() / 2);
show();
}

public static void main (String args[]) {
new SisInven ();
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s