2017-01-31 3 views
1

Ich habe diese einfache Form der JavaFX-Anwendung mit zwei TextArea- ohne Stileigenschaften:Warum JavaFX Kontrollen verwischt und wie man es repariert?

enter image description here

Wenn das Formular sehen ich sehen:

enter image description here

FXML Code hier:

<?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> 

Der Text in der ersten TextArea verschwommen. Warum es passiert und wie man es repariert?

+0

Vielleicht haben Sie in TextArea 'Text eingeben' anstelle von' Text' gesetzt? Oder den Blur-Effekt im Szenen-Generator einstellen? – MBec

+0

Post die FXML in Ihrer Frage –

+0

MBec, nein, ich habe keine Effekte verwendet und ich habe keine Eingabetext festgelegt. James_D, fügen Sie FXML-Code für Sie – gearquicker

Antwort

1

Das Problem tritt auf, wenn Sie diese Kombination verwenden: TitledPane -> AnchorPane (Es spielt keine Rolle, welche Elemente in die AnchorPane eingebettet). Wenn Sie das AnchorPane Constraints-Tool verwenden, erhalten verschachtelte Elemente Artefakte der Werte von Width, Height, LayoutBounds, BoundsInLocal und BoundsInParent. Diese Artefakte beeinflussen die Unschärfe.

Keine Constraints: enter image description here

Es gibt Constraints: enter image description here

Für die Lösung des Problems nicht verwenden Kombination TitledPane-> AnchorPane oder Werkzeug AnchorPane Einschränkungen nicht verwenden.

1

Sie haben die TextArea im SplitPane in einem anderen AnchorPane eingeschlossen. Wenn Sie löschen, ist die Unschärfe verschwunden. Ich weiß nicht warum, aber ich könnte es mit diesem Code arbeiten lassen.

<?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> 
+0

Danke für die Antwort. Ich weiß, dass die Unschärfe auf die hohe Einbettung zurückzuführen ist. Dieses Beispiel wurde synthetisch erstellt, um das Problem zu zeigen. Ich möchte wissen, warum das passiert. – gearquicker

+1

[This] (http://stackoverflow.com/questions/22119479/adding-anchorpanes-to-scrollpanes-javafx-8) gibt mehr Einblick, wenn die Unschärfe auftritt. Ich weiß immer noch nicht, was die Ursache ist. – Nash

Verwandte Themen