本文整理汇总了Java中javafx.scene.layout.HBox类的典型用法代码示例。如果您正苦于以下问题:Java HBox类的具体用法?Java HBox怎么用?Java HBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HBox类属于javafx.scene.layout包,在下文中一共展示了HBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: NotificationBarPane
import javafx.scene.layout.HBox; //导入依赖的package包/类
public NotificationBarPane(Node content) {
super(content);
progressBar = new ProgressBar();
label = new Label("infobar!");
bar = new HBox(label);
bar.setMinHeight(0.0);
bar.getStyleClass().add("info-bar");
bar.setFillHeight(true);
setBottom(bar);
// Figure out the height of the bar based on the CSS. Must wait until after we've been added to the parent node.
sceneProperty().addListener(o -> {
if (getParent() == null) return;
getParent().applyCss();
getParent().layout();
barHeight = bar.getHeight();
bar.setPrefHeight(0.0);
});
items = FXCollections.observableArrayList();
items.addListener((ListChangeListener<? super Item>) change -> {
config();
showOrHide();
});
}
示例2: start
import javafx.scene.layout.HBox; //导入依赖的package包/类
@Override
public void start(Stage stage) {
Group root = new Group();
Scene scene = new Scene(root, 260, 80);
stage.setScene(scene);
stage.setTitle("Password Field Sample");
VBox vb = new VBox();
vb.setPadding(new Insets(10, 0, 0, 10));
vb.setSpacing(10);
HBox hb = new HBox();
hb.setSpacing(10);
hb.setAlignment(Pos.CENTER_LEFT);
Label label = new Label("Password");
final PasswordField pb = new PasswordField();
pb.setText("Your password");
pb.setOnAction((ActionEvent e) -> {
if (!pb.getText().equals("T2f$Ay!")) {
message.setText("Your password is incorrect!");
message.setTextFill(Color.rgb(210, 39, 30));
} else {
message.setText("Your password has been confirmed");
message.setTextFill(Color.rgb(21, 117, 84));
}
pb.clear();
});
hb.getChildren().addAll(label, pb);
vb.getChildren().addAll(hb, message);
scene.setRoot(vb);
stage.show();
}
示例3: editorModeSelection
import javafx.scene.layout.HBox; //导入依赖的package包/类
private Node editorModeSelection( EditorSettingDetails settingDetails, ObservableList<String> editorModes )
{
HBox hBox = new HBox();
Text editorModeLabel = new Text("Editor Mode: ");
editorModeLabel.setId(UIConstants.TEXT_COLOR);
ComboBox<String> editorModeComboBox = new ComboBox<>(editorModes);
editorModeComboBox.getSelectionModel().select(settingDetails.getEditorMode());
editorModeSelectionModel = editorModeComboBox.getSelectionModel();
hBox.getChildren().addAll(editorModeLabel, editorModeComboBox);
hBox.setAlignment(Pos.CENTER_LEFT);
return hBox;
}
示例4: TalkWithSMTP
import javafx.scene.layout.HBox; //导入依赖的package包/类
public TalkWithSMTP(Domain domain) {
this.domain = domain;
hbox = new HBox();
midProgress = new ProgressBar();
midProgress.setProgress(0.0d);
progresLabel = new Label(domain.getName());
List<String> inside = new ArrayList<>();
int count = 0;
for (String email : domain.getEmails()) {
if (count == 10) {
count = 0;
this.emails.add(new ArrayList<>(inside));
inside.clear();
}
inside.add(email);
count++;
}
}
示例5: createToolbar
import javafx.scene.layout.HBox; //导入依赖的package包/类
@Override
@FXThread
protected void createToolbar(@NotNull final HBox container) {
super.createToolbar(container);
final Label materialDefinitionLabel = new Label(Messages.MATERIAL_EDITOR_MATERIAL_TYPE_LABEL + ":");
materialDefinitionBox = new ComboBox<>();
materialDefinitionBox.getSelectionModel()
.selectedItemProperty()
.addListener((observable, oldValue, newValue) -> changeType(newValue));
FXUtils.addToPane(materialDefinitionLabel, container);
FXUtils.addToPane(materialDefinitionBox, container);
FXUtils.addClassTo(materialDefinitionLabel, CSSClasses.FILE_EDITOR_TOOLBAR_LABEL);
FXUtils.addClassTo(materialDefinitionBox, CSSClasses.FILE_EDITOR_TOOLBAR_FIELD);
}
示例6: createGrid
import javafx.scene.layout.HBox; //导入依赖的package包/类
private void createGrid() {
gridOperator.traverseGrid((i,j)->{
gridGroup.getChildren().add(createCell(i, j));
return 0;
});
gridGroup.getStyleClass().add("game-grid");
gridGroup.setManaged(false);
gridGroup.setLayoutX(BORDER_WIDTH);
gridGroup.setLayoutY(BORDER_WIDTH);
HBox hBottom = new HBox();
hBottom.getStyleClass().add("game-backGrid");
hBottom.setMinSize(gridWidth, gridWidth);
hBottom.setPrefSize(gridWidth, gridWidth);
hBottom.setMaxSize(gridWidth, gridWidth);
// Clip hBottom to keep the dropshadow effects within the hBottom
Rectangle rect = new Rectangle(gridWidth, gridWidth);
hBottom.setClip(rect);
hBottom.getChildren().add(gridGroup);
vGame.getChildren().add(hBottom);
}
示例7: createAutoTangentGeneratingControl
import javafx.scene.layout.HBox; //导入依赖的package包/类
/**
* Create the checkbox for configuring auto tangent generating.
*/
@FXThread
private void createAutoTangentGeneratingControl(@NotNull final VBox root) {
final HBox container = new HBox();
container.setAlignment(Pos.CENTER_LEFT);
final Label label = new Label(Messages.SETTINGS_DIALOG_AUTO_TANGENT_GENERATING + ":");
autoTangentGeneratingCheckBox = new CheckBox();
autoTangentGeneratingCheckBox.selectedProperty().addListener((observable, oldValue, newValue) -> validate());
FXUtils.addToPane(label, container);
FXUtils.addToPane(autoTangentGeneratingCheckBox, container);
FXUtils.addToPane(container, root);
FXUtils.addClassTo(label, CSSClasses.SETTINGS_DIALOG_LABEL);
FXUtils.addClassTo(autoTangentGeneratingCheckBox, CSSClasses.SETTINGS_DIALOG_FIELD);
}
示例8: addDelayedValue
import javafx.scene.layout.HBox; //导入依赖的package包/类
private void addDelayedValue(HBox line, String description) {
final List<List<DiffKind>> segments = lineToSegments.get(line);
final List<DiffKind> segment;
boolean addDescription = false;
if (segments.isEmpty()) {
segment = new ArrayList<>();
addDescription = true;
segments.add(segment);
} else {
segment = segments.get(segments.size() - 1);
}
if (addDescription) {
List<String> descriptions = segmentToDescription.get(line);
if (descriptions == null) {
descriptions = new ArrayList<>();
segmentToDescription.put(line, descriptions);
}
descriptions.add(description);
}
segment.add(DiffKind.DEL);
}
示例9: createToneMapFilterControl
import javafx.scene.layout.HBox; //导入依赖的package包/类
/**
* Create tonemap filter control.
*/
@FXThread
private void createToneMapFilterControl(@NotNull final VBox root) {
final HBox container = new HBox();
container.setAlignment(Pos.CENTER_LEFT);
final Label toneMapFilterLabel = new Label(Messages.SETTINGS_DIALOG_TONEMAP_FILTER + ":");
toneMapFilterCheckBox = new CheckBox();
toneMapFilterCheckBox.selectedProperty().addListener((observable, oldValue, newValue) -> validate());
FXUtils.addToPane(toneMapFilterLabel, container);
FXUtils.addToPane(toneMapFilterCheckBox, container);
FXUtils.addToPane(container, root);
FXUtils.addClassTo(toneMapFilterLabel, CSSClasses.SETTINGS_DIALOG_LABEL);
FXUtils.addClassTo(toneMapFilterCheckBox, CSSClasses.SETTINGS_DIALOG_FIELD);
}
示例10: UARTPanel
import javafx.scene.layout.HBox; //导入依赖的package包/类
public UARTPanel()
{
WebView view = new WebView();
view.setContextMenuEnabled(false);
webEngine = view.getEngine();
messageQueue = new LinkedList<>();
valueDisplayOptions = new LinkedHashMap<>();
populateDisplayOptions();
ObservableValue<State> property = webEngine.getLoadWorker().stateProperty();
OnLoadListener.register(this::onLoad, property);
String content = "<html><head></head><body " + styleString() + "></body></html>";
webEngine.loadContent(content);
HBox controlPane = createControlPane();
this.setCenter(view);
this.setBottom(controlPane);
}
示例11: addNotification
import javafx.scene.layout.HBox; //导入依赖的package包/类
/**
* 处理通知信息的显示
* @param notice
*/
public void addNotification(String notice){
Platform.runLater(() ->{
SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss");//设置日期格式
String timer = df.format(new Date());// new Date()为获取当前系统时间
String content = timer + ": " + notice;
BubbledTextFlow noticeBubbled = new BubbledTextFlow(EmojiDisplayer.createEmojiAndTextNode(content));
//noticeBubbled.setTextFill(Color.web("#031c30"));
noticeBubbled.setBackground(new Background(new BackgroundFill(Color.WHITE,
null, null)));
HBox x = new HBox();
//x.setMaxWidth(chatPaneListView.getWidth() - 20);
x.setAlignment(Pos.TOP_CENTER);
noticeBubbled.setBubbleSpec(BubbleSpec.FACE_TOP);
x.getChildren().addAll(noticeBubbled);
chatPaneListView.getItems().add(x);
});
}
示例12: GoogleEntryAttendeeItem
import javafx.scene.layout.HBox; //导入依赖的package包/类
public GoogleEntryAttendeeItem(EventAttendee attendee) {
this.attendee = Objects.requireNonNull(attendee);
optionalIcon = new Label();
optionalIcon.setOnMouseClicked(evt -> setOptional(!isOptional()));
optionalIcon.getStyleClass().add("button-icon");
optionalIcon.setTooltip(new Tooltip());
statusIcon = new Label();
name = new Label();
name.setMaxWidth(Double.MAX_VALUE);
setOptional(Boolean.TRUE.equals(attendee.getOptional()));
optionalProperty().addListener(obs -> updateIcon());
updateIcon();
removeButton = new Label();
removeButton.setGraphic(new FontAwesome().create(FontAwesome.Glyph.TRASH_ALT));
removeButton.getStyleClass().add("button-icon");
removeButton.setOnMouseClicked(evt -> removeAttendee(attendee));
HBox.setHgrow(optionalIcon, Priority.NEVER);
HBox.setHgrow(name, Priority.ALWAYS);
HBox.setHgrow(removeButton, Priority.NEVER);
getStyleClass().add("attendee-item");
getChildren().addAll(optionalIcon, statusIcon, name, removeButton);
ContextMenu menu = new ContextMenu();
MenuItem optionalItem = new MenuItem("Mark as optional");
optionalItem.setOnAction(evt -> setOptional(true));
MenuItem requiredItem = new MenuItem("Mark as required");
requiredItem.setOnAction(evt -> setOptional(false));
MenuItem removeItem = new MenuItem("Remove attendee");
removeItem.setOnAction(evt -> removeAttendee(attendee));
menu.getItems().addAll(optionalItem, requiredItem, new SeparatorMenuItem(), removeItem);
addEventHandler(CONTEXT_MENU_REQUESTED, evt -> menu.show(this, evt.getScreenX(), evt.getScreenY()));
}
示例13: DatePickerSample
import javafx.scene.layout.HBox; //导入依赖的package包/类
public DatePickerSample() {
HBox hBox = new HBox();
hBox.setSpacing(15);
DatePicker uneditableDatePicker = new DatePicker();
uneditableDatePicker.setEditable(false);
DatePicker editablDatePicker = new DatePicker();
editablDatePicker.setPromptText("Edit or Pick...");
hBox.getChildren().addAll(uneditableDatePicker, editablDatePicker);
getChildren().add(hBox);
}
示例14: createFXAAControl
import javafx.scene.layout.HBox; //导入依赖的package包/类
/**
* Create FXAA control.
*/
@FXThread
private void createFXAAControl(@NotNull final VBox root) {
final HBox container = new HBox();
container.setAlignment(Pos.CENTER_LEFT);
final Label label = new Label(Messages.SETTINGS_DIALOG_FXAA + ":");
fxaaFilterCheckBox = new CheckBox();
fxaaFilterCheckBox.selectedProperty().addListener((observable, oldValue, newValue) -> validate());
FXUtils.addToPane(label, container);
FXUtils.addToPane(fxaaFilterCheckBox, container);
FXUtils.addToPane(container, root);
FXUtils.addClassTo(label, CSSClasses.SETTINGS_DIALOG_LABEL);
FXUtils.addClassTo(fxaaFilterCheckBox, CSSClasses.SETTINGS_DIALOG_FIELD);
}
示例15: makeMyHighScorePost
import javafx.scene.layout.HBox; //导入依赖的package包/类
private Node makeMyHighScorePost () {
HBox box = new HBox(5);
TextField field = new TextField("Game name");
ComboBox<ScoreOrder> combo = new ComboBox<>();
for (ScoreOrder s : ScoreOrder.values()) {
combo.getItems().add(s);
}
box.getChildren().addAll(field, combo);
Button button = new Button("Post about my scores");
button.setOnMouseClicked(e -> {
myUser = mySocial.getActiveUser();
myUser.getProfiles().getActiveProfile().highScorePost(mySocial.getHighScoreBoard(),
field.getText(),
myUser,
combo.getValue());
});
box.getChildren().add(button);
return box;
}