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

📄 towerpoint.java

📁 《Java课程设计》第二版
💻 JAVA
字号:
import java.awt.*;
public class TowerPoint{
    int x,y;                  
    boolean haveDisc;           
    Disc disc=null;
    public TowerPoint(int x,int y){
 
       this.x=x;
       this.y=y;
    }
    public boolean isHaveDisc(){
        return haveDisc;
    }
    public void setHaveDisc(boolean boo){
        haveDisc=boo;
    }
    public int getX(){
        return x;
    }
    public int getY(){
        return y;
    }
    public boolean equals(TowerPoint p){
       if(p.getX()==this.getX()&&p.getY()==this.getY())
          return true;
       else
          return false; 
    }
    public void putDisc(Component com,Container con){
        disc=(Disc)com;
        con.setLayout(null);
        con.add(disc);
        int w=disc.getBounds().width;
        int h=disc.getBounds().height;
        disc.setBounds(x-w/2,y-h/2,w,h);
        haveDisc=true;
        disc.setPoint(this);
        con.validate(); 
    }
    public Disc getDiscOnPoint(){
        return disc;
    }
    public void removeDisc(Component com,Container con){
        if(com!=null) 
           con.remove(com);
        con.validate(); 
    }
}

⌨️ 快捷键说明

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