Netbeans - PROBLEMA AL EJECUTAR SPLASH SCREEN

 
Vista:
Imágen de perfil de Alejandra
Val: 18
Ha disminuido 1 puesto en Netbeans (en relación al último mes)
Gráfica de Netbeans

PROBLEMA AL EJECUTAR SPLASH SCREEN

Publicado por Alejandra (9 intervenciones) el 15/06/2020 03:07:44
Buenas noches:

Estoy teniendo problemas al momento de ejecutar el código de Splash Screen, Netbeans no lo muestra directamente...

solo aparece el mensaje:

run:
BUILD SUCCESSFUL (total time: 1 second)



alguien sabe a que puede deberse este error? ya que quiero agregar un splash screen a mi proyecto de tesis, descargué varios proyectos de ejemplos y me muestra los splash screen sin problemas.

Desde ya gracias!

Estoy trabajando con Netbeans 8.2 en Windows 10.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Alejandra
Val: 18
Ha disminuido 1 puesto en Netbeans (en relación al último mes)
Gráfica de Netbeans

PROBLEMA AL EJECUTAR SPLASH SCREEN

Publicado por Alejandra (9 intervenciones) el 20/06/2020 13:43:02
Pude ejecutar un Splash Screen siguiendo un tutorial en YouTube...

adjunto código que me funcionó:


Clase Splashscr


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package splashscr;
 
/**
 *
 * @author
 */
public class Splashscr {
 
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
 
        screen obr = new screen();
        obr.setVisible(true);
 
        try {
            for (int i = 0; i <= 100; i++) {
 
                Thread.sleep(35);
 
         //       obr.texto.setText(Integer.toString(i)+"%");
 
                obr.jProgressBar1.setValue(i);
 
 
                if(i==100){
                    obr.setVisible(false);
                }
            }
        } catch (Exception e) {
        }
    }
 
}


Clase screen

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
package splashscr;
 
import javax.swing.JLabel;
import javax.swing.JProgressBar;
 
/**
 *
 * @author
 */
public class screen extends javax.swing.JFrame {
 
    screen spl = this;
    /**
     * Creates new form screen
     */
    public screen() {
        initComponents();
        startThread();
    }
 
    void startThread() {
        Thread hi = new Thread(new Runnable() {
            @Override
            public void run() {
                AccesoLogin ven = new AccesoLogin();
                ven.setLocationRelativeTo(null);
                ven.setVisible(true);
                dispose();
            }
        });
        hi.start();
    }
 
    /**
     * 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();
        jProgressBar1 = new javax.swing.JProgressBar();
        texto = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
 
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setUndecorated(true);
 
        jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
        jPanel1.add(jProgressBar1, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 420, 350, 20));
 
        texto.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        texto.setForeground(new java.awt.Color(255, 255, 255));
        texto.setText("Cargando componentes...");
        jPanel1.add(texto, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 400, 350, -1));
 
        jLabel1.setIcon(new javax.swing.ImageIcon("D:\\Emilia Alejandra Ojeda\\Escritorio\\EJEMPLOS PUNTO DE VENTAS EN JAVA\\SISTEMA DE VENTAS CODIGO JAVA NETBEANS 14092017\\Parrilla_Pichon\\src\\Imagenes\\splash\\r22.png")); // NOI18N
        jPanel1.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 800, 510));
 
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
 
        setSize(new java.awt.Dimension(800, 506));
        setLocationRelativeTo(null);
    }// </editor-fold>
 
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(screen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(screen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(screen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(screen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
 
        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new screen().setVisible(true);
            }
        });
    }
 
    // Variables declaration - do not modify
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    public javax.swing.JProgressBar jProgressBar1;
    public javax.swing.JLabel texto;
    // End of variables declaration
 
 
}

El único problema que estoy teniendo es que NO se ejecuta todo el Splash Screen y automáticamente me aparecen el login, NO se aprecia bien el Splash

¿qué debo modificar para que llegue al 100%?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar