import java.awt.image.*; import java.awt.*; import java.applet.Applet; public class Pildiloomine1 extends Applet{ public Image looPilt(){ int laius=200; int korgus=200; int punktid[] = new int[laius*korgus]; int nr=0; for (int y = 0; y < korgus; y++){ int punane = y; for (int x = 0; x < laius; x++) { int sinine = x; int roheline = 50; punktid[nr++] = (255<<24)|(punane << 16) | roheline << 8 | sinine; } } return createImage(new MemoryImageSource(laius, korgus, punktid, 0, laius)); } public void paint(Graphics g){ Image pilt=looPilt(); g.drawImage(pilt, 0, 0, null); } public static void main(String argumendid[]){ Frame f=new Frame(); f.add(new Pildiloomine1()); f.setSize(200, 220); f.setVisible(true); } }