¿como hago una interfaz de bienvenida?
Quiero que antes de iniciar mi aplicación se
muestre por alrededor de 5 segundos una interfaz
de bienvenida a la misma.
muestre por alrededor de 5 segundos una interfaz
de bienvenida a la misma.
ponle un Hilo a tu programa por ejemplo:
public class M_B implements Runnable{
public void run(){
código de la aplicación
}
}
después llamalo es sencillo
public class M_B implements Runnable{
public void run(){
código de la aplicación
}
}
después llamalo es sencillo
te dejo un codigo espero i te sirva...claro k no es mio
/*
* Presentacion.java
*
* Created on 22 de julio de 2007, 17:33
*/
package packPrueba;
import java.awt.event.*;
import javax.swing.*;
/**
*
* @author Veronica
*/
public class Presentacion extends javax.swing.JFrame {
private Timer timer;
int cont;
private String newline;
public final static int ONE_SECOND = 2;
/** Creates new form Presentacion */
public Presentacion() {
cont =-1;
initComponents();
jProgressBar1.setValue(0);
jProgressBar1.setStringPainted(true);
timer = new Timer(ONE_SECOND, new TimerListener());
timer.start();
}
class TimerListener implements ActionListener {
public void actionPerformed(ActionEvent evt) {
cont++;
jProgressBar1.setValue(cont);
if(cont==200){ //para que se cargue en 2 segundos
timer.stop();
esconder();
JFrame inicio = new Validar();
inicio.setVisible(true);
//Validar.show();
}
}
}
public void esconder(){
this.setVisible(false);
}
/** 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.
*/
// //GEN-BEGIN:initComponents
private void initComponents() {
jProgressBar1 = new javax.swing.JProgressBar();
jLabel1 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setAlwaysOnTop(true);
setUndecorated(true);
getContentPane().setLayout(null);
jProgressBar1.setMaximum(80);
getContentPane().add(jProgressBar1);
jProgressBar1.setBounds(10, 250, 290, 20);
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/imgprueba.JPG"))); // NOI18N
getContentPane().add(jLabel1);
jLabel1.setBounds(10, 10, 290, 230);
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
setBounds((screenSize.width-324)/2, (screenSize.height-282)/2, 324, 282);
}// //GEN-END:initComponents
/**
* @param args the command line arguments
*/
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JProgressBar jProgressBar1;
// End of variables declaration//GEN-END:variables
}