⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mypoint.java~29~

📁 Java画版程序。......................要求变态。
💻 JAVA~29~
字号:
package myshape;/** * Title: * Description: * Copyright:    Copyright (c) 2002 * Company: * @author * @version 1.0 */import java.awt.*;public class MyPoint extends  MyShapeAdapter{  private int x,y; //private MyCircle c; // private boolean attachToOthers=false;  public MyPoint() {  }  public MyPoint(int x,int y){  this.x=x;  this.y=y;  //attachToOthers=attached;  } private Color color; public  void setColor(Color c){   color=c; }  public void paint(Graphics g){    g.setColor(color);    g.fillOval(x-2,y-2,4,4);  }  public MyShape getShape(){      MyPoint p=(MyPoint)this.clone();    //  p.moveObject(x+4,y+4);      return p;  }  public int getX(){  return x;  }  public int getY(){  return y;  }  public boolean nearTo(MyPoint p){  int tempx=this.x-p.getX();  int tempy=this.y-p.getY();  if(tempx*tempx+tempy*tempy<4)   return true;   return false;  }  public String toString(){   String s="点 ";   return s;  }  public void setAttach( ){  }  public void moveObject(int x,int y){   this.x=x;   this.y=y;  }  public boolean nearTo(int x,int y){   if(this.attachToOthers)      return false;   int tempx=this.x-x;   int tempy=this.y-y;   if(tempx*tempx+tempy*tempy<8)     return true;   return false;  } public MyPoint getPoint(){   return this; }// public boolean moveFreely=true;// public boolean moveFo=true;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -