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

📄 circle.java

📁 Java 程序设计教程(第五版)EXAMPLESchap04源码
💻 JAVA
字号:
//********************************************************************//  Circle.java       Author: Lewis/Loftus////  Represents a circle with a particular position, size, and color.//********************************************************************import java.awt.*;public class Circle{   private int diameter, x, y;   private Color color;   //-----------------------------------------------------------------   //  Constructor: Sets up this circle with the specified values.   //-----------------------------------------------------------------   public Circle (int size, Color shade, int upperX, int upperY)   {      diameter = size;      color = shade;      x = upperX;      y = upperY;   }   //-----------------------------------------------------------------   //  Draws this circle in the specified graphics context.   //-----------------------------------------------------------------   public void draw (Graphics page)   {      page.setColor (color);      page.fillOval (x, y, diameter, diameter);   }   //-----------------------------------------------------------------   //  Diameter mutator.   //-----------------------------------------------------------------   public void setDiameter (int size)   {      diameter = size;   }   //-----------------------------------------------------------------   //  Color mutator.   //-----------------------------------------------------------------   public void setColor (Color shade)   {      color = shade;   }   //-----------------------------------------------------------------   //  X mutator.   //-----------------------------------------------------------------   public void setX (int upperX)   {      x = upperX;   }   //-----------------------------------------------------------------   //  Y mutator.   //-----------------------------------------------------------------   public void setY (int upperY)   {      y = upperY;   }   //-----------------------------------------------------------------   //  Diameter accessor.   //-----------------------------------------------------------------   public int getDiameter ()   {      return diameter;   }   //-----------------------------------------------------------------   //  Color accessor.   //-----------------------------------------------------------------   public Color getColor ()   {      return color;   }   //-----------------------------------------------------------------   //  X accessor.   //-----------------------------------------------------------------   public int getX ()   {      return x;   }   //-----------------------------------------------------------------   //  Y accessor.   //-----------------------------------------------------------------   public int getY ()   {      return y;   }}

⌨️ 快捷键说明

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