18/08/2010, 09:46
|
| | Fecha de Ingreso: abril-2009
Mensajes: 121
Antigüedad: 15 años, 6 meses Puntos: 4 | |
Respuesta: Error programando en Swing Hola:
El padre es la clase Borrame que extiende JFrame. Adjunto código:
package borrar;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.Rectangle;
import java.awt.Dimension;
import java.awt.GridBagLayout;
import javax.swing.JLabel;
import javax.swing.border.Border;
import javax.swing.border.LineBorder;
import java.awt.GridBagConstraints;
import java.awt.FileDialog;
import javax.swing.JOptionPane;
import java.awt.event.*;
public class BorrarMe extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JPanel jPanel = null;
private JLabel jLabel = null;
private JButton btnSeleccionar = null;
/**
* This is the default constructor
*/
public BorrarMe() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(516, 228);
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(getJPanel(), null);
}
return jContentPane;
}
/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel() {
if (jPanel == null) {
jLabel = new JLabel();
jLabel.setBounds(new Rectangle(12, 12, 454, 29));
jLabel.setBorder(LineBorder.createGrayLineBorder() );
jLabel.setText("");
jPanel = new JPanel();
jPanel.setLayout(null);
jPanel.setBounds(new Rectangle(14, 16, 482, 90));
jPanel.add(jLabel, null);
jPanel.add(getBtnSeleccionar(), null);
}
return jPanel;
}
/**
* This method initializes btnSeleccionar
*
* @return javax.swing.JButton
*/
private JButton getBtnSeleccionar() {
if (btnSeleccionar == null) {
btnSeleccionar = new JButton();
btnSeleccionar.setBounds(new Rectangle(345, 50, 122, 24));
btnSeleccionar.setText("Seleccionar...");
btnSeleccionar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
JOptionPane.showMessageDialog(this, "Eggs are not supposed to be green.");
}
});
}
return btnSeleccionar;
}
public void actionPerformed(ActionEvent e)
{
//JFileChooser seleccionFichero = new JFileChooser();
JOptionPane.showMessageDialog(this, "Eggs are not supposed to be green.");
}
} // @jve:decl-index=0:visual-constraint="10,10" |