List of usage examples for javax.media.j3d LineAttributes PATTERN_DASH
int PATTERN_DASH
To view the source code for javax.media.j3d LineAttributes PATTERN_DASH.
Click Source Link
From source file:LineTypes.java
Group createLineTypes() { Group lineGroup = new Group(); Appearance app = new Appearance(); ColoringAttributes ca = new ColoringAttributes(black, ColoringAttributes.SHADE_FLAT); app.setColoringAttributes(ca);/*w ww. j a v a 2 s. co m*/ // Plain line Point3f[] plaPts = new Point3f[2]; plaPts[0] = new Point3f(-0.9f, -0.7f, 0.0f); plaPts[1] = new Point3f(-0.5f, 0.7f, 0.0f); LineArray pla = new LineArray(2, LineArray.COORDINATES); pla.setCoordinates(0, plaPts); Shape3D plShape = new Shape3D(pla, app); lineGroup.addChild(plShape); // line pattern dot Point3f[] dotPts = new Point3f[2]; dotPts[0] = new Point3f(-0.4f, -0.7f, 0.0f); dotPts[1] = new Point3f(-0.0f, 0.7f, 0.0f); LineArray dot = new LineArray(2, LineArray.COORDINATES); dot.setCoordinates(0, dotPts); LineAttributes dotLa = new LineAttributes(); dotLa.setLineWidth(2.0f); dotLa.setLinePattern(LineAttributes.PATTERN_DOT); Appearance dotApp = new Appearance(); dotApp.setLineAttributes(dotLa); dotApp.setColoringAttributes(ca); Shape3D dotShape = new Shape3D(dot, dotApp); lineGroup.addChild(dotShape); // line pattern dash Point3f[] dashPts = new Point3f[2]; dashPts[0] = new Point3f(-0.0f, -0.7f, 0.0f); dashPts[1] = new Point3f(0.4f, 0.7f, 0.0f); LineArray dash = new LineArray(2, LineArray.COORDINATES); dash.setCoordinates(0, dashPts); LineAttributes dashLa = new LineAttributes(); dashLa.setLineWidth(4.0f); dashLa.setLinePattern(LineAttributes.PATTERN_DASH); Appearance dashApp = new Appearance(); dashApp.setLineAttributes(dashLa); dashApp.setColoringAttributes(ca); Shape3D dashShape = new Shape3D(dash, dashApp); lineGroup.addChild(dashShape); // line pattern dot-dash Point3f[] dotDashPts = new Point3f[2]; dotDashPts[0] = new Point3f(0.5f, -0.7f, 0.0f); dotDashPts[1] = new Point3f(0.9f, 0.7f, 0.0f); LineArray dotDash = new LineArray(2, LineArray.COORDINATES); dotDash.setCoordinates(0, dotDashPts); LineAttributes dotDashLa = new LineAttributes(); dotDashLa.setLineWidth(4.0f); dotDashLa.setLinePattern(LineAttributes.PATTERN_DASH_DOT); Appearance dotDashApp = new Appearance(); dotDashApp.setLineAttributes(dotDashLa); dotDashApp.setColoringAttributes(ca); Shape3D dotDashShape = new Shape3D(dotDash, dotDashApp); lineGroup.addChild(dotDashShape); return lineGroup; }
From source file:AppearanceTest.java
public void onDash() { getLineAttributes().setLinePattern(LineAttributes.PATTERN_DASH); }
From source file:AppearanceExplorer.java
LineAttributesEditor(LineAttributes init) { super(BoxLayout.Y_AXIS); lineAttr = init;/*from w w w .ja v a2 s . c om*/ lineWidth = lineAttr.getLineWidth(); linePattern = lineAttr.getLinePattern(); lineAAEnable = lineAttr.getLineAntialiasingEnable(); FloatLabelJSlider lineWidthSlider = new FloatLabelJSlider("Width", 0.1f, 0.0f, 5.0f, lineWidth); lineWidthSlider.setMajorTickSpacing(1.0f); lineWidthSlider.setPaintTicks(true); lineWidthSlider.addFloatListener(new FloatListener() { public void floatChanged(FloatEvent e) { lineWidth = e.getValue(); lineAttr.setLineWidth(lineWidth); } }); lineWidthSlider.setAlignmentX(Component.LEFT_ALIGNMENT); add(lineWidthSlider); String[] patternNames = { "PATTERN_SOLID", "PATTERN_DASH", "PATTERN_DOT", "PATTERN_DASH_DOT" }; int[] patternValues = { LineAttributes.PATTERN_SOLID, LineAttributes.PATTERN_DASH, LineAttributes.PATTERN_DOT, LineAttributes.PATTERN_DASH_DOT }; IntChooser patternChooser = new IntChooser("Pattern:", patternNames, patternValues, linePattern); patternChooser.addIntListener(new IntListener() { public void intChanged(IntEvent event) { int value = event.getValue(); lineAttr.setLinePattern(value); } }); patternChooser.setAlignmentX(Component.LEFT_ALIGNMENT); add(patternChooser); JCheckBox lineAACheckBox = new JCheckBox(antiAliasString); lineAACheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox checkbox = (JCheckBox) e.getSource(); lineAAEnable = checkbox.isSelected(); lineAttr.setLineAntialiasingEnable(lineAAEnable); } }); lineAACheckBox.setAlignmentX(Component.LEFT_ALIGNMENT); // add the checkbox to the panel add(lineAACheckBox); }