Eso pasa al hacer un jar? Lo que pasa que estoy en netbeans y al a hora de correr la aplicacion ahi mismo ... es donde si doy click en la X(hablamos de la x de cerrar,que esta a lado de maximizar,etc) cierra todas las ventanas..
Por lo menos yo no he agregado un evento... a no ser que netbeans solo lo genere, te dejo el codigo por si le quieres hechar un vistaso:
Código PHP:
/*
* principal.java
*
* Created on 13 de octubre de 2006, 06:53 AM
*/
package cfe.medicion;
import java.awt.event.ActionEvent;
import javax.swing.*;
import javax.swing.event.*;
/**
*
* @author TDD060-01
*/
public class principal extends javax.swing.JFrame{
/**
* Creates new form principal
*/
public principal() {
initComponents();
inic();
}
/** 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.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
//declaracion de elementos GUI
org.jdesktop.layout.GroupLayout jDialog1Layout = new org.jdesktop.layout.GroupLayout(jDialog1.getContentPane());
jDialog1.getContentPane().setLayout(jDialog1Layout);
jDialog1Layout.setHorizontalGroup(
jDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 400, Short.MAX_VALUE)
);
jDialog1Layout.setVerticalGroup(
jDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 300, Short.MAX_VALUE)
);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(javax.swing.UIManager.getDefaults().getColor("close_button_border_focus"));
setForeground(new java.awt.Color(255, 153, 102));
setResizable(false);
jLabel1.setFont(new java.awt.Font("MS Sans Serif", 1, 14));
jLabel1.setText("B\u00fasqueda por :");
m1_71.setSelected(true);
m1_71.setText("Tarifa 71");
m1_71.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
m1_71.setMargin(new java.awt.Insets(0, 0, 0, 0));
m1_71.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m1_71ActionPerformed(evt);
}
});
m1_64.setText("Tarifa 64");
m1_64.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
m1_64.setMargin(new java.awt.Insets(0, 0, 0, 0));
m1_64.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m1_64ActionPerformed(evt);
}
});
jButton1.setText("Buscar...");
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton1MouseClicked(evt);
}
});
jLabel2.setFont(new java.awt.Font("MS Sans Serif", 1, 14));
jLabel2.setText("Modificar:");
m2_71.setText("Tarifa 71");
m2_71.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
m2_71.setMargin(new java.awt.Insets(0, 0, 0, 0));
m2_71.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m2_71ActionPerformed(evt);
}
});
m2_64.setText("Tarifa 64");
m2_64.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
m2_64.setMargin(new java.awt.Insets(0, 0, 0, 0));
m2_64.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m2_64ActionPerformed(evt);
}
});
jButton2.setText("Modificar..");
jLabel3.setFont(new java.awt.Font("MS Sans Serif", 1, 14));
jLabel3.setText("Agregar:");
m3_71.setText("Tarifa 71");
m3_71.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
m3_71.setMargin(new java.awt.Insets(0, 0, 0, 0));
m3_71.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m3_71ActionPerformed(evt);
}
});
m3_64.setText("Tarifa 64");
m3_64.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
m3_64.setMargin(new java.awt.Insets(0, 0, 0, 0));
m3_64.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m3_64ActionPerformed(evt);
}
});
jButton3.setText("Agregar...");
jLabel4.setFont(new java.awt.Font("MS Sans Serif", 1, 24));
jLabel4.setForeground(new java.awt.Color(0, 153, 102));
jLabel4.setText("M E D I C I \u00d3 N ");
jLabel5.setFont(new java.awt.Font("MS Sans Serif", 3, 14));
jLabel5.setForeground(new java.awt.Color(0, 102, 102));
jLabel5.setText("Pruebas");
la.setText("}");
l.setText("bueno");
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
m1_64.setText("skk");
busqueda bs= new busqueda();
bs.setVisible(true);
}
/**
* @param args the command line arguments
*/
public void inic(){
ButtonGroup group = new ButtonGroup();
group.add(m1_71);
group.add(m1_64);
group.add(m2_71);
group.add(m2_64);
group.add(m3_71);
group.add(m3_64);
m1_64.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(ChangeEvent e) {
m1_64_stateChanged(e);
}
});
}
public void m1_64_actionPerfomed(ActionEvent e){
String factoryName=null;
l.setText("s");
if (e.getActionCommand() == "Tarifa 64") {
l.setVisible(true);
l.setText("siiii");
} else {
l.setVisible(true);
l.setText("hola");
}
}
public void m1_64_stateChanged(ChangeEvent e){
int i=0;
if (m1_64.isSelected()){
la.setVisible(true);
la.setText("prueba"+i);
i++;
}
else{
la.setVisible(false);
}
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new principal().setVisible(true);
}
});
}
}