leverage.java

来自「一些JAVA的小程序」· Java 代码 · 共 39 行

JAVA
39
字号
import java.awt.*;

public class leverage{

   public leverage(int xPosition,int yPosition,boolean isDown){

       x=xPosition;
       y=yPosition;
       Down=isDown;
   }

   public void draw(Graphics g){
       if (Down){
           g.setColor(Color.red);
           g.drawRect(x,y,30,3);
           g.fillRect(x,y,30,3);
       }
       else{
           g.setColor(Color.red);
           g.drawRect(x-30,y,30,3);
           g.fillRect(x-30,y,30,3);
       }
   }

   //set the value for Down
   public void setDown(boolean flag){
       Down=flag;
   }

   //get the value of Down
   public boolean getDown(){
       return Down;
   }

   int x;
   int y;
   boolean Down;
}

⌨️ 快捷键说明

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