accordion - JavaFX : Text Area comes blurry from FXML File and not expanded

标签 accordion javafx-8 scenebuilder

我有两个问题:

第一个问题是带有文本区域的第二个面板在实例化时变得模糊。有什么想法吗?

第二个问题:当我实例化这个对象时,它出现在两个 Pane 都折叠的地方,即使我将其中一个 Pane 设置为展开。知道为什么会这样吗?

下面是 FXML 代码:

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

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

<AnchorPane id="AnchorPane" fx:id="statePreview" cacheShape="false" centerShape="false" minWidth="0.0" prefHeight="350.0" prefWidth="400.0" scaleShape="false" style="-fx-background-color: whitesmoke; -fx-border-color: grey; -fx-border-width: 0.5;" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
    <Accordion cacheShape="false" centerShape="false" prefHeight="350.0" prefWidth="400.0" scaleShape="false" style="-fx-border-color: black; -fx-border-width: 0.5;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="1.0" AnchorPane.rightAnchor="1.0" AnchorPane.topAnchor="0.0">
        <panes>
            <TitledPane fx:id="contentTP" alignment="CENTER" animated="false" centerShape="false" contentDisplay="CENTER" focusTraversable="false" maxHeight="350.0" maxWidth="400.0" prefHeight="350.0" prefWidth="400.0" scaleShape="false">
                <content>
                    <AnchorPane fx:id="contentAP" prefHeight="300.0" prefWidth="400.0">
                        <children>
                            <CheckBox fx:id="include" mnemonicParsing="false" prefWidth="60.0" text="Select" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="-2.5" />
                            <BorderPane fx:id="borderPane" layoutX="8.5" layoutY="8.5" style="-fx-border-color: black; -fx-border-width: 0.15;" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="20.0" />
                            <Label fx:id="order" alignment="CENTER" contentDisplay="CENTER" layoutX="78.5" layoutY="279.5" prefHeight="17.0" prefWidth="205.0" AnchorPane.leftAnchor="80.0" AnchorPane.rightAnchor="120.0" AnchorPane.topAnchor="-2.5" />
                            <ToggleButton fx:id="publicPrivate" layoutX="293.5" layoutY="271.5" maxHeight="20.0" minHeight="20.0" mnemonicParsing="false" prefHeight="20.0" prefWidth="60.0" text="Public" AnchorPane.rightAnchor="35.0" AnchorPane.topAnchor="-5.0">
                                <font>
                                    <Font size="10.0" />
                                </font>
                            </ToggleButton>

                        </children>
                    </AnchorPane>
                </content>
                <graphic>
                    <Label contentDisplay="RIGHT" layoutX="23.0" layoutY="8.0" prefHeight="17.0" text="Text-Block #">
                        <graphic>
                            <Label fx:id="stateNumber" contentDisplay="RIGHT" layoutX="200.0" layoutY="7.5" prefHeight="20.0" text="000" AnchorPane.topAnchor="10.0">
                                <opaqueInsets>
                                    <Insets left="500.0" />
                                </opaqueInsets>
                                <graphic>
                                    <Label alignment="BASELINE_RIGHT" text="Content" />
                                </graphic>
                            </Label>
                        </graphic>
                    </Label>
                </graphic>
            </TitledPane>
            <TitledPane fx:id="commentTP" alignment="CENTER" animated="false" cacheShape="false" centerShape="false" contentDisplay="CENTER" maxHeight="350.0" maxWidth="400.0" prefHeight="350.0" prefWidth="400.0" scaleShape="false" text="User Comments">
                <content>
                    <AnchorPane fx:id="commentAP" minHeight="0.0" minWidth="0.0" prefHeight="300.0" prefWidth="300.0">
                        <children>
                            <TextArea fx:id="commentArea" layoutX="14.0" layoutY="14.0"     prefHeight="274.0" prefWidth="382.0" promptText="Enter comments about this Text-Block" wrapText="true" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0" />
                        </children>
                    </AnchorPane>
                </content>
            </TitledPane>
        </panes>
    </Accordion>

</children>
<padding>
    <Insets bottom="-2.0" left="-2.0" right="-2.0" top="-2.0" />
</padding>
</AnchorPane>

最佳答案

我对模糊文本也有类似的问题。使用 JavaFX Scene Builder,我注意到在 Layout: Position 下,我的 Layout X/Y 是一个非零值(如 9.893739 等)。当我用 0 替换它们时,模糊的文本消失了。

关于accordion - JavaFX : Text Area comes blurry from FXML File and not expanded,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23795392/

相关文章:

javascript - Bootstrap - 无法让我的 Accordion 在默认情况下保持关闭状态?

jQuery Accordion 一次打开多个部分

java - 如何向 JavaFX 中的 ComboBox 添加掩码?

java - 当你有 CellFactory 时,如何在更改根时完全重置 TreeView?

java - fxml 阶段无法使用 Controller 类构造函数加载

css - :targeting sibling? sibling 的过渡高度

javascript - js中 Accordion 上的各种按钮点击

java - 删除 TextArea 上的制表并转到下一个字段

JavaFX 传递阶段/切换场景

java - FXML TableView "Class fxmlPerson does not support property "bestellnr"