Issue
How can I algin the CheckBox
in the HBox
example as it is done by the ToolBar
?
Example HBox:
src="https://i.stack.imgur.com/P5eQP.png" alt="enter image description here" />
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.HBox?>
<HBox xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<TextField />
<CheckBox mnemonicParsing="false" text="CheckBox" />
</children>
</HBox>
Example ToolBar:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.ToolBar?>
<ToolBar xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/11.0.1">
<items>
<TextField />
<CheckBox mnemonicParsing="false" text="CheckBox" />
</items>
</ToolBar>
Solution
Add alignment="CENTER"
and spacing="4.0"
to HBox tag
and
<padding>
<Insets bottom="4.0" left="4.0" right="4.0" top="4.0" />
</padding>
inner HBox tag, that should be all.
Answered By - EdwardLi
Answer Checked By - Clifford M. (JavaFixing Volunteer)