JBUILDER
空指针异常,急求帮助
用JBUILDER2005做个小的聊天软件,但是却总是出现
java.lang.NullPointerException异常,网上有高手说debug以下,可小弟初学,不懂怎样debug,哪位高人能否帮忙DEBUG以下,找出错误,感激不尽!
package simpletalk;
import java.awt.*;
import javax.swing.*;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import java.net.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* <p> Title: </p>
*
* <p> Description: </p>
*
* <p> Copyright: Copyright (c) 2007 </p>
*
* <p> Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class Frame1
extends JFrame {
JPanel contentPane;
XYLayout xYLayout1 = new XYLayout();
JButton jButton1 = new JButton();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JScrollPane jScrollPane1 = new JScrollPane();
JTextArea jTextArea1 = new JTextArea();
XYLayout xYLayout2 = new XYLayout();
JScrollPane jScrollPane2 = new JScrollPane();
JTextArea jTextArea2 = new JTextArea();
DatagramPacket sendPacket,receivePacket;
DatagramSocket sender,receiver;
JTextField jTextField1 = new JTextField();
public Frame1() {
try {
setDefaultCloseOperation(EXIT_ON_CLOSE);
jbInit();
startChat();
}
catch (Exception exception) {
exception.printStackTrace();
}
}
/**
* Component initialization.
*
* @throws
java.lang.Exception */
private void jbInit() throws Exception {
contentPane = (JPanel) getContentPane();
contentPane.setLayout(xYLayout2);
setSize(new Dimension(400, 300));
setTitle( "Frame Title ");
jButton1.setText( "发送 ");
jButton1.addActionListener(new Frame1_jButton1_actionAdapter(this));
jLabel1.setText( "好友 ");
jLabel2.setText( "消息 ");
jTextField1.setText( "jTextField1 ");
jTextArea2.setText( "按当地 ");
jTextArea1.setText( "达到 ");
contentPane.add(jLabel2, new XYConstraints(24, 232, -1, -1));