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

📄 testgraphics.java

📁 关于 AWT 的JAVA 设计 代码 具有一定的参考价值
💻 JAVA
字号:
import java.awt.*;
public class TestGraphics extends Frame
{
     public void paint(Graphics g)
    {
        int x,y,i=0;
        Font font=new Font("Serif",Font.ITALIC|Font.BOLD,40);

        g.setFont(font);
        g.drawOval(60,50,80,80);
        g.setColor(Color.red);

        g.fillOval(150,50,80,80);
        g.setColor(Color.pink);
        
        g.drawString("java",80,260);
        g.setColor(Color.blue);
        for(i=0;i<20;i++)
          {
              x=(int)(Math.random()*300)+30;
              y=(int)(Math.random()*200)+130;
              g.fillOval(x,y,10,10);
          }
          
        g.setColor(Color.orange);
        y=100;
        for(i=0;i<40;i++)
            {
                 y+=5;
                g.drawRect(30,30,320,y);
            }

}


          public static void main(String args[])
          {
                TestGraphics f=new TestGraphics();
                f.setTitle("我的第一个Graphics");
                f.setSize(400,345);
                f.setLocation(0,0);
                f.setVisible(true);
          }
}                      

⌨️ 快捷键说明

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