View Single Post
  #1 (permalink)  
Old 11-22-2009, 05:28 PM
Arnold Arnold is offline
Member
 
Join Date: Oct 2009
Location: Rotterdam
Posts: 39
Rep Power: 0
Arnold is on a distinguished road
Unhappy What's wrong with this applet?
I just made my first applet. The purpose of it is to show a color map of red horizontally and blue vertically.
It compiles, but it doesn't work on a html page or a browser.
Anyone know what's wrong with it?

Code:
import java.awt.*;
import javax.swing.*;
class colors extends JApplet {
	public void init() {
		JPanel panel = new JPanel();
		panel.setLayout(new GridLayout(64, 64));
		for (short i = 0; i < 0x100; i += 4) {
			for (short j = 0; j < 0x100; j += 4) {
				JPanel subpanel = new JPanel();
				subpanel.setBackground(new Color(j, 0, i));
				panel.add(subpanel);
			}
		}
		getContentPane().add(panel);
	}
}
Reply With Quote