how can I overcome noncontinuous drawing line in javaFX?

42 Views Asked by At

i have developed pen function using javafx circle shape.The problem is that when I draw quickly, the drawn line or any shape becomes discrete line.

concerned code part of the function:

Pane freePane = new Pane();
freePane.setOnMouseDragged(e1->{
          
       switch(e1.getButton()){
            
           case PRIMARY:
          
               CircleContainer.push(new Circle(e1.getSceneX(),e1.getSceneY(),5,colorValue));
               freePane.getChildren().add((Circle)CircleContainer.peek());  penCounter++;break;
              
            case SECONDARY:
              eraser.realEraser(e1,20);break;
               
           }
       
       
       });
         
       freePane.setOnMouseClicked(e2->{
           
           switch(e2.getButton()){
            case PRIMARY:    
           CircleContainer.push(new Circle(e2.getSceneX(),e2.getSceneY(),5,colorValue));
           freePane.getChildren().add((Circle)CircleContainer.peek());  penCounter++;break; 
                   
           }

Screen capture of the problem:

uncontinous drawing

0

There are 0 best solutions below