Bueno ahora el código para hacer un splash, para que no hagan en adelante temas para que la gente pregunte sobre eso, es funcional, esta preparado el hilo de la barra, solo tenéis que insertar la ruta de la imagen (la tenéis que insertar en bin en el package[es lo que hago yo] la imagen y si quereís creais una carpeta), configuráis el tamaño de la ventana y lo que quieres que haga el hilo, eso es todo creo y aquí el codigo
import javax.swing.*;
import java.awt.*;
import java.io.File;
/**
*
* @author Afsoon de elhacker para la gente de elhacker y el resto, permito
* su distribución con la acredeticación del autor del código base
*
*/
public class Splash
extends JFrame { private Threadbar thread;
public Splash(){
super("");
defineVentana();
//Here create the new thread
thread = new Threadbar(bar);
//Start Thread
thread.start();
//Here get point x,y where will appear Window
// This Operations is provided by Darhius elhacker
int x
= (int)((java.
awt.
Toolkit.
getDefaultToolkit().
getScreenSize().
width)- this.
getSize().
width)/2; int y
= (int)((java.
awt.
Toolkit.
getDefaultToolkit().
getScreenSize().
height)- this.
getSize().
height)/2; //Size and basic
this.setLocation(x, y);
this.setSize(400,300);
this.
setDefaultCloseOperation(JFrame.
EXIT_ON_CLOSE); this.setVisible(true);
//Empty the memory
thread = null;
}
public void defineVentana(){
//Image Splash
//Progress
bar.setBorderPainted(true);
bar.
setForeground(new Color(0,
0,
55)); bar.setStringPainted(true);
//Add component in the Layout
}
}
public void pausa(int mSeg){
try
{
{
showError(e);
}
}
class Threadbar
extends Thread{
{
this.bar = bar;
}
public void run(){
for(int i=0;i <= 100; i++)
{
bar.setValue(i);
pausa(100);
}
}
}
}