Ver Mensaje Individual
  #2 (permalink)  
Antiguo 29/03/2010, 17:24
lince_0011
 
Fecha de Ingreso: septiembre-2009
Mensajes: 63
Antigüedad: 14 años, 8 meses
Puntos: 0
Respuesta: Implementacion de Una ProgressBar.

Ya logre insertar la barra de progreso en mi apliacion..

El codigo debe quedar asi (el de la ventana con la progressbar)

Código PHP:
package Splash;
import java.awt.Color;

/**
 *
 * @author Admin
 */
public class principal extends javax.swing.JFrame

    
{
        
HiloProgreso hilo;

    
/** Creates new form principal */
    
public principal() {
        
//Método por defecto
        
initComponents();
        
iniciarSplash();
        
//Creamos un objeto HiloProgreso al cual
        //le pasamos por parámetro la barra de progreso
        
hilo=new HiloProgreso(getProgreso());
        
//Iniciamos el Hilo
        
hilo.start();
        
//Le damos tamaño y posición a nuestro Frame
        
this.setLocation(200,200);
        
this.setSize(472,249);
        
//Liberamos recursos
        
hilo=null;

           
          }

    
/** 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() {

        
jPanel1 = new javax.swing.JPanel();
        
jPanel2 = new javax.swing.JPanel();
        
jLabel1 = new javax.swing.JLabel();
        
progreso = new javax.swing.JProgressBar();

        
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        
jPanel1.setName("jPanel1"); // NOI18N
        
jPanel1.setLayout(new java.awt.BorderLayout());
        
getContentPane().add(jPanel1java.awt.BorderLayout.LINE_START);

        
jPanel2.setName("jPanel2"); // NOI18N
        
jPanel2.setLayout(new java.awt.BorderLayout());

        
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        
org.jdesktop.application.ResourceMap resourceMap org.jdesktop.application.Application.getInstance(Splash.ProyectoFinalApp.class).getContext().getResourceMap(principal.class);
        
jLabel1.setIcon(resourceMap.getIcon("jLabel1.icon")); // NOI18N
        
jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        
jLabel1.setName("jLabel1"); // NOI18N
        
jPanel2.add(jLabel1java.awt.BorderLayout.CENTER);

        
progreso.setName("progreso"); // NOI18N
        
jPanel2.add(progresojava.awt.BorderLayout.PAGE_END);

        
getContentPane().add(jPanel2java.awt.BorderLayout.CENTER);

        
pack();
    }
// </editor-fold>

    /**
    * @param args the command line arguments
    */
    
public static void main(String args[]) {
        
java.awt.EventQueue.invokeLater(new Runnable() {
            public 
void run() {
                new 
principal().setVisible(true);
            }
        });
    }

    
// Variables declaration - do not modify
    
private javax.swing.JLabel jLabel1;
    private 
javax.swing.JPanel jPanel1;
    private 
javax.swing.JPanel jPanel2;
    private 
javax.swing.JProgressBar progreso;
    
// End of variables declaration

    /**
     * @return the progreso
     */
    
public javax.swing.JProgressBar getProgreso() {
        return 
progreso;
    }
    public 
void  iniciarSplash() {
        
this.progreso.setBorderPainted(true);
        
this.progreso.setForeground(new Color(5050153100));
        
this.progreso.setStringPainted(true);
    }

    
/**
     * @param progreso the progreso to set
     */
    
public void setProgreso(javax.swing.JProgressBar progreso) {
        
this.progreso progreso;
    }