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

📄 myicon.java

📁 java绘图 java awt 经典绘图的例子,对于初学awt模块的人非常有帮助.
💻 JAVA
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package awt;import java.awt.Color;import java.awt.Component;import java.awt.Graphics;import javax.swing.Icon;/** * * @author zhaolin */public class MyIcon implements Icon{    private int width,height;        public MyIcon(int w,int h){        this.width = w;        this.height = h;    }    public void paintIcon(Component c, Graphics g, int x, int y) {        g.setColor(Color.BLACK);        g.fillRect(x, y, width, height);        int span = width/3;        Color color = Color.WHITE;        for (int i = 0; i < 3; i++) {            g.setColor(color);            g.fillOval(i*span+3+x,2+y, span-4, height-4);            color = color.darker();        }    }    public int getIconWidth() {        return this.width;    }    public int getIconHeight() {        return this.height;    }    }

⌨️ 快捷键说明

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