为什么JavaFX模糊控件以及如何修复它?

为什么JavaFX模糊控件以及如何修复它?,javafx,scenebuilder,Javafx,Scenebuilder,我有一个简单的JavaFX应用程序,有两个TextArea,没有样式属性: 查看表单时,我看到以下内容: FXML代码如下: <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.control.*?> <?import java.lang.*?> <?import javafx.scene.layout.*?> <AnchorPane maxHeight="-In

我有一个简单的JavaFX应用程序,有两个TextArea,没有样式属性:

查看表单时,我看到以下内容:

FXML代码如下:

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>


<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
   <children>
      <TitledPane animated="false" prefWidth="300.0" text="untitled" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
         <content>
            <TextArea prefHeight="200.0" prefWidth="200.0" />
         </content>
      </TitledPane>
      <SplitPane dividerPositions="0.5" orientation="VERTICAL" prefHeight="200.0" prefWidth="160.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="300.0" AnchorPane.topAnchor="0.0">
        <items>
          <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0">
               <children>
                  <TitledPane animated="false" text="untitled" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
                    <content>
                      <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
                           <children>
                              <TextArea prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="-10.0" AnchorPane.leftAnchor="-10.0" AnchorPane.rightAnchor="-10.0" AnchorPane.topAnchor="-10.0" />
                           </children>
                        </AnchorPane>
                    </content>
                  </TitledPane>
               </children>
            </AnchorPane>
          <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0" />
        </items>
      </SplitPane>
   </children>
</AnchorPane>


第一个文本区域中的文本模糊。为什么会发生这种情况以及如何修复它?

您已将拆分窗格中的文本区域包装在另一个AnchorPane中。如果删除,则模糊消失。我不知道为什么,但我可以让它与此代码一起工作

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>


<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0"
            prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
    <TitledPane animated="false" prefWidth="300.0" text="test2" AnchorPane.bottomAnchor="0.0"
                AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
        <TextArea prefHeight="200.0" prefWidth="200.0"/>
    </TitledPane>
    <SplitPane dividerPositions="0.5" orientation="VERTICAL" prefHeight="200.0" prefWidth="160.0"
               AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="300.0"
               AnchorPane.topAnchor="0.0">
        <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0">
            <TitledPane animated="false" text="test" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
                        AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
                    //deleted AnchorPane here
                    <TextArea prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="-10.0"
                              AnchorPane.leftAnchor="-10.0" AnchorPane.rightAnchor="-10.0"
                              AnchorPane.topAnchor="-10.0"/>
            </TitledPane>
        </AnchorPane>
        <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0"/>
    </SplitPane>
</AnchorPane>

//删除了这里的锚烷

使用此组合时会出现问题:
标题窗格->Ancorpane
(嵌入Ancorpane的元素并不重要)。使用AnchorPane约束工具时,嵌套元素将获得宽度、高度、LayoutBounds、BoundsInLocal和BoundsInParent值的工件。这些瑕疵会影响模糊效果

无限制:

有一些限制:


为了解决此问题,请不要使用组合
标题窗格->锚泊烷
或使用工具锚泊烷约束

也许您在文本区域中设置了
提示文本
,而不是
文本
?或者在场景生成器中设置模糊效果?在问题MBEC中发布FXML,不,我没有使用任何效果,也没有设置提示文本。James_D,为您添加FXML代码谢谢您的回答。我知道模糊是由于高嵌入。此示例是综合生成的,以显示问题。我想知道为什么会这样。在模糊发生时提供更多的洞察力。还是不知道原因是什么。