package view;
import controller.operating.Strings;
import view.componentes.JLabelPequeno;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Rectangle;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.SwingConstants;
import javax.swing.WindowConstants;
import javax.swing.border.EtchedBorder;
public class FormSplash{
private JFrame jFrame = null; // @jve:decl-index=0:visual-constraint="87,46"
private JPanel jContentPane = null;
private JProgressBar jProgressBar = null;
private String mensagem = "Iniciando..."; // @jve:decl-index=0:
private JLabel jLabelLoading = null;
private JLabel jLabelTitulo = null;
private JLabel jLabelImgem = null;
private JLabel jLabelImagem2 = null;
private JLabel jLabelText = null;
private JLabel jLabelBarras = null;
private JLabel jLabelLinha = null;
private JLabelPequeno jLabel1 = null;
private JLabelPequeno jLabel2 = null;
private JLabelPequeno jLabel3 = null;
private JLabel jLabel4 = null;
public static void getSplash() {
new FormSplash();
}
public FormSplash() {
getJFrame();
try {
Thread.sleep(2000);
getJProgressBar();
run();
} catch (InterruptedException e) {
}
jFrame.dispose();
}
private JFrame getJFrame() {
if (jFrame == null) {
jFrame = new JFrame();
jFrame.setSize(465, 272);
//jFrame.setSize(298, 213);
jFrame.setTitle("Iniciando");
jFrame.setBackground(Color.black);
jFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
jFrame.setContentPane(getJContentPane());
jFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
jFrame.setLocationRelativeTo(null);
jFrame.setUndecorated(true);
jFrame.setVisible(true);
}
return jFrame;
}
private JPanel getJContentPane() {
if (jContentPane == null) {
jLabel4 = new JLabelPequeno(Strings.version);
jLabel4.setBounds(new Rectangle(6, 234, 355, 14));
jLabel3 = new JLabelPequeno("by Array - Software Foundation in Eclipse - VEP Engine");
jLabel3.setBounds(new Rectangle(7, 221, 323, 14));
jLabel2 = new JLabelPequeno("Copyright 2003-2007 Array-Fagoc Software Inc");
jLabel2.setBounds(new Rectangle(7, 209, 303, 14));
jLabel1 = new JLabelPequeno("Módulo Relacionamento v0.1 Beta Java");
jLabel1.setBounds(new Rectangle(7, 197, 252, 14));
jLabelLinha = new JLabel();
jLabelLinha.setBounds(new Rectangle(23, 130, 424, 16));
jLabelLinha.setForeground(Color.darkGray);
jLabelLinha.setText("___________________________________________________________");
jLabelBarras = new JLabel();
jLabelBarras.setBounds(new Rectangle(325, 7, 126, 113));
jLabelBarras.setIcon(new ImageIcon(getClass().getResource("/view/images/java.jpg")));
jLabelBarras.setText("");
jLabelText = new JLabel();
jLabelText.setBounds(new Rectangle(50, 168, 266, 18));
jLabelText.setHorizontalAlignment(SwingConstants.LEADING);
jLabelText.setText("Iniciando.....");
jLabelImagem2 = new JLabel();
jLabelImagem2.setBounds(new Rectangle(324, 187, 137, 72));
jLabelImagem2.setIcon(new ImageIcon(getClass().getResource("/view/images/fundo2.jpg")));
jLabelImagem2.setText("");
jLabelImgem = new JLabel();
jLabelImgem.setBounds(new Rectangle(11, 11, 193, 88));
jLabelImgem.setIcon(new ImageIcon(getClass().getResource("/view/images/fagoc.PNG")));
jLabelImgem.setText("");
jLabelTitulo = new JLabel();
jLabelTitulo.setBounds(new Rectangle(21, 108, 427, 36));
jLabelTitulo.setFont(new Font("Verdana", Font.BOLD | Font.ITALIC, 18));
jLabelTitulo.setBackground(new Color(238, 230, 238));
jLabelTitulo.setForeground(new Color(0, 0, 238, 150));
jLabelTitulo.setText("Módulo Relacionamento - Java");
jLabelLoading = new JLabel();
jLabelLoading.setBounds(new Rectangle(9, 150, 38, 45));
jLabelLoading.setIcon(new ImageIcon(getClass().getResource("/view/images/i_animated_loading_32_2.gif")));
jLabelLoading.setHorizontalAlignment(SwingConstants.CENTER);
jLabelLoading.setText("");
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setBackground(Color.white);
jContentPane.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
jContentPane.add(jLabelLoading, null);
jContentPane.add(jLabelTitulo, null);
jContentPane.add(jLabelImgem, null);
jContentPane.add(jLabelImagem2, null);
jContentPane.add(jLabelText, null);
jContentPane.add(jLabelBarras, null);
jContentPane.add(jLabelLinha, null);
jContentPane.add(jLabel1, null);
jContentPane.add(jLabel2, null);
jContentPane.add(jLabel3, null);
jContentPane.add(jLabel4, null);
}
return jContentPane;
}
private JProgressBar getJProgressBar() {
if (jProgressBar == null) {
jProgressBar = new JProgressBar(0, 100);
jProgressBar.setBounds(new Rectangle(2, 256, 462, 15));
jContentPane.add(getJProgressBar(), null);
}
return jProgressBar;
}
public void setText(String text){
jFrame.setTitle(text);
mensagem = text;
jLabelText.setText(mensagem);
}
public void run() {
for (int i = 0; i <= 100; i++) {
if (i == 25)
setText("Carregando dados do Sistema...");
if (i == 50)
setText("Atualizando últimas configurações");
if (i == 75)
setText("Finalizando processos...");
if (i == 95)
setText("Pronto !!!!");
jProgressBar.setValue(i);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
}
}
}
public void paint(Graphics g) {
// Apenas desenha a nossa mensagem em cima da imagem
g.setFont(new Font("Arial", Font.BOLD, 30));
g.setColor(Color.white);
g.drawString(mensagem, 40, 40);
}
}