Javafx 2 如何在javaFX中实现抗锯齿?我应用了一些技巧。。。但它没有';行不通

Javafx 2 如何在javaFX中实现抗锯齿?我应用了一些技巧。。。但它没有';行不通,javafx-2,javafx-8,Javafx 2,Javafx 8,在阅读了这个问题之后,看起来我已经问了已经被问过的问题,但是相信我,我已经尝试了可能的解决方案,在那里我没有得到想要的结果 首先,我想要实现什么 为了实现抗锯齿,我尝试了以下方法 新场景(,,,SceneAntialiasing.BALANCED) 形状[对象].setSmooth(真) System.setProperty(“prism.lcdtext”、“false”);从链接 我也尝试过使用亚场景,但这有点不合适 但是上面的解决方案都不适合我。。。所以现在,我发布 SSCVE 请帮我做

在阅读了这个问题之后,看起来我已经问了已经被问过的问题,但是相信我,我已经尝试了可能的解决方案,在那里我没有得到想要的结果

首先,我想要实现什么

为了实现抗锯齿,我尝试了以下方法

  • 新场景(,,,SceneAntialiasing.BALANCED)
  • 形状[对象].setSmooth(真)
  • System.setProperty(“prism.lcdtext”、“false”);从链接
  • 我也尝试过使用亚场景,但这有点不合适
  • 但是上面的解决方案都不适合我。。。所以现在,我发布 SSCVE

    请帮我做这个

    先谢谢你

    SSCVE

    the CreateScene method in UI class which  extends JFXPanel looks like ....  
    
    private Scene createScene() 
    {  
    
        Group rootNode = new Group();
        //System.setProperty("prism.lcdtext", "false");
        double StrokeWidth = 1.0;
        double yPosition = 20.0;
        //textFontsize = textFontsize + 0.7 ;
    
        // straight Vertical Lines
    
                rootNode.getChildren().add(createLines(35.0, yPosition+20, 35.0, yPosition+150, StrokeWidth,"GREEN"));
                rootNode.getChildren().add(createLines(25.0, yPosition+20, 25, yPosition+150, StrokeWidth,"BLACK"));
                rootNode.getChildren().add(createLines(30.0, yPosition+20, 30, yPosition+150, StrokeWidth,"BLUE"));
    
                // straight horizontal lines
    
                rootNode.getChildren().add(createLines(80.0, yPosition+30, 240, yPosition+30, StrokeWidth,"RED"));
                rootNode.getChildren().add(createLines(80.0, yPosition+40, 240, yPosition+40, StrokeWidth,"GREEN"));
                rootNode.getChildren().add(createLines(80.0, yPosition+50, 240, yPosition+50, StrokeWidth,"BLACK"));
    
                // create slope lines 
    
                rootNode.getChildren().add(createLines(420.0, yPosition+20, 470, yPosition+150, StrokeWidth,"BLACK"));
                rootNode.getChildren().add(createLines(430.0, yPosition+20, 480, yPosition+150, StrokeWidth,"RED"));
                rootNode.getChildren().add(createLines(440.0, yPosition+20, 490, yPosition+150, StrokeWidth,"BLUE"));
                rootNode.getChildren().add(createLines(450.0, yPosition+20, 500, yPosition+150, StrokeWidth,"GREEN"));
    
                double textFontsize = 12.0;
                String fontColor = "RED";
    
                String font ="Arial";
                int count = 5;
                String newLine = null;
    
                if(count == 5)
                {
                    newLine = "\n\n\n\n\n";
                }
    
                rootNode.getChildren().add(createText(50,yPosition+230,font,textFontsize, newLine+"15352465 \n"
                        + "Circle is "+StrokeWidth+" . "+"Font name is "+font+" . Minimum visible font size is 0.7 ."
                        + "\n The Font size for text is "+textFontsize+". ",fontColor, StrokeWidth));
    
    
        ScrollPane scroll = new ScrollPane();
        scroll.setHbarPolicy(ScrollBarPolicy.ALWAYS);
        scroll.setVbarPolicy(ScrollBarPolicy.NEVER);
        scroll.setContent(rootNode);
    
        //iv.setClip(new Rectangle(0,20,250,200));
        Scene sc =  new  Scene(scroll, 500,500,false,SceneAntialiasing.BALANCED); 
        SceneAntialiasing value = sc.getAntiAliasing();
        return sc;
    }
    
    public Line createLines(double startX, double startY, double endX, double endY, double strokeWidth, String strokeColor)
    {
        Line line = new Line(startX-0.5, startY-0.5, endX-0.5, endY-0.5);   
        if(strokeColor.equals("BLUE"))
        {
            line.setStroke(javafx.scene.paint.Color.BLUE);
        }
        else if(strokeColor.equals("RED"))
        {
            line.setStroke(javafx.scene.paint.Color.RED);
        }
        else if(strokeColor.equals("GREEN"))
        {
            line.setStroke(javafx.scene.paint.Color.GREEN);
        }
        else if(strokeColor.equals("BLACK"))
        {
            line.setStroke(javafx.scene.paint.Color.BLACK);
        }
        line.setStrokeWidth(strokeWidth);
        //line.setSmooth(true);
        return line;
    }
    
    
    
    public Text createText(double xParam, double yParam, String fontType, double fontSize, String text, String strokeColor, double StrokeWidth)
    {
         Text txt = new Text(text);
         txt.setX(xParam);
         txt.setY(yParam);  
    
    
    
         if(fontType.equals("Comic Sans MS"))
         {
             txt.setFont(Font.font(fontType,FontWeight.BOLD, fontSize));
         }
         else
         {
             txt.setFont(Font.font(fontType, fontSize));
         }
    
         //txt.setStrokeWidth(StrokeWidth);
         if(strokeColor.equals("BLUE"))
            {
                txt.setFill(Color.BLUE);
            }
            else if(strokeColor.equals("RED"))
            {
                txt.setFill(javafx.scene.paint.Color.RED);
            }
            else if(strokeColor.equals("GREEN"))
            {
                txt.setFill(javafx.scene.paint.Color.GREEN);
            }
            else if(strokeColor.equals("BLACK"))
            {
                txt.setFill(javafx.scene.paint.Color.BLACK);
            }
            else if(strokeColor.equals("BROWN"))
            {
                txt.setFill(javafx.scene.paint.Color.BROWN);
            }
        // txt.setFontSmoothingType(FontSmoothingType.LCD);
        // txt.setStrokeType(StrokeType.INSIDE);
         return txt;
    }