Java Code Examples for javafx.scene.layout.VBox

The following are top voted examples for showing how to use javafx.scene.layout.VBox. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: can4eve   File: JavaFXDisplay.java   Source Code and License 10 votes vote down vote up
/**
 * 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));
}
 
Example 2
Project: jmonkeybuilder   File: EditorDialog.java   Source Code and License 7 votes vote down vote up
/**
 * 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);
    }
}
 
Example 3
Project: ReqMan   File: MainScene.java   Source Code and License 6 votes vote down vote up
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();
}
 
Example 4
Project: vars-annotation   File: SplitPaneDemo.java   Source Code and License 6 votes vote down vote up
@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();
}
 
Example 5
Project: projectintern   File: Game.java   Source Code and License 6 votes vote down vote up
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
}
 
Example 6
Project: jmonkeybuilder   File: Toneg0dParticleInfluencerPropertyBuilder.java   Source Code and License 6 votes vote down vote up
/**
 * 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);
}
 
Example 7
Project: marathonv5   File: SplitDockingContainer.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 8
Project: jmonkeybuilder   File: SettingsDialog.java   Source Code and License 6 votes vote down vote up
/**
 * 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);
}
 
Example 9
Project: charts   File: MatrixHeatmapTest.java   Source Code and License 6 votes vote down vote up
@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();
}
 
Example 10
Project: marathonv5   File: DisplayWindow.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 11
Project: voogasalad-ltub   File: SingleStat.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 12
Project: H-Uppaal   File: MessageCollectionPresentation.java   Source Code and License 6 votes vote down vote up
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);
                });
            }
        }
    });
}
 
Example 13
Project: vars-annotation   File: SelectMediaDialogDemo.java   Source Code and License 6 votes vote down vote up
@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);
    });

}
 
Example 14
Project: jmonkeybuilder   File: Toneg0dParticleInfluencerPropertyBuilder.java   Source Code and License 6 votes vote down vote up
/**
 * 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 DestinationInfluencer influencer, @NotNull final Object parent) {

    final boolean randomStartDestination = influencer.isRandomStartDestination();

    final DestinationInfluencerControl influencerControl = new DestinationInfluencerControl(changeConsumer, influencer, parent);
    influencerControl.reload();

    final BooleanParticleInfluencerPropertyControl<DestinationInfluencer> randomStartDestinationControl =
            new BooleanParticleInfluencerPropertyControl<>(randomStartDestination,
                    Messages.MODEL_PROPERTY_IS_RANDOM_START_DESTINATION, changeConsumer, parent);

    randomStartDestinationControl.setSyncHandler(DestinationInfluencer::isRandomStartDestination);
    randomStartDestinationControl.setApplyHandler(DestinationInfluencer::setRandomStartDestination);
    randomStartDestinationControl.setEditObject(influencer);

    FXUtils.addToPane(influencerControl, container);
    buildSplitLine(container);
    FXUtils.addToPane(randomStartDestinationControl, container);
}
 
Example 15
Project: jmonkeybuilder   File: SettingsDialog.java   Source Code and License 6 votes vote down vote up
/**
 * 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);
}
 
Example 16
Project: GUI-Sorting-Time-Comparison-using-JavaFx   File: ReadDataController.java   Source Code and License 6 votes vote down vote up
@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();
	}
}
 
Example 17
Project: jmonkeybuilder   File: EditorFXScene.java   Source Code and License 6 votes vote down vote up
/**
 * Hide the loading process.
 */
@FXThread
private void hideLoading() {

    final VBox loadingLayer = getLoadingLayer();
    loadingLayer.setVisible(false);
    loadingLayer.getChildren().clear();

    progressIndicator = null;

    final StackPane container = getContainer();
    container.setDisable(false);

    if (focused != null) {
        EXECUTOR_MANAGER.addFXTask(() -> {
            focused.requestFocus();
            focused = null;
        });
    }
}
 
