📄 circle.java
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package drawfigure;import java.awt.Color; class Circle extends Shape{//定义圆类,继承了形状类 public Circle(){} public Circle(int sx,int sy,int x,int y,Color c,boolean f){ super(sx,sy,x,y,c);fill=f;i=2; } void setValue(int sx,int sy,int x,int y,Color c,boolean f){ super.setValue(sx,sy,x,y,c);fill=f;i=2; } @Override void draw() { x0=x>sx?sx:x;y0=y>sy?sy:y; g.setColor(c); g.setPaintMode(); if(!fill) { g.drawOval(x0,y0,Math.abs(x-sx),Math.abs(y-sy)); } else { g.fillOval(x0,y0,Math.abs(x-sx),Math.abs(y-sy)); } } void wipe() { x0=x>sx?sx:x;y0=y>sy?sy:y; g.setXORMode(back); if(!fill) { g.drawOval(x0,y0,Math.abs(x-sx),Math.abs(y-sy)); } else { g.fillOval(x0,y0,Math.abs(x-sx),Math.abs(y-sy)); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -