Reputation: 954
I am building an javaFx application, the ui is build in an fxml file, I am using an anchor pane inside it a HBox an then a table but a strange blue line is appearing in my table first row and is surrounding.
I have attached a screenshot also.
my fxml file is:-
<?import java.lang.String?>
<?import javafx.collections.FXCollections?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<AnchorPane fx:id="ap" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.Buildsapp.Main.BuildsController">
<children>
<HBox alignment="CENTER_LEFT" layoutX="6.0" layoutY="14.0" spacing="20.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<padding>
<Insets left="10.0" right="3.0" top="5.0" />
</padding>
</HBox>
<TableView fx:id="tableView" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="2.0" AnchorPane.rightAnchor="2.0" AnchorPane.topAnchor="70.0">
<columns>
<TableColumn fx:id="builds" prefWidth="482.0" text="Builds" />
<TableColumn fx:id="date" minWidth="0.0" prefWidth="500.0" text="Date" />
</columns>
</TableView>
<ComboBox fx:id="versionCombo" layoutX="2.0" layoutY="28.0" prefHeight="31.0" prefWidth="108.0">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="Win" />
<String fx:value="Mac" />
</FXCollections>
</items>
<value>
<String fx:value="Mac" />
</value>
</ComboBox>
<ComboBox fx:id="verCombo" layoutX="127.0" layoutY="28.0" prefHeight="31.0" prefWidth="127.0" promptText="builds">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="builds" />
<String fx:value="builds2" />
</FXCollections>
</items>
</ComboBox>
<ComboBox fx:id="versionNo" layoutX="265.0" layoutY="28.0" prefHeight="31.0" prefWidth="109.0" />
<ComboBox fx:id="locCombo" layoutX="391.0" layoutY="28.0" prefHeight="31.0" prefWidth="103.0">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="SJ" />
<String fx:value="MN" />
</FXCollections>
</items>
<value>
<String fx:value="SJ" />
</value>
</ComboBox>
<Button fx:id="downloadButton" layoutX="505.0" layoutY="28.0" minWidth="80.0" mnemonicParsing="false" text="Download" />
<Button fx:id="installButton" layoutX="614.0" layoutY="28.0" minWidth="80.0" mnemonicParsing="false" text="Install" />
<Button fx:id="locButton" layoutX="721.0" layoutY="28.0" mnemonicParsing="false" prefHeight="31.0" prefWidth="120.0" text="Open Folder" />
<Label layoutX="4.0" layoutY="4.0" prefHeight="21.0" prefWidth="88.0" text="Platform" />
<Label layoutX="127.0" layoutY="4.0" prefHeight="21.0" prefWidth="80.0" text="Product" />
<Label layoutX="269.0" layoutY="4.0" text="Version" />
<Label layoutX="391.0" layoutY="4.0" prefHeight="21.0" prefWidth="60.0" text="Server" />
</children>
</AnchorPane>
Upvotes: 0
Views: 63
Reputation: 959
Your table is the first item in your layout, and has focus. That's why it's highlighted. Also, you have an HBox
in your layout, but there's nothing in it. Usually, you should use containers that handle the layout automatically, rather than absolute positioning nodes.
Here's an alternate layout for your scene that may make your life easier.
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.String?>
<?import javafx.collections.FXCollections?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<AnchorPane fx:id="ap" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="480.0" prefWidth="840.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.Buildsapp.Main.BuildsController">
<children>
<VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<HBox alignment="CENTER_LEFT" spacing="20.0" VBox.vgrow="NEVER">
<padding>
<Insets bottom="12.0" left="12.0" right="12.0" top="12.0" />
</padding>
<children>
<GridPane hgap="10.0" vgap="3.0" HBox.hgrow="NEVER">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="-Infinity" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="-Infinity" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="-Infinity" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="-Infinity" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="-Infinity" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="-Infinity" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="-Infinity" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="-Infinity" vgrow="SOMETIMES" />
<RowConstraints minHeight="-Infinity" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label prefHeight="21.0" prefWidth="88.0" text="Platform" />
<ComboBox fx:id="versionCombo" maxWidth="1.7976931348623157E308" minWidth="-Infinity" GridPane.rowIndex="1">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="Win" />
<String fx:value="Mac" />
</FXCollections>
</items>
<value>
<String fx:value="Mac" />
</value>
</ComboBox>
<Label prefHeight="21.0" prefWidth="80.0" text="Product" GridPane.columnIndex="1" />
<ComboBox fx:id="verCombo" maxWidth="1.7976931348623157E308" minWidth="-Infinity" promptText="builds" GridPane.columnIndex="1" GridPane.rowIndex="1">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="builds" />
<String fx:value="builds2" />
</FXCollections>
</items>
</ComboBox>
<Label text="Version" GridPane.columnIndex="2" />
<ComboBox fx:id="versionNo" maxWidth="1.7976931348623157E308" minWidth="-Infinity" GridPane.columnIndex="2" GridPane.rowIndex="1" />
<Label prefHeight="21.0" prefWidth="60.0" text="Server" GridPane.columnIndex="3" />
<ComboBox fx:id="locCombo" maxWidth="1.7976931348623157E308" minWidth="-Infinity" GridPane.columnIndex="3" GridPane.rowIndex="1">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="SJ" />
<String fx:value="MN" />
</FXCollections>
</items>
<value>
<String fx:value="SJ" />
</value>
</ComboBox>
<Button fx:id="downloadButton" maxWidth="1.7976931348623157E308" minWidth="-Infinity" mnemonicParsing="false" text="Download" GridPane.columnIndex="4" GridPane.rowIndex="1" />
<Button fx:id="installButton" maxWidth="1.7976931348623157E308" minWidth="-Infinity" mnemonicParsing="false" text="Install" GridPane.columnIndex="5" GridPane.rowIndex="1" />
<Button fx:id="locButton" minWidth="-Infinity" mnemonicParsing="false" text="Open Folder" GridPane.columnIndex="6" GridPane.rowIndex="1" />
</children>
</GridPane>
</children>
</HBox>
<TableView fx:id="tableView" VBox.vgrow="ALWAYS">
<columns>
<TableColumn fx:id="builds" prefWidth="482.0" text="Builds" />
<TableColumn fx:id="date" minWidth="0.0" prefWidth="500.0" text="Date" />
</columns>
</TableView>
</children>
</VBox>
</children>
</AnchorPane>
Upvotes: 1