drawmultistringapplet2.java

来自「提供 精通Java Web动态图表编程 一书的源代码, 大家赶快下载呀」· Java 代码 · 共 37 行

JAVA
37
字号
// Fig. 2.3_03: DrawStringApplet2.java
// 第三个Java Applet程序, 用(\n)绘制多行文本

// 引入相关的包
import java.awt.Graphics; // 引入 Graphics 类
import javax.swing.JApplet; // 引入 JApplet 类

public class DrawMultiStringApplet2 extends JApplet
{

    // 在applet上绘制文本
    public void paint(Graphics g)
    {
        // 调用父类的 paint 方法
        super.paint(g);

        g.drawString("欢迎来到《精通Java Web动态图表编程》的世界!\n不用不知道,Java真奇妙!", 25, 25);

    } // paint 方法结束

} // DrawMultiStringApplet2 类结束

/**************************************************************************
 * (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 + =
减小字号Ctrl + -
显示快捷键?