電子書籍の厳選無料作品が豊富!

javaにおいてコンパイルをすると次のようなエラーが出てきます。
力不足で解決することができません。
どうか力を貸してください。
エラーは以下のように出てきます。
よろしくお願いします。
シンボルがみつかりません
シンボル: コンストラクタ DrawPanelMouseHandler(DrawPanel)
場所 : DrawPanelMouseHandler の クラス
mouseHandler = new DrawPanelMouseHandler(this);
mouseHandler = new DrawPanelMouseHandler(this);import java.awt.*;
import java.util.ArrayList;
import javax.swing.JPanel;
import javax.swing.JButton;
public class DrawPanel extends JPanel {
ArrayList<Shape> shapeList = new ArrayList<Shape>();
DrawPanelMouseHandler mouseHandler;


public void paintComponent(Graphics g) {

super.paintComponent(g);
for(Shape shape: shapeList){
shape.draw(g);
}
}
public DrawPanel(){
mouseHandler = new DrawPanelMouseHandler(this);
this.addMouseListener(mouseHandler);
this.addMouseMotionListener(mouseHandler);
ShapeFactory circleFactory = new CircleFactory();
UIToolButton circleButton = new UIToolButton(circleFactory, this, "Circle");
this.add(circleButton);
}
public void addShape(Shape s) {
shapeList.add(s);
repaint();


}
}


import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;


public class UIToolButton extends JButton implements ActionListener{
DrawPanelMouseHandler mouseHandler;
ShapeFactory factory;


public UIToolButton(ShapeFactory factory, DrawPanelMouseHandler mouseHandler, String text) {
super(text);
this.addActionListener(this);
this.mouseHandler = mouseHandler;
this.factory = factory;
}


public void actionPerformed (ActionEvent ae) {
mouseHandler.setShapeFactory(factory);
}

}

A 回答 (2件)

DrawPanelMouseHandlerクラスは作りました?


MouseListenerインタフェースを実装したDrawPanelMouseHandlerクラスが必要では。
    • good
    • 0

「シンボルがみつかりません


シンボル: コンストラクタ DrawPanelMouseHandler(DrawPanel)」
って書いてあるんだから, コンストラクタがないんでは?

この回答への補足

エラーを間違えていました。すいません
DrawPanelMouseHandlerではなくUIToolButtonのコンストラクタでした。
すいません;;

補足日時:2010/07/18 00:51
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!