本文整理汇总了Java中javafx.scene.layout.HBox.setBackground方法的典型用法代码示例。如果您正苦于以下问题:Java HBox.setBackground方法的具体用法?Java HBox.setBackground怎么用?Java HBox.setBackground使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.HBox
的用法示例。
在下文中一共展示了HBox.setBackground方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupBox
import javafx.scene.layout.HBox; //导入方法依赖的package包/类
private void setupBox(VBox box, String labelString, VBox content) {
final HBox boxLabel = new HBox();
final Polygon arrow = new Polygon(2.5, 10, 10, 5, 2.5, 0);
final Label label = new Label(labelString);
boxLabel.setBackground(HEADER_BACKGROUND);
label.setFont(GROUP_FONT);
HBox.setMargin(arrow, HALF_MARGIN_INSETS);
boxLabel.setAlignment(Pos.CENTER_LEFT);
boxLabel.getChildren().addAll(arrow, label);
boxLabel.setCursor(Cursor.HAND);
box.getChildren().add(boxLabel);
boxLabel.setOnMouseClicked(e -> {
if (box.getChildren().size() > 1) {
box.getChildren().remove(content);
arrow.setRotate(0);
} else {
box.getChildren().add(content);
arrow.setRotate(90);
}
});
}
示例2: start
import javafx.scene.layout.HBox; //导入方法依赖的package包/类
@Override public void start(Stage stage) {
HBox pane = new HBox(imageView, matrix);
pane.setSpacing(10);
pane.setPadding(new Insets(10));
pane.setBackground(new Background(new BackgroundFill(Color.rgb(10, 10, 20), CornerRadii.EMPTY, Insets.EMPTY)));
Scene scene = new Scene(pane);
stage.setTitle("Matrix Image");
stage.setScene(scene);
stage.show();
timer.start();
}
示例3: initCenter
import javafx.scene.layout.HBox; //导入方法依赖的package包/类
private void initCenter() {
center = new TabPane();
addTab("Processos", initTabProcesses());
addTab("Recursos", initTabResources());
HBox centerContainer = new HBox(center);
centerContainer.setPadding(new Insets(0, 10, 10, 10));
centerContainer.setBackground(new Background(new BackgroundFill(
Color.gray(0.865), CornerRadii.EMPTY, Insets.EMPTY)));
layoutPane.setCenter(centerContainer);
}
示例4: initGraphics
import javafx.scene.layout.HBox; //导入方法依赖的package包/类
private void initGraphics() {
Font regularFont = Fonts.latoRegular(10);
Font lightFont = Fonts.latoLight(10);
seriesText = new Text("SERIES");
seriesText.setFill(_textColor);
seriesText.setFont(regularFont);
seriesNameText = new Text("-");
seriesNameText.setFill(_textColor);
seriesNameText.setFont(lightFont);
seriesSumText = new Text("SUM");
seriesSumText.setFill(_textColor);
seriesSumText.setFont(regularFont);
seriesValueText = new Text("-");
seriesValueText.setFill(_textColor);
seriesValueText.setFont(lightFont);
itemText = new Text("ITEM");
itemText.setFill(_textColor);
itemText.setFont(regularFont);
itemNameText = new Text("-");
itemNameText.setFill(_textColor);
itemNameText.setFont(lightFont);
valueText = new Text("VALUE");
valueText.setFill(_textColor);
valueText.setFont(regularFont);
itemValueText = new Text("-");
itemValueText.setFill(_textColor);
itemValueText.setFont(lightFont);
line = new Line(0, 0, 0, 56);
line.setStroke(_textColor);
VBox vBoxTitles = new VBox(2, seriesText, seriesSumText, itemText, valueText);
vBoxTitles.setAlignment(Pos.CENTER_LEFT);
VBox.setMargin(itemText, new Insets(3, 0, 0, 0));
VBox vBoxValues = new VBox(2, seriesNameText, seriesValueText, itemNameText, itemValueText);
vBoxValues.setAlignment(Pos.CENTER_RIGHT);
VBox.setMargin(itemNameText, new Insets(3, 0, 0, 0));
HBox.setHgrow(vBoxValues, Priority.ALWAYS);
hBox = new HBox(5, vBoxTitles, line, vBoxValues);
hBox.setPrefSize(120, 69);
hBox.setPadding(new Insets(5));
hBox.setBackground(new Background(new BackgroundFill(_backgroundColor, new CornerRadii(3), Insets.EMPTY)));
hBox.setMouseTransparent(true);
getContent().addAll(hBox);
}