?? circlesadded.java
字號(hào):
//Lab 13:Circles.java
//This program draws concentric circles
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class CirclesAdded extends JFrame{
//constructor
public CirclesAdded (){
super( "Circles" );
setSize( 300, 300);
setVisible( true );
}
//draw eight Circles separated by 10 pixels
public void paint( Graphics g ){
super.paint( g );
//create 8 concentric circles
/*Create a for loop that loops eight time. In the body of the loop,
calculate the side of the box bounding the arc and use drawArc to
display a circle.*/
for (int topLeft=0,topLeftCorner=50,side;topLeft<=7;topLeft++)
{
g.setColor(new Color ((float)Math.random(),(float)Math.random(),(float)Math.random()));
side=160 - (20*topLeft);
topLeftCorner+=10;
g.drawArc(topLeftCorner,topLeftCorner,side,side,0,360);
}
}
public static void main( String args[] ){
CirclesAdded application = new CirclesAdded();
application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
}
}//end class Circles
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -