import java.applet.*; import java.awt.*; import java.awt.event.*; public class hue extends Applet { int dw,dh; Image img; Graphics q; public void init() { Dimension d = getSize(); dw = d.width; dh = d.height; img = createImage(dw,dh); q = img.getGraphics(); setBackground(new Color(255,255,255)); } public void paint(Graphics z) { img = createImage(dw,dh); q = img.getGraphics(); int s=(dh/2)-30; for (int i=0;i<12;i++){ double x=dw/2+(double)s*Math.cos((Math.PI*2*(i*30-90))/360); double y=dh/2+(double)s*Math.sin((Math.PI*2*(i*30-90))/360); float h=(float)i/12; Color co = Color.getHSBColor(h,(float)1.0,(float)1.0); int r=co.getRed(); int g=co.getGreen(); int b=co.getBlue(); System.out.print(h); write((int)x,(int)y,r,g,b,q); } z.drawImage(img,0,0,this); } void write(int x,int y,int r,int g,int b,Graphics z) { z.setColor(new Color(r,g,b)); z.fillOval(x-25,y-25,50,50); z.setColor(new Color(255-r,255-g,255-b)); Font f = new Font("MS PƒSƒVƒbƒN",Font.BOLD,11); z.setFont(f); z.drawString(""+edt(r,g,b),x-20,y+5); } String edt(int r,int g,int b){ String t []= {"0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"}; return (""+t[((r-(r%16))/16)]+t[r%16] +t[((g-(g%16))/16)]+t[g%16] +t[((b-(b%16))/16)]+t[b%16]); } }