bueno mi proyecto tiene unos JOptionPane con imágenes y cuando compilo y se crea el .jar Ejecuto el .jar y los JOptionPane ya no salen con imágenes
bueno cuando ejecuto mi proyecto IDE si salen la imágenes y cuando lo ejecuto desde el .jar no me salen las imágenes.
Código Java:
Ver originalpackage JOptionPane_Imagenes;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
public class JOptionPane_Imagenes
extends javax.
swing.
JFrame {
Icon Guardar, Eliminar, Actualizar, Salir
;
public JOptionPane_Imagenes() {
initComponents();
setLocationRelativeTo(null);
setBounds(350, 330, 713, 120);
Guardar
= new ImageIcon("src/JOptionPane_Imagenes/guardar.png"); Eliminar
= new ImageIcon("src/JOptionPane_Imagenes/remove.png"); Actualizar
= new ImageIcon("src/JOptionPane_Imagenes/update.png"); Salir
= new ImageIcon("src/JOptionPane_Imagenes/salir.png"); }
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jButton1
= new javax.
swing.
JButton(); jButton2
= new javax.
swing.
JButton(); jButton3
= new javax.
swing.
JButton(); jButton4
= new javax.
swing.
JButton();
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jButton1.
setFont(new java.
awt.
Font("Tahoma",
1,
14)); // NOI18N jButton1.
setIcon(new javax.
swing.
ImageIcon(getClass
().
getResource("/JOptionPane_Imagenes/salir.png"))); // NOI18N jButton1.setText("SALIR");
public void actionPerformed
(java.
awt.
event.
ActionEvent evt
) { jButton1ActionPerformed(evt);
}
});
getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(540, 10, 150, 60));
jButton2.
setFont(new java.
awt.
Font("Tahoma",
1,
14)); // NOI18N jButton2.
setIcon(new javax.
swing.
ImageIcon(getClass
().
getResource("/JOptionPane_Imagenes/guardar.png"))); // NOI18N jButton2.setText("GUARDAR");
public void actionPerformed
(java.
awt.
event.
ActionEvent evt
) { jButton2ActionPerformed(evt);
}
});
getContentPane().add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, 150, 60));
jButton3.
setFont(new java.
awt.
Font("Tahoma",
1,
14)); // NOI18N jButton3.
setIcon(new javax.
swing.
ImageIcon(getClass
().
getResource("/JOptionPane_Imagenes/remove.png"))); // NOI18N jButton3.setText("ELIMINAR");
public void actionPerformed
(java.
awt.
event.
ActionEvent evt
) { jButton3ActionPerformed(evt);
}
});
getContentPane().add(jButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 10, 150, 60));
jButton4.
setFont(new java.
awt.
Font("Tahoma",
1,
14)); // NOI18N jButton4.
setIcon(new javax.
swing.
ImageIcon(getClass
().
getResource("/JOptionPane_Imagenes/update.png"))); // NOI18N jButton4.setText("ACTUALIZAR");
public void actionPerformed
(java.
awt.
event.
ActionEvent evt
) { jButton4ActionPerformed(evt);
}
});
getContentPane().add(jButton4, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 10, 170, 60));
pack();
}// </editor-fold>
private void jButton2ActionPerformed
(java.
awt.
event.
ActionEvent evt
) { JOptionPane.
showMessageDialog(null,
"SE A GUARDADO EXITOSAMENTE",
"GUARDAR",
JOptionPane.
WARNING_MESSAGE, Guardar
); }
private void jButton3ActionPerformed
(java.
awt.
event.
ActionEvent evt
) { JOptionPane.
showMessageDialog(null,
"SE A ELIMINADO EXITOSAMENTE",
"ELIMINAR",
JOptionPane.
WARNING_MESSAGE, Eliminar
); }
private void jButton4ActionPerformed
(java.
awt.
event.
ActionEvent evt
) { JOptionPane.
showMessageDialog(null,
"SE A ACTUALIZADO EXITOSAMENTE",
"ACTUALIZAR",
JOptionPane.
WARNING_MESSAGE, Actualizar
);
}
private void jButton1ActionPerformed
(java.
awt.
event.
ActionEvent evt
) { }
public static void main
(String args
[]) {
public void run() {
new JOptionPane_Imagenes().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.
swing.
JButton jButton1
; private javax.
swing.
JButton jButton2
; private javax.
swing.
JButton jButton3
; private javax.
swing.
JButton jButton4
; // End of variables declaration
}