// D3Polys.java // 3次元 多角形 駆動 クラス // Copyright (C) 1996, 1997 Y.Nagatani // nagatani@eken.phys.nagoya-u.ac.jp import java.applet.Applet; import java.awt.Graphics; import java.awt.Color; import D3Vector; import D3Poly; import D3Polys; public class D3PolysMove extends Applet { public D3Polys polys = new D3Polys (5); public void init() { polys = new D3Polys (5); Color bg = getColorParameter ("background"); if (bg != null) setBackground (bg); else setBackground (Color.lightGray); System.out.println ("D3Poly: background: " + getBackground ()); } public void paint (Graphics g) { // 本当は g.clearRect で行きたいけど、 // g.clearRect (0, 0, size().width, size().height); // g には g の BackGround があるから。 g.setColor (getBackground()); g.fillRect (0, 0, size().width, size().height); g.setColor (getForeground()); // polys.paint (g); polys.move (); // System.out.println ("D3Polys: move¥n"); } public Color getColorParameter (String name) { String value = getParameter (name); int nColor; try {nColor = Integer.parseInt (value, 16);} catch (NumberFormatException e) { return null; } return new Color (nColor); } public int getIntHTML (String Command) throws NumberFormatException { String Contents = getParameter (Command); return Integer.parseInt (Contents); } public String[][] getParameterInfo () { String info[][] = { {"background", "hexadecimal color value", "background color"} }; return info; } public String getAppletInfo () { return "D3PolysMove (test applet for D3Polys class)¥n" + "Copyright(C) 1996, 1997 Y.nagatani¥n" + "nagatani@eken.phys.nagoya-u.ac.jp"; } }