Example 18
Project: duncan   File: SocialNetwork.java   Source Code and License 6 votes vote down vote up
public SocialNetwork(String site, VBox panel)
{
    //apply the styles
    getStyleClass().add("browser");

    // load the web page
    webEngine.load(site);
    panel.setAlignment(Pos.CENTER);

    panel.setPadding(new Insets(0,50,0,100));
    flowPane.getChildren ().addAll(browser, panel);
    flowPane.setVgap(25);

    //add the web view to the scene
    getChildren().add(flowPane);

}
 
Example 19
Project: jmonkeybuilder   File: PropertyEditor.java   Source Code and License 6 votes vote down vote up
/**
 * Build property controls for the object.
 *
 * @param object the object
 * @param parent the parent
 */
@FXThread
public void buildFor(@Nullable final Object object, @Nullable final Object parent) {
    if (getCurrentObject() == object) return;

    final VBox container = getContainer();
    final ObservableList<Node> children = container.getChildren();
    children.clear();

    if (object != null) {
        BUILDER_REGISTRY.buildFor(object, parent, container, changeConsumer);
    }

    container.setDisable(object == null || !canEdit(object, parent));

    setCurrentObject(object);
    setCurrentParent(parent);
}
 
Example 20
Project: jmonkeybuilder   File: ParticleEmitterPropertyBuilder.java   Source Code and License 6 votes vote down vote up
@Override
@FXThread
protected void buildForImpl(@NotNull final Object object, @Nullable final Object parent,
                            @NotNull final VBox container, @NotNull final ModelChangeConsumer changeConsumer) {

    if (!(object instanceof ParticleEmitterNode || object instanceof ParticleEmitter)) {
        return;
    }

    if (object instanceof ParticleEmitterNode) {
        buildFor(container, changeConsumer, (ParticleEmitterNode) object);
    } else {
        buildFor(container, changeConsumer, (ParticleEmitter) object);
    }

    buildSplitLine(container);
}
 
Example 21
Project: PSE   File: SideMenuPane.java   Source Code and License 5 votes vote down vote up
/**
 * SideMenuPane constructor.
 * @param title SideMenuPane title.
 */
public SideMenuPane(String title){
    this.title = new Label(title);
    this.scrollPane = new ScrollPane();
    this.container = new VBox(0.0f);
    this.container.setBackground(new Background(new BackgroundFill(Paint.valueOf("#000000"),null,null)));
    this.container.setMinHeight(1268.0f);
    setMinWidth(WIDTH);
    setMinHeight(1024);
    setAlignment(Pos.TOP_LEFT);
    //setPadding(padding);
    setBackground(new Background(new BackgroundFill(Paint.valueOf("#000000"),null,null)));
    addTitle();
}
 
Example 22
Project: JavaFX-FrameRateMeter   File: FXCanvasComposite.java   Source Code and License 5 votes vote down vote up
private VBox getRoot() {
  FXMLLoader fxmlLoader = new FXMLLoader(FXCanvasComposite.class.getResource("FXCanvasComposite.fxml"));
  fxmlLoader.setController(this);
  VBox root = null;
  try {
    root = fxmlLoader.load();
  } catch (IOException e) {
    e.printStackTrace();
  }
  return root;
}
 
Example 23
Project: voogasalad-ltub   File: LosePresentation.java   Source Code and License 5 votes vote down vote up
public LosePresentation(){
	vbButtons = new VBox(20);
	vbButtons.setLayoutY(200);
	vbButtons.setLayoutX(500);
	vbButtons.setSpacing(20);
	vbButtons.setPadding(new Insets(0, 20, 10, 20)); 

	vbTexts = new VBox(20);
	vbTexts.setLayoutY(20);
	vbButtons.setLayoutX(100);
	vbTexts.setSpacing(20);
	vbTexts.setPadding(new Insets(0, 20, 10, 20)); 
}
 
Example 24
Project: Lernkartei_2017   File: TuttoHelpView.java   Source Code and License 5 votes vote down vote up
@Override
public Parent constructContainer ()
{
	AppButton backToGameMenu = new AppButton("Zur�ck");

	VBox itemsLayout = new VBox();
	itemsLayout.setAlignment(Pos.BOTTOM_CENTER);

	backToGameMenu.setOnAction(e -> getFXController().showView("gameview"));

	itemsLayout.getChildren().addAll(backToGameMenu);

	MainLayout maLay = new MainLayout(itemsLayout);
	return maLay;
}
 
