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

📄 textdemo.java

📁 java 完全探索的随书源码
💻 JAVA
字号:
// TextDemo.java

import java.awt.*;

public class TextDemo extends java.applet.Applet
{
   public void paint (Graphics g)
   {
      Graphics2D g2 = (Graphics2D) g;

      g.drawString ("Non-rotated text", 50, 50);

      // The following rotate method call concatenates three transforms
      // to the default transform.  The first transform translates
      // subsequent points to the coordinate system's origin by
      // subtracting 50 from the x coordinate and 60 from the y
      // coordinate.  (The assumption is that (50.0, 60.0) is the
      // origin used by subsequent graphics methods.)  Then, these
      // points are rotated around the coordinate system's origin -
      // not (50.0, 60.0).  Finally, each point is translated back to
      // the (50.0, 60.0) origin.

      g2.rotate (45.0 * Math.PI / 180, 50.0, 60.0);

      // We must still pass (50.0, 60.0) as the origin of the text.

      g2.drawString ("Rotated text", 50.0f, 60.0f);
   }
}

⌨️ 快捷键说明

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