本文整理汇总了Java中javafx.scene.layout.HBox.getChildren方法的典型用法代码示例。如果您正苦于以下问题:Java HBox.getChildren方法的具体用法?Java HBox.getChildren怎么用?Java HBox.getChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.HBox
的用法示例。
在下文中一共展示了HBox.getChildren方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processSegments
import javafx.scene.layout.HBox; //导入方法依赖的package包/类
private void processSegments() {
for (Map.Entry<HBox, List<List<DiffKind>>> e : lineToSegments.entrySet()) {
final HBox line = e.getKey();
final List<String> descriptions = segmentToDescription.get(line);
final List<Node> children = line.getChildren();
final List<List<DiffKind>> segments = e.getValue();
int idx = 0;
for (List<DiffKind> segment : segments) {
if (segment == null) {
final Rectangle rectangle = new Rectangle(WIDTH, 8, Color.TRANSPARENT);
HBox.setMargin(rectangle, MARGIN_INSETS);
children.add(rectangle);
} else {
DiffKind[] seg = new DiffKind[segment.size()];
for (int i = 0; i < seg.length; i++) {
seg[i] = segment.get(i);
}
final String description = descriptions.get(idx);
final ValueView view = new ValueView(description, seg);
HBox.setMargin(view, MARGIN_INSETS);
children.add(view);
idx++;
}
}
}
}
示例2: createTopBar
import javafx.scene.layout.HBox; //导入方法依赖的package包/类
public HBox createTopBar()
{
HBox hbox = new HBox();
hbox.setPadding(new Insets(15, 15, 15, 15));
hbox.setSpacing(10);
hbox.setStyle("-fx-background-color: lightsteelblue;");
ObservableList<Node> buttons = hbox.getChildren();
Set<Node> buttonEffectsSet = new HashSet<>();
Node runButton = new ImageView("toolbar_run.png");
runButton.setOnMouseClicked((event) -> {
// TODO: Attach to Backend
});
buttons.add(runButton);
buttonEffectsSet.add(runButton);
Node stepButton = new ImageView("toolbar_step.png");
runButton.setOnMouseClicked((event) -> {
// TODO: Attach to Backend
});
buttons.add(stepButton);
buttonEffectsSet.add(stepButton);
Node resetButton = new ImageView("toolbar_reset.png");
runButton.setOnMouseClicked((event) -> {
// TODO: Attach to Backend
});
buttons.add(resetButton);
buttonEffectsSet.add(resetButton);
buttonEffectsSet.forEach(EmulationWindow::setButtonEffect);
Label cycleLabel = new Label();
cycleLabel.setText("Cycle: ");
cycleLabel.setFont(Font.font("Arial", FontWeight.NORMAL, 18));
buttons.add(cycleLabel);
Label cycleLabelCount = new Label();
cycleLabelCount.setText("0");
cycleLabelCount.setFont(Font.font("Arial", FontWeight.NORMAL, 18));
buttons.add(cycleLabelCount);
Label stepLabel = new Label();
stepLabel.setText("Step: ");
stepLabel.setFont(Font.font("Arial", FontWeight.NORMAL, 18));
buttons.add(stepLabel);
Label stepLabelCount = new Label();
stepLabelCount.setText("0");
stepLabelCount.setFont(Font.font("Arial", FontWeight.NORMAL, 18));
buttons.add(stepLabelCount);
Label simModeState = new Label();
simModeState.setText("Sim Mode");
simModeState.setFont(Font.font("Arial", FontWeight.NORMAL, 16));
buttons.add(simModeState);
Node simModeImage = new ImageView("sim_mode_on.png");
buttons.add(simModeImage);
return hbox;
}