package Agung;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JProgressBar;
import javax.swing.plaf.PanelUI;
public class LaunchProgressBar extends javax.swing.JDialog {
public LaunchProgressBar() {
setUndecorated(true);
initComponents();
this.setAlwaysOnTop(true);
SplashPanel.setUI(new BgSplash());
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
int x = (dim.width-getWidth())/2;
int y = (dim.height-getHeight())/2;
setLocation(x,y);
ProgressBar.setStringPainted(true);
}
public JProgressBar getProgressBar() {
return ProgressBar;
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
SplashPanel = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
ProgressBar = new javax.swing.JProgressBar();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
SplashPanel.setBackground(new java.awt.Color(153, 153, 153));
jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel1.setText("Aplikasi Penjualan Motor");
jLabel2.setText("V.1.0.0");
jLabel3.setText("Loading...");
jLabel4.setText("Design by : Agung R");
javax.swing.GroupLayout SplashPanelLayout = new javax.swing.GroupLayout(SplashPanel);
SplashPanel.setLayout(SplashPanelLayout);
SplashPanelLayout.setHorizontalGroup(
SplashPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(ProgressBar, javax.swing.GroupLayout.DEFAULT_SIZE, 395, Short.MAX_VALUE)
.addGroup(SplashPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel3)
.addContainerGap(336, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, SplashPanelLayout.createSequentialGroup()
.addContainerGap(229, Short.MAX_VALUE)
.addComponent(jLabel4)
.addGap(68, 68, 68))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, SplashPanelLayout.createSequentialGroup()
.addContainerGap(102, Short.MAX_VALUE)
.addComponent(jLabel1)
.addGap(100, 100, 100))
.addGroup(SplashPanelLayout.createSequentialGroup()
.addGap(179, 179, 179)
.addComponent(jLabel2)
.addContainerGap(180, Short.MAX_VALUE))
);
SplashPanelLayout.setVerticalGroup(
SplashPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(SplashPanelLayout.createSequentialGroup()
.addGap(37, 37, 37)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 140, Short.MAX_VALUE)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel4)
.addGap(12, 12, 12))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(SplashPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(SplashPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>
/**
* @param args the command line arguments
*/
// Variables declaration - do not modify
private javax.swing.JProgressBar ProgressBar;
private javax.swing.JPanel SplashPanel;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
// End of variables declaration
}
class BgSplash extends PanelUI {
ImageIcon background = new ImageIcon(getClass().getResource("/Agung/images/loading.gif"));
@Override
public void paint(Graphics g, JComponent c) {
g.drawImage(background.getImage(), 0, 0, null);
}
}