BorderPane
VBox
使用叠加的背景填充和
Region
在按钮之间插入始终增长的:
<?xml version="1.0" encoding="UTF-8"?>
<?import com.jfoenix.controls.JFXButton?>
<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.layout.Region?>
<BorderPane prefHeight="750.0" prefWidth="1000.0"
xmlns="http://javafx.com/javafx/9.0.4"
xmlns:fx="http://javafx.com/fxml/1">
<left>
<VBox alignment="TOP_LEFT"
spacing="35.0"
style="-fx-background-color: #2b4496, #4059a9; -fx-background-insets: 0, 0 0 0 75;"> <!-- overlay 2 backgrounds produce rectangles -->
<padding>
<Insets right="75.0" />
</padding>
<children>
<JFXButton contentDisplay="GRAPHIC_ONLY" prefWidth="82.0" VBox.vgrow="NEVER">
<graphic>
<FontAwesomeIconView fill="WHITE" glyphName="HOME" size="2em" />
</graphic>
<VBox.margin>
<Insets top="25.0" />
</VBox.margin>
</JFXButton>
<Region VBox.vgrow="ALWAYS" /> <!-- filler -->
<JFXButton contentDisplay="GRAPHIC_ONLY" prefWidth="75.0" VBox.vgrow="NEVER">
<VBox.margin>
<Insets bottom="10.0" />
</VBox.margin>
<graphic>
<FontAwesomeIconView fill="WHITE" glyphName="SIGN_OUT" size="2em" />
</graphic>
</JFXButton>
</children>
</VBox>
</left>
</BorderPane>