Example 25
Project: gatepass   File: Office_Entry.java   Source Code and License 5 votes vote down vote up
private VBox getActionPane(){
progress= new Text("Office\nEntry Progress");
progress.setTextAlignment(TextAlignment.CENTER);
progress.setFont(Font.font("Times New Roman", 35));
lname= new Label("-Your Name here-");

Image iconf= new Image(Office_Entry.class.getResourceAsStream("/pic/finger.png"));
ImageView ivconf= new ImageView(iconf);
lpic= new Label();
lpic.setGraphic(ivconf);

Image img1= new Image(PersonalReports.class.getResourceAsStream("/pic/cross.png"));
ImageView imagvw= new ImageView(img1);
imagvw.setFitHeight(70);
imagvw.setFitWidth(70);
lnotexist= new Label("",imagvw);
lnotexist.setText("\n\n\n\n\nN/A");
lnotexist.setFont(Font.font("Cooper Black", 15));
lnotexist.setVisible(false);

txtfinger= new TextField();
txtfinger.setEditable(false);
txtfinger.setMaxWidth(160);		
txtfinger.setStyle("-fx-background-radius:10; -fx-background-color:#9CD777;");

txtsearch= new TextField();
initFilter();

Button btnView= new Button("View Records");
Button btnCloseView= new Button("Hide Records");

Button btnadd= new Button("save");
btnadd.setOnAction(e -> {
	setAddAttendance();
});

btnView.setOnAction(e -> {
	timelineDown.play();
});
btnCloseView.setOnAction(e -> {
	timelineUp.play();
});


VBox laywrong= new VBox();
laywrong.getChildren().addAll(lnotexist);
laywrong.setPadding(new Insets(0,0,0,0));
laywrong.setAlignment(Pos.CENTER);

HBox laytest= new HBox(5);
laytest.getChildren().addAll(txtfinger /* btnadd*/);
laytest.setAlignment(Pos.CENTER);

VBox laybtnsearch= new VBox();
laybtnsearch.getChildren().addAll(txtsearch);
laybtnsearch.setAlignment(Pos.CENTER);
laybtnsearch.setPadding(new Insets(20,0,0,0));

HBox laybtn= new HBox(5);
laybtn.getChildren().addAll(btnView, btnCloseView);
laybtn.setAlignment(Pos.CENTER);
VBox lay1= new VBox(10);
lay1.getChildren().addAll(progress, lpic, lname, laytest);
lay1.setAlignment(Pos.CENTER);
VBox layside= new VBox(25);
layside.getChildren().addAll(lay1, laybtn, laybtnsearch, laywrong);
layside.setAlignment(Pos.TOP_CENTER);
layside.setMinWidth(230);
layside.setPadding(new Insets(20,0,10,0));
return layside;
 }
 
Example 26
Project: ReqMan   File: EvaluatorView.java   Source Code and License 5 votes vote down vote up
private void initComponents() {
    horizontalSplit = new SplitPane();
    verticalSplit = new SplitPane();

    leftContent = new HBox();
    rightContent = new VBox();
    tabPane = new TabPane();

    catInfoView = new CatalogueInfoView();
    groupView = new GroupListView(handler);
}
 
