Text selection issue with embedded JavaFX into SWT

167 views Asked by At

I am having a problem with my JavaFX TextArea. I use the FXCanvas to embed an few JavaFX controls into an SWT composite. Everything works fine except for the TextArea which doesn't allow me to highlight text by dragging. Double click and "right click"/"select all" work fine, so text selection does work.

My objects are defined in an FXML file, you cannot do anything simpler:

<Accordion fx:id="accordion" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.kratos.birt.report.data.oda.kairosdb.ui.FXMLController">
  <panes>
    <TitledPane fx:id="builderPane" text="Query Builder">
      ...
    </TitledPane>
    <TitledPane fx:id="jsonPane" text="Raw Query">
      <content>
            <VBox>
               <children>
                  <Label text="Enter your query:">
                     <VBox.margin>
                        <Insets bottom="5.0" />
                     </VBox.margin>
                  </Label>
                  <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" VBox.vgrow="ALWAYS">
                     <children>
                        <TextArea fx:id="queryArea" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
                     </children>
                  </AnchorPane>
               </children>
            </VBox>
      </content>
    </TitledPane>
  </panes>
</Accordion>

I don't do any modification on it in the code, except for setting some text. The dragging selection doesn't work either if the TextArea isn't in the Accordion container.

1

There are 1 answers

0
Remi D On BEST ANSWER

The solution I found was to downgrade the version of the JRE (and thus the version of JavaFX) from 8 to 7.