本文整理匯總了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