shape.java

来自「包括Rect,Circle两个类」· Java 代码 · 共 41 行

JAVA
41
字号

// Shape class: meant to be a super class for shapes that can act

import java.awt.*;

public class Shape
{
   protected int xpos;
   protected int ypos;

   public Shape( )
   {
      xpos = 0;
      ypos = 0;
   }

   public Shape( int x, int y )
   {
      xpos = x;
      ypos = y;
   }

   public void moveRight()
   {
      xpos += 5;
   }

   public void moveLeft()
   {
      xpos -= 5;
   }
   
   public void act()
   {
   }

   public void draw( Graphics g )
   {
   }
}

⌨️ 快捷键说明

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