本文整理汇总了Java中javafx.scene.layout.VBox类的典型用法代码示例。如果您正苦于以下问题:Java VBox类的具体用法?Java VBox怎么用?Java VBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VBox类属于javafx.scene.layout包,在下文中一共展示了VBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showMenuBar
import javafx.scene.layout.VBox; //导入依赖的package包/类
/**
* show or hide the menuBar
*
* @param scene
* @param pMenuBar
*/
public void showMenuBar(Scene scene, MenuBar pMenuBar, boolean show) {
Parent sroot = scene.getRoot();
ObservableList<Node> rootChilds = null;
if (sroot instanceof VBox)
rootChilds = ((VBox) sroot).getChildren();
if (rootChilds == null)
throw new RuntimeException(
"showMenuBar can not handle scene root of type "
+ sroot.getClass().getName());
if (!show && rootChilds.contains(pMenuBar)) {
rootChilds.remove(pMenuBar);
} else if (show) {
rootChilds.add(0, pMenuBar);
}
pMenuBar.setVisible(show);
hideMenuButton
.setText(show ? I18n.get(I18n.HIDE_MENU) : I18n.get(I18n.SHOW_MENU));
}
示例2: configureSize
import javafx.scene.layout.VBox; //导入依赖的package包/类
/**
* Configure size of the root container.
*
* @param container the root container.
* @param size the size.
*/
@FXThread
private void configureSize(@NotNull final VBox container, @NotNull final Point size) {
final Stage dialog = getDialog();
final double width = size.getX();
final double height = size.getY();
if (width >= 1D) {
FXUtils.setFixedWidth(container, width);
dialog.setMinWidth(width);
dialog.setMaxWidth(width);
}
if (height >= 1D) {
FXUtils.setFixedHeight(container, height);
dialog.setMinHeight(height);
dialog.setMaxHeight(height);
}
}
示例3: initComponents
import javafx.scene.layout.VBox; //导入依赖的package包/类
private void initComponents() {
root = new BorderPane();
topContainer = new VBox();
editorHandler = new EditorHandler();
editor = new EditorView(editorHandler);
evaluatorHandler = new EvaluatorHandler();
evaluator = new EvaluatorView(evaluatorHandler);
statusBar = new StatusBar();
mainHandler = new MainHandler(evaluatorHandler, editorHandler);
mainHandler.setMainScene(this);
mainHandler.setStatusBar(statusBar);
menuManager.setMenuHandler(mainHandler);
setActive(Mode.EVALUATOR);
menuManager.disableGroupNeeded();
}
示例4: start
import javafx.scene.layout.VBox; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
Label left = new Label("foo");
TextField tf0 = new TextField();
HBox hBox = new HBox(left, tf0);
Label right = new Label("bar");
ListView<String> listView = new ListView<>();
VBox vBox = new VBox(right, listView);
TableView<String> tableView = new TableView<>();
SplitPane rightPane = new SplitPane(vBox, tableView);
rightPane.setOrientation(Orientation.VERTICAL);
SplitPane splitPane = new SplitPane(hBox, rightPane);
Scene scene = new Scene(splitPane);
primaryStage.setScene(scene);
primaryStage.setOnCloseRequest(e -> {
Platform.exit();
System.exit(0);
});
primaryStage.show();
}
示例5: Game
import javafx.scene.layout.VBox; //导入依赖的package包/类
public Game(double w, double h, Player player) {
// Get width and height
this.WIDTH = w;
this.HEIGHT = h;
this.player = player;
// Set the vbox for floors
vbFloors = new VBox((HEIGHT / 6));
// Get a collision box for the player
dummy = new Rectangle(player.getBoundsInParent().getWidth(), player.getBoundsInParent().getHeight());
// Setup this borderpane
this.setWidth(WIDTH);
this.setHeight(HEIGHT);
this.setPadding(new Insets(20, 20, 20, 20));
displayGame(); // Display game
displayPlayer(); // Display Player
}
示例6: createControls
import javafx.scene.layout.VBox; //导入依赖的package包/类
/**
* Create controls.
*
* @param container the container.
* @param changeConsumer the change consumer.
* @param influencer the influencer.
* @param parent the parent.
*/
@FXThread
private void createControls(@NotNull final VBox container, @NotNull final ModelChangeConsumer changeConsumer,
@NotNull final ColorInfluencer influencer, @NotNull final Object parent) {
final boolean randomStartColor = influencer.isRandomStartColor();
final ColorInfluencerControl colorControl = new ColorInfluencerControl(changeConsumer, influencer, parent);
colorControl.reload();
final BooleanParticleInfluencerPropertyControl<ColorInfluencer> randomStartColorControl =
new BooleanParticleInfluencerPropertyControl<>(randomStartColor, Messages.MODEL_PROPERTY_IS_RANDOM_START_COLOR, changeConsumer, parent);
randomStartColorControl.setSyncHandler(ColorInfluencer::isRandomStartColor);
randomStartColorControl.setApplyHandler(ColorInfluencer::setRandomStartColor);
randomStartColorControl.setEditObject(influencer);
FXUtils.addToPane(colorControl, container);
buildSplitLine(container);
FXUtils.addToPane(randomStartColorControl, container);
}
示例7: SplitDockingContainer
import javafx.scene.layout.VBox; //导入依赖的package包/类
public SplitDockingContainer(DockingDesktop desktop, IDockingContainer parent, Dockable base, Dockable dockable, Split position,
double proportion) {
setMaxHeight(Double.MAX_VALUE);
setMaxWidth(Double.MAX_VALUE);
HBox.setHgrow(this, Priority.ALWAYS);
VBox.setVgrow(this, Priority.ALWAYS);
getProperties().put(DockingDesktop.DOCKING_CONTAINER, parent);
setOrientation(position.getOrientation());
ObservableList<Node> items = getItems();
if (position == Split.LEFT || position == Split.TOP) {
items.add(new TabDockingContainer(desktop, this, dockable));
items.add(new TabDockingContainer(desktop, this, base));
} else {
items.add(new TabDockingContainer(desktop, this, base));
items.add(new TabDockingContainer(desktop, this, dockable));
}
setDividerPositions(proportion);
}
示例8: createCameraAngleControl
import javafx.scene.layout.VBox; //导入依赖的package包/类
/**
* Create the camera angle control.
*/
@FXThread
private void createCameraAngleControl(@NotNull final VBox root) {
final HBox container = new HBox();
container.setAlignment(Pos.CENTER_LEFT);
final Label label = new Label(Messages.SETTINGS_DIALOG_CAMERA_ANGLE + ":");
cameraAngleField = new IntegerTextField();
cameraAngleField.prefWidthProperty().bind(root.widthProperty());
cameraAngleField.setMinMax(30, 160);
cameraAngleField.addChangeListener((observable, oldValue, newValue) -> validate());
FXUtils.addToPane(label, container);
FXUtils.addToPane(cameraAngleField, container);
FXUtils.addToPane(container, root);
FXUtils.addClassTo(label, CSSClasses.SETTINGS_DIALOG_LABEL);
FXUtils.addClassTo(cameraAngleField, CSSClasses.SETTINGS_DIALOG_FIELD);
}
示例9: start
import javafx.scene.layout.VBox; //导入依赖的package包/类
@Override public void start(Stage stage) {
VBox pane = new VBox(10, matrixHeatMap1, matrixHeatMap2);
pane.setPadding(new Insets(10));
Scene scene = new Scene(pane);
stage.setTitle("MatrixHeatMap");
stage.setScene(scene);
stage.show();
timer.start();
}
示例10: getMessageBar
import javafx.scene.layout.VBox; //导入依赖的package包/类
private Node getMessageBar(VBox vbox) {
HBox hb = new HBox(10);
hb.setPrefHeight(32);
hb.setStyle("-fx-padding: 0 5px 0 5px; -fx-background-color: " + _message_bg + ";");
CheckBox cb = new CheckBox("Do Not Show Again");
cb.setStyle("-fx-text-fill: " + _message_fg + ";-fx-fill: " + _message_fg + ";");
Text b = FXUIUtils.getIconAsText("close");
b.setOnMouseClicked((e) -> {
JSONObject preferences = Preferences.instance().getSection("display");
preferences.put("_doNotShowMessage", cb.isSelected());
Preferences.instance().save("display");
vbox.getChildren().remove(0);
});
Text t = new Text(_message);
hb.setAlignment(Pos.CENTER_LEFT);
HBox.setHgrow(t, Priority.ALWAYS);
t.setStyle("-fx-fill: " + _message_fg + "; -fx-font-size: 14px; -fx-font-weight:bold; -fx-font-family: Tahoma;");
b.setStyle("-fx-fill: " + _message_fg + "; -fx-font-size: 14px; -fx-font-weight:bold;");
Region spacer = new Region();
HBox.setHgrow(spacer, Priority.ALWAYS);
hb.getChildren().addAll(t, spacer, b);
return hb;
}
示例11: addUpgradeBtn
import javafx.scene.layout.VBox; //导入依赖的package包/类
public void addUpgradeBtn() {
upgradeBtn = new Button();
upgradeBtn.setText("UPGRADE");
upgradeBtn.setOnAction(e -> {
Stage msgStage = new Stage();
VBox root = new VBox();
Scene scene = new Scene(root);
Text text = new Text("Are you sure you want to upgrade " + name + "? It will cost you 10 gold.");
HBox options = new HBox();
Button yes = new Button ("yes");
yes.setOnAction(f -> {
sprite.getComponent(GameBus.TYPE).get().getGameBus().emit(new ChangeWealthEvent
(ChangeWealthEvent.CHANGE, sprite.getComponent(Owner.TYPE).get().player(), WealthType.GOLD, -10));
msgStage.close();
});
Button no = new Button("no");
no.setOnAction(g -> {
msgStage.close();
});
options.getChildren().add(yes);
root.getChildren().addAll(text, options);
msgStage.setScene(scene);
msgStage.show();
});
this.getChildren().add(upgradeBtn);
}
示例12: initializeErrorsListener
import javafx.scene.layout.VBox; //导入依赖的package包/类
private void initializeErrorsListener() {
final VBox children = (VBox) lookup("#children");
final Map<CodeAnalysis.Message, MessagePresentation> messageMessagePresentationMap = new HashMap<>();
final Consumer<CodeAnalysis.Message> addMessage = (message) -> {
final MessagePresentation messagePresentation = new MessagePresentation(message);
messageMessagePresentationMap.put(message, messagePresentation);
children.getChildren().add(messagePresentation);
};
messages.forEach(addMessage);
messages.addListener(new ListChangeListener<CodeAnalysis.Message>() {
@Override
public void onChanged(final Change<? extends CodeAnalysis.Message> c) {
while (c.next()) {
c.getAddedSubList().forEach(addMessage::accept);
c.getRemoved().forEach(message -> {
children.getChildren().remove(messageMessagePresentationMap.get(message));
messageMessagePresentationMap.remove(message);
});
}
}
});
}
示例13: start
import javafx.scene.layout.VBox; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
MediaService mediaService = DemoConstants.newMediaService();
AnnotationService annotationService = DemoConstants.newAnnotationService();
Label label = new Label();
Button button = new JFXButton("Browse");
Dialog<Media> dialog = new SelectMediaDialog(annotationService,
mediaService, uiBundle);
button.setOnAction(e -> {
Optional<Media> media = dialog.showAndWait();
media.ifPresent(m -> label.setText(m.getUri().toString()));
});
VBox vBox = new VBox(label, button);
Scene scene = new Scene(vBox, 400, 200);
primaryStage.setScene(scene);
primaryStage.show();
primaryStage.setOnCloseRequest(e -> {
Platform.exit();
System.exit(0);
});
}
示例14: createToneMapFilterControl
import javafx.scene.layout.VBox; //导入依赖的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);
}
示例15: automate
import javafx.scene.layout.VBox; //导入依赖的package包/类
@FXML public void automate(ActionEvent event){
System.out.println("AUTOMATE");
try{
((Node)event.getSource()).getScene().getWindow().hide();
Stage primaryStage = new Stage();
FXMLLoader loader = new FXMLLoader();
VBox root = (VBox)loader.load(getClass().getResource("automate.fxml").openStream());
Scene scene = new Scene(root,200,150);
primaryStage.setScene(scene);
primaryStage.setResizable(false);
primaryStage.setTitle("AUTOMATE");
primaryStage.show();
}catch(IOException e){
System.out.println("IO Exception loading automate.fxml");
e.printStackTrace();
}
}
开发者ID:kevalmorabia97,项目名称:GUI-Sorting-Time-Comparison-using-JavaFx,代码行数:18,代码来源:ReadDataController.java