请大家帮一下忙,谢谢各位了
import java.awt.*; import java.awt.event.*;
class DrawLine2{
Frame f=new Frame("IT人资讯网");
public static void main(String[] args){
new DrawLine2().init();
}
public void init(){
f.setSize(300,300);
f.setVisible(true);
f.addMouseListener(new MouseAdapter()
{
int orgX;
int orgY;
public void mousePressed(MouseEvent e){
orgX=e.getX();
orgY=e.getY();
}
public void mouseReleased(MouseEvent e){
Graphics g=f.getGraphics();
g.setColor(Color.red);
g.setFont(new Font("隶书",Font.ITALTC|Font.BOLD,30));
g.drawString(new String(orgX +","+orgY),orgX,orgY);
g.drawString(new String(orgX()+","+orgY()),e.getX(),e.getY());
g.drawLine(orgX,orgY,e.getX(),e.getY());
}
});
}
}
错误提示
--------------------Configuration: <Default>--------------------
G:\图形界面\Graphics.java:3: 类重复: DrawLine2
class DrawLine2{
^
G:\图形界面\Graphics.java:20: 无法访问 Graphics
错误的类文件: G:\图形界面\Graphics.java
文件不包含类 Graphics
请删除该文件或确保该文件位于正确的类路径子目录中。
Graphics g=f.getGraphics();
^
2 错误
----------------解决方案--------------------------------------------------------
路径名不要用中文
----------------解决方案--------------------------------------------------------