swing 教程,与大家分享一下,哈哈,希望大家多多指教

源代码在线查看: coloricon.java

软件大小: 4413 K
上传用户: snowpilce
关键词: swing 教程
下载地址: 免注册下载 普通下载 VIP

相关代码

				import java.awt.*;
				import javax.swing.*;
				
				class ColorIcon implements Icon {
					private Color fillColor;
					private int w, h;
				
					public ColorIcon(Color fillColor, int w, int h) {
						this.fillColor = fillColor;
						this.w = w;
						this.h = h;
					}
					public void paintIcon(Component c, Graphics g, int x, int y) {
						g.setColor(Color.black);
						g.drawRect(x, y, w-1, h-1);
						g.setColor(fillColor);
						g.fillRect(x+1, y+1, w-2, h-2);
					}
					public int getIconWidth() {
						return w;
					}
					public int getIconHeight() {
						return h;
					}
				}
							

相关资源