public class Cube extends Box{ public static final int DEFAULT = 1; /* Default Cube Colours * LEFT - RED * RIGHT - GREEN * FRONT - YELLOW * BACK - BLUE * TOP - WHITE * BOTTOM - ORANGE */ private static final Color3f COLLEFT = new Color3f(Color.red); private static final Color3f COLRIGHT = new Color3f(Color.green); private static final Color3f COLFRONT = new Color3f(Color.yellow); private static final Color3f COLBACK = new Color3f(Color.blue); private static final Color3f COLTOP = new Color3f(Color.white); private static final Color3f COLBOTTOM = new Color3f(Color.orange); // This cube's TransformGroup private TransformGroup tTG = new TransformGroup(); public Cube(float a, float b, float c, Appearance app) { super(a,b,c,app); this.tTG.addChild(this); } public Cube (int setting) { super(0.1f, 0.1f, 0.1f, new Appearance()); if (setting == Cube.DEFAULT) { // Default cube configuration ColoringAttributes cLeft = new ColoringAttributes(); cLeft.setColor(Cube.COLLEFT); ColoringAttributes cRight = new ColoringAttributes(); cRight.setColor(Cube.COLRIGHT); ColoringAttributes cBack = new ColoringAttributes(); cBack.setColor(Cube.COLBACK); ColoringAttributes cFront = new ColoringAttributes(); cFront.setColor(Cube.COLFRONT); ColoringAttributes cTop = new ColoringAttributes(); cTop.setColor(Cube.COLTOP); ColoringAttributes cBottom = new ColoringAttributes(); cBottom.setColor(Cube.COLBOTTOM); // Set wireframe (this was an attempt to set borders!) // a.setPolygonAttributes(new PolygonAttributes( PolygonAttributes.POLYGON_LINE, PolygonAttributes.CULL_NONE, 0 )); // a.setPolygonAttributes(new PolygonAttributes( PolygonAttributes.POLYGON_FILL, PolygonAttributes.CULL_NONE, 0)); this.getShape(Box.LEFT).getAppearance().setColoringAttributes(cLeft); this.getShape(Box.RIGHT).getAppearance().setColoringAttributes(cRight); this.getShape(Box.TOP).getAppearance().setColoringAttributes(cTop); this.getShape(Box.BOTTOM).getAppearance().setColoringAttributes(cBottom); this.getShape(Box.FRONT).getAppearance().setColoringAttributes(cFront); this.getShape(Box.BACK).getAppearance().setColoringAttributes(cBack); } this.tTG.addChild(this); } /* Getters/Setters */ public TransformGroup getTransform() { return this.tTG; } public void setTransform(TransformGroup tg) { this.tTG = tg; }}