Java - Error en tiempo de ejecucion de un Java swing

 
Vista:

Error en tiempo de ejecucion de un Java swing

Publicado por cuervas (7 intervenciones) el 16/04/2008 13:28:11
Hola: Estoy empezando con el Java Swing, uso el visual editor de Eclipse, la cuestión es que no consigo que al pulsar un botón me aparezca un JDialog. Escribo el codigo para ver si alguien me puede echar una mano:

import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.Dimension;
import java.awt.Rectangle;
import javax.swing.JPopupMenu;
import javax.swing.JWindow;
import java.awt.GridBagLayout;
import javax.swing.JDialog;

public class error1 extends JFrame {

private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JButton boton1 = null;
private JDialog error = null; // @jve:decl-index=0:visual-constraint="310,146"
private JPanel jContentPane1 = null;
/**
* This is the default constructor
*/
public error1() {
super();
initialize();
}

/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(300, 244);
this.setContentPane(getJContentPane());
this.setTitle("JFrame");
}

/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(getBoton1(), null);
}
return jContentPane;
}

/**
* This method initializes boton1
*
* @return javax.swing.JButton
*/

private JButton getBoton1() {
if (boton1 == null) {
boton1 = new JButton();
boton1.setBounds(new Rectangle(13, 10, 81, 24));
boton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
error.setVisible(true); // TODO Auto-generated Event stub actionPerformed()
}
});
}
return boton1;
}

/**
* This method initializes error
*
* @return javax.swing.JDialog
*/
private JDialog getError() {
if (error == null) {
error = new JDialog(this);
error.setContentPane(getJContentPane1());
}
return error;
}

/**
* This method initializes jContentPane1
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane1() {
if (jContentPane1 == null) {
jContentPane1 = new JPanel();
jContentPane1.setLayout(new BorderLayout());
}
return jContentPane1;
}

} // @jve:decl-index=0:visual-constraint="10,10"

Un saludo.
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

RE:Error en tiempo de ejecucion de un Java swing

Publicado por Luis Castro (80 intervenciones) el 20/04/2008 00:06:31
Cambiate a netbeasn 6.0 y solucionado..jaja

no veo en tu codigo donde esta definido lo que contiene tu JDialog?

que hace tiene algo?

public void actionPerformed(java.awt.event.ActionEvent e) {
error.setVisible(true); // TODO Auto-generated Event stub actionPerformed()
//-<-<-< JOptionPane
}
});

error se muestra pero que contiene???
donde esta definido

tiene label?? o

ya provaste poner un simple JOptionPane para ver si se llame tu evento o metodo o lo que manejes?
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