gridbaglayout

need help, why does this crash on launch?

import java.awt.*;

import javax.swing.*;

publicclass WhoWoulduliketokill{

publicstaticvoid main( String args[]){

new test();

}

}

class testextends JPanel{

public test(){

initComponents();

}

privatevoid initComponents(){

// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents

// Generated using JFormDesigner Evaluation license - Kevin Rose

label1 =new JLabel();

textField1 =new JTextField();

label2 =new JLabel();

textField2 =new JTextField();

scrollPane1 =new JScrollPane();

textArea1 =new JTextArea();

button1 =new JButton();

//======== this ========

// JFormDesigner evaluation mark

setBorder(new javax.swing.border.CompoundBorder(

new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),

"JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,

javax.swing.border.TitledBorder.BOTTOM,new java.awt.Font("Dialog", java.awt.Font.BOLD, 12),

java.awt.Color.red), getBorder())); addPropertyChangeListener(new java.beans.PropertyChangeListener(){publicvoid propertyChange(java.beans.PropertyChangeEvent e){if("border".equals(e.getPropertyName()))thrownew RuntimeException();}});

setLayout(new GridBagLayout());

((GridBagLayout)getLayout()).columnWidths =newint[]{0, 0, 0, 0, 0};

((GridBagLayout)getLayout()).rowHeights =newint[]{0, 0, 0, 0, 0, 0, 0};

((GridBagLayout)getLayout()).columnWeights =newdouble[]{0.0, 0.0, 0.0, 0.0, 1.0E-4};

((GridBagLayout)getLayout()).rowWeights =newdouble[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};

//- label1 -

label1.setText("Person To Kill: ");

add(label1,new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,

GridBagConstraints.CENTER, GridBagConstraints.BOTH,

new Insets(0, 0, 5, 5), 0, 0));

//- textField1 -

textField1.setColumns(10);

add(textField1,new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0,

GridBagConstraints.CENTER, GridBagConstraints.BOTH,

new Insets(0, 0, 5, 5), 0, 0));

//- label2 -

label2.setText("How Many Times: ");

add(label2,new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,

GridBagConstraints.CENTER, GridBagConstraints.BOTH,

new Insets(0, 0, 5, 5), 0, 0));

add(textField2,new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,

GridBagConstraints.CENTER, GridBagConstraints.BOTH,

new Insets(0, 0, 5, 5), 0, 0));

//======== scrollPane1 ========

{

//- textArea1 -

textArea1.setRows(3);

scrollPane1.setViewportView(textArea1);

}

add(scrollPane1,new GridBagConstraints(0, 2, 3, 3, 0.0, 0.0,

GridBagConstraints.CENTER, GridBagConstraints.BOTH,

new Insets(0, 0, 5, 5), 0, 0));

//- button1 -

button1.setText("Kill Them!");

add(button1,new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0,

GridBagConstraints.CENTER, GridBagConstraints.BOTH,

new Insets(0, 0, 0, 5), 0, 0));

// JFormDesigner - End of component initialization //GEN-END:initComponents

}

// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables

// Generated using JFormDesigner Evaluation license - Kevin Rose

private JLabel label1;

private JTextField textField1;

private JLabel label2;

private JTextField textField2;

private JScrollPane scrollPane1;

private JTextArea textArea1;

private JButton button1;

// JFormDesigner - End of variables declaration //GEN-END:variables

}

[6812 byte] By [krrose27a] at [2007-11-26 18:12:45]
# 1
Please post Swing-related questions in the Swing forum.
DrLaszloJamfa at 2007-7-9 5:45:40 > top of Java-index,Java Essentials,New To Java...
# 2
This has indeed been reposted in the Swing forum: http://forum.java.sun.com/thread.jspa?threadID=5135970
Torgila at 2007-7-9 5:45:40 > top of Java-index,Java Essentials,New To Java...