Example 27
Project: jmonkeybuilder   File: EditorFXScene.java   Source Code and License 5 votes vote down vote up
public EditorFXScene(@NotNull final Group root) {
    super(root);

    this.canvas = new EditorFXImageView();
    this.canvas.setMouseTransparent(true);
    this.canvas.getProperties()
            .put(JFXMouseInput.PROP_USE_LOCAL_COORDS, true);

    this.loadingCount = new AtomicInteger();
    this.components = ArrayFactory.newArraySet(ScreenComponent.class);
    this.container = new StackPane();
    this.container.setId(CSSIds.ROOT_CONTAINER);
    this.container.setPickOnBounds(false);
    this.hideLayer = new StackPane();
    this.hideLayer.setVisible(false);
    this.loadingLayer = new VBox();
    this.loadingLayer.setId(CSSIds.EDITOR_LOADING_LAYER);
    this.loadingLayer.setVisible(false);

    final Pane background = new Pane();
    background.setId(CSSIds.ROOT);

    FXUtils.addDebugBorderTo(canvas);

    root.getChildren().addAll(hideLayer, background, container, loadingLayer);

    FXUtils.bindFixedWidth(background, widthProperty());
    FXUtils.bindFixedHeight(background, heightProperty());
    FXUtils.bindFixedWidth(container, widthProperty());
    FXUtils.bindFixedHeight(container, heightProperty());
    FXUtils.bindFixedWidth(loadingLayer, widthProperty());
    FXUtils.bindFixedHeight(loadingLayer, heightProperty());
    FXUtils.setFixedSize(hideLayer, 300, 300);

    hideCanvas();
}
 
Example 28
Project: jmonkeybuilder   File: ParticleInfluencerPropertyBuilder.java   Source Code and License 5 votes vote down vote up
@Override
@FXThread
protected void buildForImpl(@NotNull final Object object, @Nullable final Object parent,
                            @NotNull final VBox container, @NotNull final ModelChangeConsumer changeConsumer) {

    if (!(object instanceof ParticleInfluencer)) return;

    final ParticleInfluencer influencer = (ParticleInfluencer) object;
    final Vector3f initialVelocity = influencer.getInitialVelocity();

    final float velocityVariation = influencer.getVelocityVariation();

    final Vector3FPropertyControl<ModelChangeConsumer, ParticleInfluencer> initialVelocityControl =
            new Vector3FPropertyControl<>(initialVelocity, Messages.MODEL_PROPERTY_INITIAL_VELOCITY, changeConsumer);

    initialVelocityControl.setSyncHandler(ParticleInfluencer::getInitialVelocity);
    initialVelocityControl.setApplyHandler(ParticleInfluencer::setInitialVelocity);
    initialVelocityControl.setEditObject(influencer);

    FXUtils.addToPane(initialVelocityControl, container);

    if (object instanceof RadialParticleInfluencer) {
        createControls(container, changeConsumer, (RadialParticleInfluencer) object);
    } else {
        buildSplitLine(initialVelocityControl);
    }

    if (influencer instanceof EmptyParticleInfluencer) {
        initialVelocityControl.setDisable(true);
    }

    final FloatPropertyControl<ModelChangeConsumer, ParticleInfluencer> velocityVariationControl =
            new FloatPropertyControl<>(velocityVariation, Messages.MODEL_PROPERTY_VELOCITY_VARIATION, changeConsumer);

    velocityVariationControl.setSyncHandler(ParticleInfluencer::getVelocityVariation);
    velocityVariationControl.setApplyHandler(ParticleInfluencer::setVelocityVariation);
    velocityVariationControl.setEditObject(influencer);

    FXUtils.addToPane(velocityVariationControl, container);
}
 
Example 29
Project: jmonkeybuilder   File: DefaultControlPropertyBuilder.java   Source Code and License 5 votes vote down vote up
@Override
@FXThread
protected void buildForImpl(@NotNull final Object object, @Nullable final Object parent,
                            @NotNull final VBox container, @NotNull final ModelChangeConsumer changeConsumer) {

    if (object instanceof AbstractCinematicEvent) {
        build((AbstractCinematicEvent) object, container, changeConsumer);
    }  else if (object instanceof VehicleWheel) {
        build((VehicleWheel) object, container, changeConsumer);
    } else if (object instanceof Animation) {
        build((Animation) object, container, changeConsumer);
    }

    if (!(object instanceof Control)) return;

    if (object instanceof AbstractControl) {
        build((AbstractControl) object, container, changeConsumer);
    }

    super.buildForImpl(object, parent, container, changeConsumer);

    if (object instanceof SkeletonControl) {
        build((SkeletonControl) object, container, changeConsumer);
    } else if (object instanceof CharacterControl) {
        build((CharacterControl) object, container, changeConsumer);
    } else if (object instanceof RigidBodyControl) {
        build((RigidBodyControl) object, container, changeConsumer);
    } else if (object instanceof VehicleControl) {
        build((VehicleControl) object, container, changeConsumer);
    } else if (object instanceof MotionEvent) {
        build((MotionEvent) object, container, changeConsumer);
    }

    if (object instanceof PhysicsRigidBody) {
        build((PhysicsRigidBody) object, container, changeConsumer);
    }
}
 
