/** * Method to access appearance of axes in 3D * * @param initValue false if appearance has to be changed according to user value */ public static void setAxisAppearanceValues(Object initValue) { int[] colors = J3DUtils.get3DColorAxes(); for (int i = 0; i < axisApps.length; i++) { Color userColor = new Color(colors[i]); if (axisApps[i] == null) { axisApps[i] = new J3DAppearance(TransparencyAttributes.NONE, 0.5f, userColor); // Turn off face culling so we can see the back side of the labels // (since we're not using font extrusion) PolygonAttributes polygonAttributes = new PolygonAttributes(); polygonAttributes.setCullFace(PolygonAttributes.CULL_NONE); // Make the axis lines 2 pixels wide LineAttributes lineAttributes = new LineAttributes(); lineAttributes.setLineWidth(3.0f); ColoringAttributes colorAttrib = new ColoringAttributes(); colorAttrib.setColor(new Color3f(userColor)); colorAttrib.setCapability(ColoringAttributes.ALLOW_COLOR_READ); colorAttrib.setCapability(ColoringAttributes.ALLOW_COLOR_WRITE); axisApps[i].setColoringAttributes(colorAttrib); axisApps[i].setPolygonAttributes(polygonAttributes); axisApps[i].setLineAttributes(lineAttributes); axisApps[i].setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_READ); axisApps[i].setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE); RenderingAttributes ra = new RenderingAttributes(); ra.setCapability(RenderingAttributes.ALLOW_VISIBLE_READ); ra.setCapability(RenderingAttributes.ALLOW_VISIBLE_WRITE); ra.setVisible(J3DUtils.is3DAxesOn()); axisApps[i].setRenderingAttributes(ra); } else if (initValue == null) // redoing color only when it was changed in GUI axisApps[i].set3DColor(null, userColor); } }