import java.awt.*; import java.awt.image.*; public class Graphics1 { static public void main(String[] args) { final int YELLOW = 0xFFFF00; // Color code for yellow /* ------------------------------------------------ Preparing to draw picture... ------------------------------------------------ */ Frame f = new Frame( "My image" ); // Create a window Canvas pic = new MyCanvas(); // Make a MyCanvas f.add("Center", pic); // Put the MyCanvas in the window f.setSize(400,300); // Set window size f.setVisible(true); // Make window visible /* ------------------------------------------------ Now we are ready to draw things... For starters, let's draw a horizontal line ------------------------------------------------ */ for (int col = 0; col < 400 ; col++ ) MyCanvas.Image.setRGB(col, 100, YELLOW); // draw yellow horizontal line // at row = 100 pic.repaint(); // Repaint the picture } }