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

📄 rect.java

📁 包括Rect,Circle两个类
💻 JAVA
字号:

// Rect:  Rectangle that may be drawn filled

import java.awt.*;

public class Rect extends Shape
{
   private int height, width;
   private boolean filled;
   
   public Rect( int x, int y, int h, int w )
   {
	  super( x, y );
	  height = h;
	  width = w;
	  filled = false;
   }
   
   public void act()
   {
	   filled = !filled;
   }

   public void draw( Graphics g )
   {
	  if ( filled )
	  {
		 g.setColor( Color.yellow );
         g.fillRect( xpos, ypos, width, height ); 
		 g.setColor( Color.black );
	  }
	  else
	  {
         g.drawRect( xpos, ypos, width, height );
	  }
   }
}

⌨️ 快捷键说明

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