Example 30
Project: projectintern   File: Door.java   Source Code and License 5 votes vote down vote up
public void doorClosed() {
    // Draw trim
    Rectangle rgDT = new Rectangle(WIDTH, HEIGHT);
    rgDT.setFill(Color.web("4d2626"));
    this.getChildren().add(rgDT);

    // Draw door
    Rectangle rgDD = new Rectangle(WIDTH - (WIDTH / (WIDTH / 4)), HEIGHT - (HEIGHT / (HEIGHT / 2)));
    rgDD.setTranslateX((WIDTH / (WIDTH / 2)));
    rgDD.setTranslateY((HEIGHT / (HEIGHT / 2)));
    rgDD.setFill(Color.web("673232"));
    this.getChildren().add(rgDD);

    // Draw three hinges
    VBox vbHinges = new VBox(WIDTH / 3);
    Rectangle rgDH1 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH1.setFill(Color.web("a5a5a5"));
    Rectangle rgDH2 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH2.setFill(Color.web("a5a5a5"));
    Rectangle rgDH3 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH3.setFill(Color.web("a5a5a5"));
    vbHinges.getChildren().addAll(rgDH1, rgDH2, rgDH3);
    vbHinges.setTranslateX(rgDH1.getWidth() / 2);
    vbHinges.setTranslateY(rgDH1.getHeight());
    this.getChildren().add(vbHinges);

    // Draw door handle block
    Rectangle rgDHM = new Rectangle((WIDTH / (WIDTH / 4)), (WIDTH / (WIDTH / 4)));
    rgDHM.setTranslateX(WIDTH - rgDHM.getWidth() * 2);
    rgDHM.setTranslateY(HEIGHT / 2 - rgDHM.getHeight() / 2);
    rgDHM.setFill(Color.web("bfbfbf"));
    this.getChildren().add(rgDHM);

    // Draw door handle
    Rectangle rgDHL = new Rectangle((WIDTH / (WIDTH / 8)), (WIDTH / (WIDTH / 2)));
    rgDHL.setTranslateX(WIDTH - rgDHL.getWidth() * 2);
    rgDHL.setTranslateY(HEIGHT / 2 - rgDHL.getHeight() / 2);
    rgDHL.setFill(Color.web("a5a5a5"));
    this.getChildren().add(rgDHL);
}
 
Example 31
Project: GameAuthoringEnvironment   File: SpawnerView.java   Source Code and License 5 votes vote down vote up
private Node getGap () {
    VBox vbox = new VBox();
    myDelay = myFactory.createTextField(myLang.getString("GapPrompt"),
                                        Double.parseDouble(myBundle.getString("TextWidth")));
    mySetButton = myFactory.createButton(myLang.getString("Set"));
    vbox.getChildren().addAll(myDelay, mySetButton);
    return vbox;
}
 
Example 32
Project: file-transfer   File: SendNetPane.java   Source Code and License 5 votes vote down vote up
private void createWindow() {
    VBox root = new VBox();
    Label label = new Label("Enter the destination ID.");
    root.getChildren().addAll(label, id, sendButton);
    root.setPadding(new Insets(NetPane.GENERAL_PADDING));
    root.setSpacing(NetPane.GENERAL_SPACING);
    root.setAlignment(Pos.CENTER);
    Scene scene = new Scene(root);
    scene.getStylesheets().add(getClass().getResource(".." + File.separator + "styles" + File.separator + "Style.css").toExternalForm());
    setScene(scene);
    setResizable(false);
    initModality(Modality.APPLICATION_MODAL);
    getIcons().add(new Image(getClass().getResourceAsStream(".." + File.separator + "images" + File.separator + "logo.png")));
    setTitle("FileSend - Send");
}
 
