java - Dashes bleed through solid line in JavaFX -
in javafx program draw black, one-pixel dashed line. when draw black, one-pixel solid line on top of can still see dashes bleeding through solid line. happens whether stroke lines on canvas, or use line nodes smooth set true.
why that? there way stop it?
sample program , image attached.
package sandbox2; import javafx.application.application; import javafx.collections.observablelist; import javafx.scene.group; import javafx.scene.node; import javafx.scene.scene; import javafx.scene.paint.color; import javafx.scene.shape.line; import javafx.stage.stage; public class test extends application { public static void main( string[] args ) { launch( args ); } @override public void start( stage primarystage ) throws exception { primarystage.settitle( "fx playground" ); group root = new group(); scene scene = new scene( root, 350, 100 ); primarystage.setscene( scene ); line line1 = new line( 50, 50, 300, 50 ); line1.setstroke( color.black ); line1.getstrokedasharray().addall( 5. ); line1.setsmooth( true ); line line2 = new line( 50, 50, 300, 50 ); line2.setstroke( color.black ); line2.setsmooth( true ); observablelist<node> nodes = root.getchildren(); nodes.add( line1 ); nodes.add( line2 ); primarystage.show(); } }
you should change line constructors new line( 50.5, 50.5, 300, 50 ) assume solve problem. explanation see: https://docs.oracle.com/javase/8/javafx/api/javafx/scene/shape/shape.html

Comments
Post a Comment