Package interfaz.utilidades

Source Code of interfaz.utilidades.Hilo_Progreso

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package interfaz.utilidades;

import interfaz.VentanaPrincipal;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JProgressBar;
import javax.swing.JTextField;
import javax.swing.JWindow;
import org.pushingpixels.substance.api.SubstanceLookAndFeel;
import org.pushingpixels.substance.api.skin.TwilightSkin;

/**
*
* @author Administrador Felipe
*/
public class Hilo_Progreso extends Thread {

    private JProgressBar progressBar;
    private int segundos_demora;
    private JTextField contador_texto;
    private JWindow ventanaPreolader;
    private VentanaPrincipal ventanaPrincipal;

    public Hilo_Progreso(JProgressBar progressBar, JTextField contador_texto, int segundos_demora, JWindow ventana, VentanaPrincipal ventanaPrincipal) {
        this.progressBar = progressBar;
        this.segundos_demora = segundos_demora;
        this.contador_texto = contador_texto;
        this.ventanaPreolader = ventana;
        this.ventanaPrincipal = ventanaPrincipal;
    }

    @Override
    public void run() {
        int contador = 0;
        while (contador <= segundos_demora) {
            try {
                Thread.sleep(1000);
                this.progressBar.setValue(contador);
                this.contador_texto.setText(Integer.toString(contador) + "%");
                contador++;
                System.out.println(contador);
            } catch (InterruptedException ex) {
                Logger.getLogger(Hilo_Progreso.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        ventanaPreolader.setVisible(false);
        JFrame.setDefaultLookAndFeelDecorated(true);
        JDialog.setDefaultLookAndFeelDecorated(true);
        try {
            SubstanceLookAndFeel.setSkin(new TwilightSkin());
        } catch (Exception e) {
            System.out.println("Substance Graphite failed to initialize");
        }
    }
}
TOP

Related Classes of interfaz.utilidades.Hilo_Progreso

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.