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

📄 fillarcsapplet.java

📁 提供 精通Java Web动态图表编程 一书的源代码, 大家赶快下载呀
💻 JAVA
字号:
// Fig. 2.9_02: FillArcsApplet.java
// 绘制实心圆弧

import java.awt.*; // 引入 java.awt包中所有的类
import javax.swing.*; // 引入 javax.swing包中所有的类

public class FillArcsApplet extends JApplet
{
    // 在applet上绘制实心圆弧
    public void paint(Graphics g)
    {
        // 调用父类的 paint 方法
        super.paint(g);

        // 设置字体
        g.setFont(new Font("汉真广标", Font.PLAIN, 35));
        g.drawString("实心圆弧的画法", 10, 40);

        // 绘制浅灰色矩形
        g.setColor(Color.LIGHT_GRAY);
        g.drawRect(10, 60, 150, 120);
        g.drawRect(210, 60, 120, 120);
        g.drawRect(10, 210, 150, 120);
        g.drawRect(210, 210, 120, 120);

        g.setColor(Color.BLUE);

        // 绘制实心圆弧1		
        g.fillArc(10, 60, 150, 120, 0, 360);

        // 绘制实心圆弧2
        g.fillArc(210, 60, 120, 120, 90, 270);

        g.setColor(Color.RED);

        // 绘制实心圆弧3
        g.fillArc(10, 210, 150, 120, 30,  - 150);

        // 绘制实心圆弧4
        g.fillArc(210, 210, 120, 120,  - 90,  - 270);

    } // paint 方法结束

} //  FillArcsApplet 类结束

/**************************************************************************
 * (C) Copyright 2004-2005 by Jingkui Zhong(钟京馗) and Huan Tang(唐桓).  *
 * All Rights Reserved.                                                   *
 *                                                                        *
 * DISCLAIMER: The authors of this code have used their                   *
 * best efforts in preparing the code. These efforts include the          *
 * development, research, and testing of the theories and programs        *
 * to determine their effectiveness. The authors and publisher make       *
 * no warranty of any kind, expressed or implied, with regard to these    *
 * programs or to the documentation contained in these codes. The authors *
 * shall not be liable in any event for incidental or consequential       *
 * damages in connection with, or arising out of, the furnishing,         *
 * performance, or use of these programs.                                 *
   **************************************************************************/

⌨️ 快捷键说明

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