import java.awt.*; import java.applet.*; import java.util.*; public class Cube extends Applet { HistPanel histPanel; InfoPanel infoPanel; CubePanel cubePanel; public void init() { Dimension hintSize; hintSize = size(); resize(hintSize.width, hintSize.height); setLayout(new BorderLayout(1,2)); histPanel = new HistPanel(); add("North", histPanel); cubePanel = new CubePanel(); add("Center", cubePanel); infoPanel = new InfoPanel(); add("South", infoPanel); } public boolean mouseUp(java.awt.Event evt, int x, int y) { if (0 == evt.target.getClass().getName().compareTo("BPanel")) { histPanel.newColor(((BPanel)(evt.target)).color()); } return true; } public boolean mouseEnter(java.awt.Event evt, int x, int y) { if (0 == evt.target.getClass().getName().compareTo("BPanel")) { infoPanel.newColor(((BPanel)(evt.target)).color()); } return true; } public void addNotify() { super.addNotify(); } public Dimension preferredSize() { return (new Dimension(700, 1100)); } public Dimension minimumSize() { return (new Dimension(700, 550)); } } class HistPanel extends Panel { final int histsize = 12; BPanel colorPanels[] = new BPanel[histsize]; public HistPanel() { int i; setLayout(new GridLayout(1, histsize)); for (i=0; i