Example 33
Project: The-Trail   File: MidGameMenu.java   Source Code and License 5 votes vote down vote up
/**
 *
 * Creates, and sets the scene to one that allows the player(s) to set the pace
 *
 */
protected static void paceSetterMethod(){

    VBox PaceLayout = new VBox(10);
    Label label = new Label("Choose a speed");
    Button Slowbtn = new Button("Slow pace");
    Button ModerateSpeedbtn = new Button("Moderate pace");
    Button Fastbtn = new Button("Fast pace");

    label.setStyle("-fx-text-fill: purple;");
    label.setFont(new Font(20));
    PaceLayout.setStyle("-fx-background-color: black");

    Slowbtn.setOnAction(e -> {
        Gang.setPace(5);
        TravelController.animationDuration = 30;
        getMenuWindow().setScene(menuScene);
    });

    ModerateSpeedbtn.setOnAction(e -> {
        Gang.setPace(10);
        TravelController.animationDuration = 15;
        getMenuWindow().setScene(menuScene);
    });

    Fastbtn.setOnAction(e -> {
        Gang.setPace(15);
        TravelController.animationDuration = 10;
        getMenuWindow().setScene(menuScene);
    });

    PaceLayout.setPadding(new Insets(20,20,20,20));
    PaceLayout.getChildren().addAll(label,Slowbtn,ModerateSpeedbtn,Fastbtn);

    setPaceScene(new Scene(PaceLayout,320,200));
}
 
Example 34
Project: marathonv5   File: WaitMessageDialog.java   Source Code and License 5 votes vote down vote up
private void initComponents() {
    messageLabel = new Label(message);
    messageLabel.setAlignment(Pos.CENTER);
    messageLabel.setStyle("-fx-background-color:#000000");
    messageLabel.setTextFill(javafx.scene.paint.Color.WHITE);
    messageLabel.setMaxWidth(Double.MAX_VALUE);
    setScene(new Scene(new VBox(FXUIUtils.getImage("wait"), messageLabel)));
}
 
Example 35
Project: marathonv5   File: FileSelectionStage.java   Source Code and License 5 votes vote down vote up
@Override protected Parent getContentPane() {
    VBox root = new VBox();
    root.setId("FileSelectionStage");
    root.getStyleClass().add("file-selection");
    root.getChildren().addAll(createBrowserField(), createButtonBar());
    return root;
}
 
Example 36
Project: marathonv5   File: CheckListFormNode.java   Source Code and License 5 votes vote down vote up
private void buildVBox() {
    ObservableList<Node> children = getChildren();
    if (mode.isSelectable()) {
        children.addAll(createNameField(), createDescriptionField());
    } else {
        if (checkList.getName().equals("")) {
            children.add(addSeparator("<No Name>"));
        } else {
            children.add(addSeparator(checkList.getName()));
        }
        GridPane gridPane = new GridPane();
        String text = checkList.getDescription();
        if (text.equals("")) {
            text = "<No Description>";
        }
        StringTokenizer tok = new StringTokenizer(text, "\n");
        int rowIndex = 0;
        while (tok.hasMoreTokens()) {
            Label label = new Label(tok.nextToken());
            gridPane.add(label, 0, rowIndex++);
        }
        children.add(gridPane);
    }
    Iterator<CheckList.CheckListItem> items = checkList.getItems();
    while (items.hasNext()) {
        VBox vbox = items.next().getVbox(mode.isSelectable(), mode.isEditable());
        HBox.setHgrow(vbox, Priority.ALWAYS);
        children.add(vbox);
        if (mode.isSelectable()) {
            VBox.setMargin(vbox, new Insets(5, 10, 0, 5));
        }
    }
}
 
