gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 11:21:37 25 4
gpt4 key购买 nike

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

enter image description here

查看表单时我看到了这个:

enter image description here

此处为 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>

第一个 TextArea 中的文本模糊。为什么会发生以及如何解决?

最佳答案

当您使用此组合时会出现问题:TitledPane -> AnchorPane(哪些元素嵌入到 AnchorPane 中并不重要)。当您使用 AnchorPane 约束工具时,嵌套元素会获取宽度、高度、LayoutBounds、BoundsInLocal 和 BoundsInParent 值的工件。这些伪像会影响模糊。

无限制: enter image description here

有限制: enter image description here

为了解决问题,不要使用组合 TitledPane-> AnchorPane 或不要使用工具 AnchorPane Constraints。

关于javafx - 为什么 JavaFX 会模糊控件以及如何修复它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41950075/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com