Help!刚写了个画图程序,运行出错!大家帮我看下出了什么问题
主程序:
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;
import java.util.*;
/**
* <p> Title: </p>
* <p> Description: </p>
* <p> Copyright: Copyright (c) 2007 </p>
* <p> Company: </p>
* @author not attributable
* @version 1.0
*/
public class WallFrame extends Applet implements ActionListener,MouseListener,MouseMotionListener{
Point start;
Point last;
int flag;
int i;
private Line line1;
private rectangle rectangle1;
private Graphics2D g2D;
private boolean isStandalone = false;
JPanel jPanel1 = new JPanel();
JPanel jPanel3 = new JPanel();
//new GridLayout(6,0,5,5)
JPanel jPanel4 = new JPanel();
BorderLayout borderLayout2 = new BorderLayout();
JButton newfile = new JButton( "新建 ");
JButton open = new JButton( "打开 ");
JButton save = new JButton( "保存 ");
JButton saveAs = new JButton( "另存为 ");
JButton exit = new JButton( "退出 ");
JButton line = new JButton( "直线 ");
JButton rectangle = new JButton( "矩形 ");
JButton color = new JButton( "颜色 ");
//GridBagLayout gridBagLayout1 = new GridBagLayout();
GridLayout gridLayout1 = new GridLayout();
JLabel jLabel1 = new JLabel();
JTextField jTextField1 = new JTextField();
JLabel jLabel2 = new JLabel();
FlowLayout flowLayout1 = new FlowLayout();
//Get a parameter value
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
}
//Construct the applet
//Initialize the applet
public void init() {
//jPanel1 f=new jPanel1( "paint ");
//Container f=jPanel1.getcont
jPanel1.addMouseListener(new WallFrame());
jPanel1.addMouseMotionListener(new WallFrame());
}
public void paint(Graphics g) {