Example 37
Project: Lernkartei_2017   File: UserListView.java   Source Code and License 5 votes vote down vote up
@Override
public Parent constructContainer()
{
	
	bp.setId("loginviewbg");
	
	list = new ListView<String>();
	items = FXCollections.observableArrayList("Philippe Kr�ttli","Irina Deck","Javier Martinez Alvarez","Frithjof Hoppe");
	list.setItems(items);		
	
	AllFields = new VBox(50);
	AllFields.setAlignment(Pos.CENTER);
	AllFields.setMaxWidth(300);
	AllFields.setPadding(new Insets(20));
	
	SearchUser = new HBox();
	Bottom = new HBox();
	
	txtUserName = new TextField();
	txtUserName.setMinHeight(50);
	txtUserName.setMinWidth(700);
	txtUserName.setPromptText("Email-Adresse des Benutzers");
	
	btnSearch = new AppButton("Suchen");
	btnAdd = new AppButton("Hinzuf�gen");
	back = new BackButton(getFXController(),"Zur�ck");
	
	SearchUser.getChildren().addAll(txtUserName,btnSearch);
	Bottom.getChildren().addAll(back,btnAdd);
	AllFields.getChildren().addAll(SearchUser,list,Bottom);
	
	bp.setLeft(AllFields);
	
	//btnSearch.setOnAction(e -> getFXController().showView("userlist"));
	
	
	return bp;
}
 
Example 38
Project: jmonkeybuilder   File: ProcessingComponentContainer.java   Source Code and License 5 votes vote down vote up
/**
 * Notify about showed this container.
 */
@FXThread
public void notifyShowed() {
    setShowed(true);

    final VBox container = getContainer();
    final ObservableList<Node> children = container.getChildren();
    children.stream().filter(componentType::isInstance)
            .map(componentType::cast)
            .forEach(ProcessingComponent::notifyShowed);
}
 
Example 39
Project: Lernkartei_2017   File: Alert.java   Source Code and License 5 votes vote down vote up
/**
 * Fenster mit OK- und Abbrechen-Buttons
 * 
 * @param title
 *            Der Titel des Fensters
 * @param message
 *            Die Narchricht, die angezeigt wird. Text wird nicht von selbst
 *            gewrapt.
 * @return True, wenn der User akzeptiert, sonst false
 */
public static boolean ok (String title, String message)
{
	Stage window = buildWindow(title);
	Label l = new Label(message);

	Button bo = new Button("_OK");
	Button ba = new Button("_Abbrechen");

	bo.setOnAction(e ->
	{
		tempOkay = true;
		window.close();
	});

	ba.setOnAction(e ->
	{
		tempOkay = false;
		window.close();
	});

	HBox buttons = new HBox(20);
	buttons.setAlignment(Pos.CENTER);
	buttons.setPadding(new Insets(20));
	buttons.getChildren().addAll(bo, ba);

	VBox layout = new VBox(20);
	layout.getChildren().addAll(l, buttons);
	layout.setAlignment(Pos.CENTER);
	layout.setPadding(new Insets(40, 20, 20, 20));

	int width;
	int x = 6;
	int y = 150;

	width = message.length() * x + y;

	layout.setOnKeyReleased(e ->
	{
		if (e.getCode() == KeyCode.ESCAPE)
			window.close();
	});
	
	window.setScene(new Scene(layout, width, 150));
	window.showAndWait();

	okay = tempOkay;
	tempOkay = false;
	
	return okay;
}
 
Example 40
Project: WebPLP   File: EditorSettingsPanel.java   Source Code and License 5 votes vote down vote up
public EditorSettingsPanel( ObservableList<String> fontList, ObservableList<String> editorModes,
		EditorSettingDetails details )
{
	EditorSettingDetails settingDetails = ( details != null ) ? details : EditorSettingDetails.DEFAULT;
	VBox settingsColumn = new VBox();

	settingsColumn.getChildren().add(fontListSelection(settingDetails, fontList));
	settingsColumn.getChildren().add(fontSizeSelection(settingDetails));
	settingsColumn.getChildren().add(editorModeSelection(settingDetails, editorModes));

	settingsColumn.setPadding(new Insets(10));
	settingsColumn.setSpacing(8);

	setCenter(settingsColumn);
}