Java Code Examples for javafx.geometry.Insets

The following are top voted examples for showing how to use javafx.geometry.Insets. 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: stvs   File: StvsPreloader.java   Source Code and License 15 votes vote down vote up
@Override
public void start(Stage stage) {
  this.stage = stage;

  stage.initStyle(StageStyle.TRANSPARENT);

  VBox box = new VBox(20);
  box.setMaxWidth(Region.USE_PREF_SIZE);
  box.setMaxHeight(Region.USE_PREF_SIZE);
  box.setBackground(Background.EMPTY);
  String style = "-fx-background-color: rgba(255, 255, 255, 0.5);";
  box.setStyle(style);

  box.setPadding(new Insets(50));
  BorderPane root = new BorderPane(box);
  root.setStyle(style);
  root.setBackground(Background.EMPTY);
  Scene scene = new Scene(root);
  scene.setFill(Color.TRANSPARENT);
  stage.setScene(scene);

  ImageView splashView = new ImageView(splashImage);
  box.getChildren().addAll(splashView, new Label("ST Verification Studio is loading.."));
  stage.show();
  Rectangle2D primScreenBounds = Screen.getPrimary().getVisualBounds();
  stage.setX((primScreenBounds.getWidth() - stage.getWidth()) / 2);
  stage.setY((primScreenBounds.getHeight() - stage.getHeight()) / 2);
}
 
Example 2
Project: marathonv5   File: ChoiceBoxSample.java   Source Code and License 10 votes vote down vote up
@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    scene.setFill(Color.ALICEBLUE);
    stage.setScene(scene);
    stage.show();

    stage.setTitle("ChoiceBox Sample");
    stage.setWidth(300);
    stage.setHeight(200);
  
    label.setFont(Font.font("Arial", 25));
    label.setLayoutX(40);

   final String[] greetings = new String[]{"Hello", "Hola", "Привет", "你好",
       "こんにちは"};
   final ChoiceBox cb = new ChoiceBox(FXCollections.observableArrayList(
       "English", "Español", "Русский", "简体中文", "日本語")
   );
                                 
   cb.getSelectionModel().selectedIndexProperty().addListener(
       (ObservableValue<? extends Number> ov,
            Number old_val, Number new_val) -> {
                label.setText(greetings[new_val.intValue()]);            
    });
         
    cb.setTooltip(new Tooltip("Select the language"));
    cb.setValue("English");
    HBox hb = new HBox();
    hb.getChildren().addAll(cb, label);
    hb.setSpacing(30);
    hb.setAlignment(Pos.CENTER);
    hb.setPadding(new Insets(10, 0, 0, 10));

    ((Group) scene.getRoot()).getChildren().add(hb);
    
   
   
    
}
 
Example 3
Project: matriximage   File: Main.java   Source Code and License 8 votes vote down vote up
@Override public void start(Stage stage) {
    HBox pane = new HBox(imageView, matrix);
    pane.setSpacing(10);
    pane.setPadding(new Insets(10));
    pane.setBackground(new Background(new BackgroundFill(Color.rgb(10, 10, 20), CornerRadii.EMPTY, Insets.EMPTY)));
    Scene scene = new Scene(pane);

    stage.setTitle("Matrix Image");
    stage.setScene(scene);
    stage.show();

    timer.start();
}
 
Example 4
Project: marathonv5   File: PasswordFiledSample.java   Source Code and License 7 votes vote down vote up
@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();
}
 
Example 5
Project: testing-video   File: CalibrationBase.java   Source Code and License 7 votes vote down vote up
protected Parent overlay(int window, int yCode) {
    EncoderParameters params = getEncoderParameters();
    double ye = params.matrix.fromLumaCode(yCode);
    double yo = params.transfer.eotf(ye);
    CIExy xy = getColor(yo);

    String text = format("HDR10 grayscale CIE(x=%.4f, y=%.4f) %.1f%% Y%d,"
            + " %.1f nit", xy.x, xy.y, ye * 100.0, yCode, yo * 10000.0);

    Label label = new Label(text);
    label.setFont(font(40));
    label.setTextFill(gray(max(0.25, min(0.5, ye))));

    BorderPane.setMargin(label, new Insets(20));
    BorderPane layout = new BorderPane();
    layout.setBackground(EMPTY);
    layout.setBottom(label);
    return layout;
}
 
Example 6
Project: Matcher   File: FieldInfoTab.java   Source Code and License 7 votes vote down vote up
private void init() {
	GridPane grid = new GridPane();
	grid.setPadding(new Insets(GuiConstants.padding));
	grid.setHgap(GuiConstants.padding);
	grid.setVgap(GuiConstants.padding);
	int row = 0;

	row = addRow("Owner", ownerLabel, grid, row);
	row = addRow("Name", nameLabel, grid, row);
	row = addRow("Type", typeLabel, grid, row);
	row = addRow("Access", accessLabel, grid, row);
	row = addRow("Signature", sigLabel, grid, row);
	row = addRow("Parents", parentLabel, grid, row);
	row = addRow("Children", childLabel, grid, row);
	row = addRow("Read refs", readRefLabel, grid, row);
	row = addRow("Write refs", writeRefLabel, grid, row);
	row = addRow("Comment", mapCommentLabel, grid, row);

	setContent(grid);
}
 
Example 7
Project: WeatherWatch   File: WeatherPage.java   Source Code and License 6 votes vote down vote up
@Override
public void start(Stage primaryStage) throws Exception {
    WatchDAO.addWatcher(this);
    stage = primaryStage;
    stage.setTitle(ViewConstants.PROGRAM_TITLE);
    stage.getIcons().add(fileLoad.loadImageFile(ViewConstants.PROGRAM_ICON_LOCATION));

    gridPane = new GridPane();
    gridPane.setAlignment(Pos.TOP_LEFT);
    gridPane.setHgap(10);
    gridPane.setVgap(10);
    gridPane.setPadding(new Insets(10, 10, 10, 10));

    Scene scene = new Scene(gridPane, ViewConstants.PROGRAM_WIDTH, ViewConstants.PROGRAM_HEIGHT);
    primaryStage.setScene(scene);
    primaryStage.show();

    gridPane.getStylesheets().add(this.getClass().getClassLoader().getResource("gui/css/weatherwatch.css")
            .toExternalForm());
    loadWeatherImages();
    addGuiElements();
    TrayApp.initialize();
}
 
Example 8
Project: MasterHash   File: NewLogin.java   Source Code and License 6 votes vote down vote up
public static void display() {
	window = new Stage();
	window.initModality(Modality.APPLICATION_MODAL);
	window.setTitle("Log In");
	HEADING = "New Login";

	Label headingLabel = new Label(HEADING);
	headingLabel.setFont(Font.font("Verdana", FontWeight.BOLD, 30));

	TextField nameTextField = new TextField();
	nameTextField.setPromptText("Name");

	TextField userNameTextField = new TextField();
	userNameTextField.setPromptText("Username");

	PasswordField passwordField = new PasswordField();
	passwordField.setPromptText("Password");
	Button generateButton = new Button("Generate");

	HBox generatePasswordArea = new HBox();
	generatePasswordArea.getChildren().addAll(passwordField, generateButton);

	Button submitButton = new Button("Submit");

	VBox layout = new VBox(10);
	layout.setPadding(new Insets(0, 20, 0, 20));
	layout.setAlignment(Pos.CENTER_LEFT);
	layout.getChildren().addAll(headingLabel, nameTextField, userNameTextField, generatePasswordArea, submitButton);

	Scene scene = new Scene(layout, 300, 400);
	window.setScene(scene);
	window.showAndWait();
}
 
Example 9
Project: TechnicalAnalysisTool   File: TatMessageBox.java   Source Code and License 6 votes vote down vote up
/**
    * Make Information Dialog
    * @return BorderPane
    */
   public void makeInfoGUI() {
       root = new Group();
       Scene scene = new Scene(root, 360, 185, Color.WHITE);
       ImagePattern pattern = new ImagePattern(new Image("icon/bk2.jpg"));
       scene.setFill(pattern);
       setTitle("Information");
       setScene(scene);
       Image appIcon = new Image("icon/INFO.png");
       getIcons().add(appIcon);
       BorderPane bp = new BorderPane();

       textArea = new TextArea(message);
       textArea.setEditable(false);
       textArea.setWrapText(true);
       textArea.setMaxWidth(320);
       textArea.setMaxHeight(130);
       HBox hBox = new HBox();
       hBox.setSpacing(5);
       hBox.setPadding(new Insets(5,0,0,0));
       hBox.setAlignment(Pos.BOTTOM_RIGHT);
       hBox.getChildren().addAll(okButton);
       bp.setCenter(textArea);
       bp.setBottom(hBox);
       root.getChildren().add(bp);
       sizeToScene();
       setX(owner.getX() + Math.abs(owner.getWidth() - scene.getWidth()) / 2.0);
setY(owner.getY() + Math.abs(owner.getHeight() - scene.getHeight()) / 2.0);
   }
 
Example 10
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 11
Project: Hive_Game   File: GameScreenController.java   Source Code and License 6 votes vote down vote up
public void queenWarning(){
    
    Dialog<ButtonType> popup = new Dialog<>();
    popup.setTitle("Ajout impossible");
    ButtonType close = new ButtonType("Fermer", ButtonBar.ButtonData.RIGHT);
    popup.getDialogPane().getButtonTypes().add(close);

    GridPane grid = new GridPane();
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(20, 150, 10, 10));

    popup.getDialogPane().setContent(grid);
    grid.add(new Label("Vous devez jouer votre reine."), 0, 0);
    popup.show();
}
 
Example 12
Project: Conan   File: AssumptionPane.java   Source Code and License 6 votes vote down vote up
public AssumptionPane(){
    //this.getChildren().addAll(openButton,closeButton);
    openButton.setMinWidth(100);
    openButton.setMinHeight(40);
    closeButton.setMinWidth(100);
    closeButton.setMinHeight(40);
    this.add(openButton,0,0);
    this.add(closeButton,1,0);
    openButton.setTooltip(openTip);
    closeButton.setTooltip(closeTip);

    this.setMargin(openButton, new Insets(5, 5, 5, 5));
    this.setMargin(closeButton, new Insets(5, 5, 5, 5));

//    this.setGridLinesVisible(true);
    }
 
Example 13
Project: marathonv5   File: VBoxSample.java   Source Code and License 6 votes vote down vote up
public static Node createIconContent() {
    StackPane sp = new StackPane();
    VBox vbox = new VBox(3);
    vbox.setAlignment(Pos.CENTER);
    vbox.setPadding(new Insets(5, 5, 5, 5));

    Rectangle rectangle = new Rectangle(32, 62, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    vbox.setPrefSize(rectangle.getWidth(), rectangle.getHeight());
    Rectangle r1 = new Rectangle(18, 14, Color.web("#1c89f4"));
    Rectangle r2 = new Rectangle(18, 14, Color.web("#349b00"));
    Rectangle r3 = new Rectangle(18, 20, Color.web("#349b00"));

    vbox.getChildren().addAll(r1, r2, r3);
    sp.getChildren().addAll(rectangle, vbox);
    return new Group(sp);
}
 
Example 14
Project: marathonv5   File: Sample.java   Source Code and License 6 votes vote down vote up
@Override protected void layoutChildren() {
    if (isFixedSize) {
        super.layoutChildren();
    } else {
        List<Node> managed = getManagedChildren();
        double width = getWidth();
        ///System.out.println("width = " + width);
        double height = getHeight();
        ///System.out.println("height = " + height);
        double top = getInsets().getTop();
        double right = getInsets().getRight();
        double left = getInsets().getLeft();
        double bottom = getInsets().getBottom();
        for (int i = 0; i < managed.size(); i++) {
            Node child = managed.get(i);
            layoutInArea(child, left, top,
                           width - left - right, height - top - bottom,
                           0, Insets.EMPTY, true, true, HPos.CENTER, VPos.CENTER);
        }
    }
}
 
Example 15
Project: fx-animation-editor   File: SceneComponent.java   Source Code and License 6 votes vote down vote up
private void initUi() {
    root.setMinSize(0, 0);
    root.setPrefSize(1, 1); // Decouple from children.
    root.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    root.getStyleClass().add(STYLE_CLASS);
    root.getStylesheets().add(getClass().getResource(STYLESHEET).toExternalForm());
    root.setAlignment(Pos.TOP_LEFT);
    root.getChildren().addAll(panningComponent.getRoot(), addButton);

    panningComponent.getChildren().addAll(sceneContent, resizerComponent.getRoot(), selectionBox.getRoot());

    StackPane.setMargin(addButton, new Insets(15));
    addButton.setGraphic(Svg.PLUS_FAT.node());
    addButton.setFocusTraversable(false);

    FocusHelper.requestFocusOnPress(panningComponent.getRoot());
}
 
Example 16
Project: PSE   File: ItemView.java   Source Code and License 6 votes vote down vote up
/**
 * Creates the title and description text
 * @return Returns a VBox containing the texts.
 */
public VBox createText(){

    final VBox layout = new VBox(5.0f);
    layout.setAlignment(Pos.CENTER_LEFT);
    layout.setPadding(new Insets(10,10,10,10));
    layout.setMaxWidth(300.0f);

    title = new Label(content.getName());
    title.setTextFill(javafx.scene.paint.Paint.valueOf(TEXT_COLOR));
    title.setFont( javafx.scene.text.Font.font(FONT_NAME, FontWeight.EXTRA_BOLD,FONT_SIZE) );

    description = new Text(content.getDescription());
    description.setFill(Paint.valueOf("#ffffff"));
    description.setFont( javafx.scene.text.Font.font(FONT_NAME, FontWeight.BOLD,12.0f) );
    description.setBoundsType(TextBoundsType.LOGICAL_VERTICAL_CENTER);

    layout.getChildren().add(title);
    layout.getChildren().add(description);

    return layout;

}
 
Example 17
Project: marathonv5   File: Sample.java   Source Code and License 6 votes vote down vote up
@Override protected void layoutChildren() {
    if (isFixedSize) {
        super.layoutChildren();
    } else {
        List<Node> managed = getManagedChildren();
        double width = getWidth();
        ///System.out.println("width = " + width);
        double height = getHeight();
        ///System.out.println("height = " + height);
        double top = getInsets().getTop();
        double right = getInsets().getRight();
        double left = getInsets().getLeft();
        double bottom = getInsets().getBottom();
        for (int i = 0; i < managed.size(); i++) {
            Node child = managed.get(i);
            layoutInArea(child, left, top,
                           width - left - right, height - top - bottom,
                           0, Insets.EMPTY, true, true, HPos.CENTER, VPos.CENTER);
        }
    }
}
 
Example 18
Project: Curriculum-design-of-data-structure   File: ShowCrossRiverController.java   Source Code and License 6 votes vote down vote up
protected void showAnswer(){

        show.setPadding(new Insets(20));
        show.setHgap(100);
        show.setVgap(20);

        show.add(new Label("步骤"), 0, 0);
        show.add(new Label("南岸"), 1, 0);
        show.add(new Label("北岸"), 2, 0);

        for (int i = 0; i < dataRow.length; i++) {
            for (int j = 0; j < dataRow[i].length; j++) {
                Label label = new Label(String.valueOf(dataRow[i][j]).replaceAll("[]]", "").replaceAll("\\[", ""));
                label.setBorder(new Border(new BorderStroke(Color.YELLOW, BorderStrokeStyle.SOLID, null, new BorderWidths(5))));


                show.add(label, j, i + 1);
            }
        }
    }
 
Example 19
Project: can4eve   File: OverviewDemo.java   Source Code and License 6 votes vote down vote up
public GridPane getDemoPane() {
    GridPane pane = new GridPane();
    pane.add(framedGauge1, 0, 0);
    pane.add(framedGauge2, 1, 0);
    pane.add(gauge3, 2, 0);
    pane.add(gauge4, 3, 0);
    pane.add(gauge5, 4, 0);
    pane.add(clock1, 5, 0);
    pane.add(clock5, 6, 0);
    pane.add(gauge22, 7, 0);
    pane.add(gauge29, 8, 0);

    pane.add(gauge6, 0, 1);
    pane.add(gauge7, 1, 1);
    pane.add(gauge8, 2, 1);
    pane.add(gauge9, 3, 1);
    pane.add(gauge10, 4, 1);
    pane.add(clock2, 5, 1);
    pane.add(gauge21, 6, 1);
    pane.add(gauge23, 7, 1);
    pane.add(gauge30, 8, 1);

    pane.add(gauge11, 0, 2);
    pane.add(gauge12, 1, 2);
    pane.add(gauge13, 2, 2);
    pane.add(gauge14, 3, 2);
    pane.add(gauge15, 4, 2);
    pane.add(clock3, 5, 2);
    pane.add(clock6, 6, 2);
    pane.add(clock8, 7, 2);
    pane.add(gauge31, 8, 2);

    pane.add(gauge16, 0, 3);
    pane.add(gauge17, 1, 3);
    pane.add(gauge18, 2, 3);
    pane.add(gauge19, 3, 3);
    pane.add(gauge20, 4, 3);
    pane.add(clock4, 5, 3);
    pane.add(clock7, 6, 3);
    pane.add(gauge24, 7, 3);
    pane.add(clock12, 8, 3);

    pane.add(gauge25, 0, 4);
    pane.add(gauge26, 1, 4);
    pane.add(gauge27, 2, 4);
    pane.add(gauge28, 4, 4);
    pane.add(clock9, 5, 4);
    pane.add(clock10, 6, 4);
    pane.add(clock11, 7, 4);
    pane.setHgap(10);
    pane.setVgap(10);
    pane.setPadding(new Insets(10));
    for (int i = 0 ; i < 9 ; i++) {
        pane.getColumnConstraints().add(new ColumnConstraints(MIN_CELL_SIZE, PREF_CELL_SIZE, MAX_CELL_SIZE));
    }
    for (int i = 0 ; i < 5 ; i++) {
        pane.getRowConstraints().add(new RowConstraints(MIN_CELL_SIZE, PREF_CELL_SIZE, MAX_CELL_SIZE));
    }
    pane.setBackground(new Background(new BackgroundFill(Color.rgb(90, 90, 90), CornerRadii.EMPTY, Insets.EMPTY)));
    return pane;
}
 
Example 20
Project: marathonv5   File: DirectoryChooserSample.java   Source Code and License 6 votes vote down vote up
@Override public void start(final Stage stage) {
    stage.setTitle("Directory Chooser Sample");

    final DirectoryChooser directoryChooser = new DirectoryChooser();
    final Button openButton = new Button("Select a folder...");

    openButton.setOnAction((final ActionEvent e) -> {
        File file = directoryChooser.showDialog(stage);
        if (file != null) {
            openFile(file);
        }
    });

    final GridPane inputGridPane = new GridPane();

    GridPane.setConstraints(openButton, 0, 1);
    inputGridPane.setHgap(6);
    inputGridPane.setVgap(6);
    inputGridPane.getChildren().addAll(openButton);

    final Pane rootGroup = new VBox(12);
    rootGroup.getChildren().addAll(inputGridPane);
    rootGroup.setPadding(new Insets(12, 12, 12, 12));

    stage.setScene(new Scene(rootGroup));
    stage.show();
}
 
Example 21
Project: jfree-fxdemos   File: CategoryMarkerFXDemo1.java   Source Code and License 6 votes vote down vote up
public CustomDemoNode(Chart3D chart) {
    this.chartViewer = new Chart3DViewer(chart);
    this.chartViewer.addEventHandler(FXChart3DMouseEvent.MOUSE_CLICKED, 
            (FXChart3DMouseEvent event) -> {
                chartMouseClicked(event);
            });
    this.selectedRowKey = "Apple";
    this.selectedColumnKey = "Q4/12";
    this.itemLabelCheckBox = new CheckBox("Show item labels?");
    this.itemLabelCheckBox.setOnAction(e -> { 
        updateItemSelection(selectedRowKey, selectedColumnKey);
        chart.setNotify(true);
    });
    setCenter(this.chartViewer);
    HBox container = new HBox();
    container.setAlignment(Pos.CENTER);
    container.setPadding(new Insets(4.0, 4.0, 4.0, 4.0));
    container.getChildren().add(this.itemLabelCheckBox);
    setBottom(container);
}
 
Example 22
Project: Lernkartei_2017   File: GroupMemberView.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));
	
	GroupName = new HBox(50);
	Option = new HBox(50);
	
	name = new Label("Name:");
	groupname = new Label("{Gruppenname}");
	
	btnAdd = new AppButton("Hinzuf�gen");
	btnRemove = new AppButton("Entfernen");
	back = new BackButton(getFXController(),"Zur�ck");
	
	
	
	GroupName.getChildren().addAll(name,groupname);
	Option.getChildren().addAll(back,btnAdd,btnRemove);
	
	AllFields.getChildren().addAll(GroupName,Option,list);
	
	
	bp.setCenter(AllFields);
	
	back.setOnAction(e -> getFXController().showView("groupview"));
	btnAdd.setOnAction(e -> getFXController().showView("userlistview"));
	
	btnRemove.setOnAction(e -> {
	Alert alert = new Alert(AlertType.CONFIRMATION);
	alert.setTitle("Mitglied l�schen");
	alert.setHeaderText("Sie sind gerade dabei ein Mitglied aus der Gruppe zu entfernen.");
	alert.setContentText("Sind Sie sich sicher, dass sie das tun wollen?");
	Optional<ButtonType> result = alert.showAndWait();
	if (result.get() == ButtonType.OK){
	    // ... user chose OK
	} else {
		Alert noDeletion = new Alert(AlertType.INFORMATION);
		noDeletion.setTitle("L�schvorgang abgebrochen");
		noDeletion.setHeaderText("Mitglied nicht gel�scht");
		noDeletion.setContentText("Der L�schvorgang wurde abgebrochen.");
		noDeletion.showAndWait();
	    alert.close();
	}});
	
	return bp;
}
 
Example 23
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 food portions
 *
 */
protected static void foodPortionSet(){

    Button BuffetDietbtn = new Button("Buffet");
    VBox FoodPortionsLayout = new VBox(10);
    Button ExtremeDietbtn = new Button("Extreme");
    Label label = new Label("Select your meal plan");
    Button ModerateDietbtn = new Button("Moderate");

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

    ExtremeDietbtn.setOnAction(e -> {
        Gang.setFoodIntake(1);
        getMenuWindow().setScene(menuScene);
    });

    ModerateDietbtn.setOnAction(e -> {
        Gang.setFoodIntake(2);
        getMenuWindow().setScene(menuScene);
    });

    BuffetDietbtn.setOnAction(e -> {
        Gang.setFoodIntake(3);
        getMenuWindow().setScene(menuScene);
    });

    FoodPortionsLayout.setPadding(new Insets(20,20,20,20));
    FoodPortionsLayout.getChildren().addAll(label,ExtremeDietbtn,ModerateDietbtn,BuffetDietbtn);

    setFoodPortionsScene(new Scene(FoodPortionsLayout,320,200));
}
 
Example 24
Project: Java-9-Programming-Blueprints   File: InstagramPreferencesController.java   Source Code and License 5 votes vote down vote up
private Node buildConfigurationUI() {
    VBox box = new VBox();
    box.setPadding(new Insets(10));
    Label label = new Label("Configure Instragram");
    box.getChildren().add(label);
    return box;
}
 
Example 25
Project: campingsimulator2017   File: EmployeeManagerView.java   Source Code and License 5 votes vote down vote up
/**
 * @param e the employe to add
 * @param i the iterator on the list
 * add an employee to the scroll
 */
private void createElement(Employee e, int i){
    HBox employeesBox = new HBox();

    employeesBox.setOnMouseClicked(event -> {
        for (int j=0; j<employees.getChildren().size(); j++) {
            if(j % 2 == 1)
                employees.getChildren().get(j).setStyle("-fx-background-color: #336699;");
            else
                employees.getChildren().get(j).setStyle("-fx-background-color: #0F355C;");
        }

        currentEmployee = e;
        updateDetail(e);
        employeesBox.setStyle("-fx-background-color: #ff6600;");
    });
    employeesBox.setMinWidth(HomeView.TAB_CONTENT_W / 4);
    employeesBox.setPadding(new Insets(20));

    Text employeeText = new Text(e.getFirstName() + " " + e.getLastName());
    employeeText.setFont(new Font(20));
    employeeText.setFill(Color.WHITE);
    employeesBox.getChildren().add(employeeText);

    if (i % 2 == 1)
        employeesBox.setStyle("-fx-background-color: #336699;");
    else
        employeesBox.setStyle("-fx-background-color: #0F355C;");

    employees.getChildren().add(employeesBox);
}
 
Example 26
Project: xpanderfx   File: MainFXMLDocumentController.java   Source Code and License 5 votes vote down vote up
/**
 * About content
 */
@SuppressWarnings("deprecation")
private void showAboutContent() {
	try {
		Node content = FXMLLoader.load(getClass().getResource("/com/shekkar/xpanderfx/top/popup/AboutFXMLDocument.fxml"));
		about_box = new VBox();
		about_box.getChildren().addAll(content,
				HBoxBuilder.create().alignment(Pos.CENTER_RIGHT)
				.padding(new Insets(0,3,0,0))
				.children(
				      ButtonBuilder.create().text("OK")
				      .minHeight(40)
				      .minWidth(70)
				      .style("-fx-base:black;"
					+ "-fx-border-radius: 7;"
					+ "-fx-background-radius: 7;")
				      .onAction(e -> this.popupCloser(about, about_box))
				      .font(Font.font("System", FontWeight.MEDIUM, FontPosture.REGULAR, 20))
				      .build()
				)
				.build()
			 );
		about_box.setStyle("-fx-background-color: linear-gradient(black, lightgrey);"
			 + "-fx-background-radius: 7;"
			 + "-fx-border-radius: 7;");
		about.getContent().add(about_box);
	} catch (IOException ex) {
		Logger.getLogger(MainFXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex);
	}
	about.show(this.ICON.getScene().getWindow(), this.getNodeMaxX() - 14, this.getNodeMaxY() + 12);
	this.popupOpener(about_box);		
}
 
Example 27
Project: PearPlanner   File: UIManager.java   Source Code and License 5 votes vote down vote up
/**
 * Displays a GanttishDiagram window for the given Assignment.
 *
 * @param assignment Assignment for which to generate the GanttishDiagram.
 */
public void showGantt(Assignment assignment)
{
    Stage stage = new Stage();

    // Layout:
    VBox layout = new VBox();
    layout.setSpacing(10);
    layout.setPadding(new Insets(15));
    layout.getStylesheets().add("/Content/stylesheet.css");
    // =================

    // Nav bar:
    HBox nav = new HBox();
    nav.setSpacing(15.0);
    // =================

    // Title:
    Label title = new Label("Ganttish Diagram");
    title.getStyleClass().add("title");
    HBox x = new HBox();
    HBox.setHgrow(x, Priority.ALWAYS);
    // =================

    // Buttons:
    Button save = new Button("Save");
    save.setOnAction(e -> {
        String path = this.saveFileDialog(stage);
        GanttishDiagram.createGanttishDiagram(MainController.getSPC().getPlanner(), assignment, path);
    });
    Button close = new Button("Close");
    close.setOnAction(e -> ((Stage) close.getScene().getWindow()).close());
    // =================

    nav.getChildren().addAll(title, x, save, close);

    // Content:
    BufferedImage gantt = GanttishDiagram.createGanttishDiagram(MainController.getSPC().getPlanner(), assignment);
    Image image = SwingFXUtils.toFXImage(gantt, null);
    Pane content = new Pane();
    VBox.setVgrow(content, Priority.ALWAYS);
    content.setBackground(new Background(
            new BackgroundImage(image, BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.DEFAULT,
                    new BackgroundSize(BackgroundSize.AUTO, BackgroundSize.AUTO, false, false, true, false))));
    // =================

    layout.getChildren().addAll(nav, content);

    // Set the scene:
    stage.setScene(new Scene(layout, 1300, 800, true, SceneAntialiasing.BALANCED));
    stage.setTitle("Ganttish Diagram");
    stage.resizableProperty().setValue(true);
    stage.getIcons().add(new Image("file:icon.png"));
    stage.setFullScreen(true);
    stage.showAndWait();
    // =================
}
 
Example 28
Project: FxTreeMap   File: FxTreeMap.java   Source Code and License 5 votes vote down vote up
public FxTreeMap(MapData mapData, boolean withLayoutDelay) {
    super(withLayoutDelay);
    //
    treeMapLayout = new TreeMapLayout();
    mapLevels = new HashMap<>();
    treeItems = new HashMap<>();
    model = new FxMapModel(FxTreeMap.this, mapData, getWidth(), getHeight());
    mapData.addPropertyChangeListener(this::handleModelChange);
    mapLevels.put(model.getData(), model);
    currentModel = model;
    model.setTreeMapStyle(style);
    style.addPropertyChangeListener(this::handleStyleChanged);
    //
    layout = new VBox(8);
    layout.setPadding(new Insets(8));
    //
    breadCrumbBar = new BreadCrumbBar();
    pane = new Pane();
    pane.getChildren().addAll(model.getFxItems().stream().map(i -> i.getNode()).collect(Collectors.toList()));
    layout.getChildren().add(breadCrumbBar);
    layout.getChildren().add(pane);
    VBox.setVgrow(breadCrumbBar, Priority.NEVER);
    VBox.setVgrow(pane, Priority.ALWAYS);
    getContainer().getChildren().add(layout);
    AnchorPane.setBottomAnchor(layout, 0.0);
    AnchorPane.setLeftAnchor(layout, 0.0);
    AnchorPane.setRightAnchor(layout, 0.0);
    AnchorPane.setTopAnchor(layout, 0.0);
    //
    createBar();
    //
    breadCrumbBar.setAutoNavigationEnabled(true);
    breadCrumbBar.setOnCrumbAction((BreadCrumbActionEvent<MapData> bae) -> handleBreadCrumbEvent(bae));
    breadCrumbBar.setCrumbFactory((TreeItem<MapData> param) -> {
        String label = param != null && param.getValue() != null ? param.getValue().getName() : "?";
        return new BreadCrumbBarSkin.BreadCrumbButton(label);
    });
    //
    runLater(() -> requestLayoutUpdate());
}
 
Example 29
Project: KetchupDesktop   File: KetchupDesktopView.java   Source Code and License 5 votes vote down vote up
private FlowPane getTimerButtonsPane() {
    FlowPane timerButtonsPane = new FlowPane();
    timerButtonsPane.getChildren().add(resetButton);
    timerButtonsPane.getChildren().add(changeStateButton);
    timerButtonsPane.setHgap(10);
    timerButtonsPane.setPadding(new Insets(0, 0, 25, 0));
    timerButtonsPane.setAlignment(Pos.CENTER);
    return timerButtonsPane;
}
 
Example 30
Project: JavaFx-Material-Design   File: Controller.java   Source Code and License 5 votes vote down vote up
@Override
public void changed(ObservableValue observable, Object oldValue, Object newValue) {
	double red = slider1.getValue();
	double green = slider2.getValue();
	double blue = slider3.getValue();
	Color color = Color.rgb((int)red,(int)green,(int)blue);
	pane.setBackground(new Background(new BackgroundFill(color, CornerRadii.EMPTY, Insets.EMPTY)));
}
 
Example 31
Project: NoMoreOversleeps   File: JavaFxHelper.java   Source Code and License 5 votes vote down vote up
public static Separator createSeparator(Orientation orientation, double width, Insets padding)
{
	Separator separator = new Separator(orientation);
	separator.setPrefWidth(width);
	separator.setPadding(padding);
	return separator;
}
 
Example 32
Project: Lernkartei_2017   File: SimpleEditorView.java   Source Code and License 5 votes vote down vote up
@Override
public Parent constructContainer ()
{
	headLbl = new Label("");
	headLbl.setId("bold");

	AppButton backBtn = new AppButton("_Zur�ck");
	backBtn.setOnAction(e -> getFXController().showView("stack"));

	//Info Button
	AppButton infobtn = new AppButton("Hilfe");
	infobtn.setOnAction(e ->
	getFXController().showView("bbcodeinfo"));
	
	BorderPane headLayout = new BorderPane(headLbl);
	headLayout.setPadding(new Insets(0, 0, 25, 0));

	editLayout.setPadding(new Insets(10));
	editLayout.setAlignment(Pos.TOP_CENTER);
	
	scroller.setMaxWidth(600);
	scroller.setFitToWidth(true);
	scroller.setPadding(new Insets(25));
	

	MainLayout maLay = new MainLayout(scroller, headLayout, new ControlLayout(backBtn, infobtn));
	getFXController().getModel("cards").registerView(this);
	return maLay;
}
 
Example 33
Project: CalendarFX   File: DayViewScrollPane.java   Source Code and License 5 votes vote down vote up
public void scrollToTime(LocalTime time) {
    double y = ViewHelper.getTimeLocation(dayView, time, true);
    Insets insets = getInsets();

    // place the given time at one third of the visible height
    dayView.setTranslateY(Math.min(0, Math.max(-y + getHeight() / 3, getMaxTranslateY(insets))));
}
 
Example 34
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 35
Project: dotmatrix   File: Demo.java   Source Code and License 5 votes vote down vote up
@Override public void start(Stage stage) {
    StackPane pane = new StackPane(matrix);
    pane.setPadding(new Insets(10));
    pane.setBackground(new Background(new BackgroundFill(Color.rgb(20, 20, 20), CornerRadii.EMPTY, Insets.EMPTY)));

    Scene scene = new Scene(pane);

    stage.setTitle("DotMatrix");
    stage.setScene(scene);
    stage.show();

    timer.start();
}
 
Example 36
Project: marathonv5   File: CustomNodeSample.java   Source Code and License 5 votes vote down vote up
public CustomNodeSample() {        
    VBox vbox = new VBox();
    MyNode myNode = new MyNode("MyNode");
    MyNode parent = new MyNode("Parent");
    Polygon arrow = createUMLArrow();
    Label extend = new Label("<<extends>>");
    extend.setStyle("-fx-padding: 0 0 0 -1em;");
    vbox.getChildren().addAll(parent,arrow,myNode);
    vbox.setAlignment(Pos.CENTER);        
    HBox hbox = new HBox();
    hbox.setAlignment(Pos.CENTER);
    hbox.setPadding(new Insets(10));
    hbox.getChildren().addAll(vbox,extend);
    getChildren().addAll(hbox);
}
 
Example 37
Project: Lernkartei_2017   File: SaveUploadstackOnServerDialogView.java   Source Code and License 5 votes vote down vote up
@Override
public Parent constructContainer()
{
	bp.setId("loginviewbg");
	
	bottom = new HBox(50);
	bottom.setAlignment(Pos.CENTER);
	bottom.setMaxWidth(300);
	bottom.setPadding(new Insets(20,50,150,280));
	
	AllFields = new VBox(50);
	AllFields.setAlignment(Pos.CENTER);
	AllFields.setMaxWidth(300);
	AllFields.setPadding(new Insets(100,20,20,20));

	
	btnOwnDMO = new AppButton("Eigenes DMO");
	btnForeignDMO = new AppButton("Fremdes DMO");
	back = new BackButton(getFXController(), "Zur�ck");
	
	home = new HomeButton(getFXController());
	
	AllFields.getChildren().addAll(btnOwnDMO, btnForeignDMO, back, home);
	bottom.getChildren().addAll(back, home);
	
	bp.setCenter(AllFields);
	bp.setBottom(bottom);
	
	btnOwnDMO.setOnAction(e -> getFXController().showView("savedownloadstackowndmodoorselectionview"));
	btnForeignDMO.setOnAction(e -> getFXController().showView("savedownloadstackforeigndmoview"));
	back.setOnAction(e -> getFXController().showView("serverstackview"));
	
	return bp;
}
 
Example 38
Project: Java-9-Programming-Blueprints   File: SocialMediaItemViewCell.java   Source Code and License 5 votes vote down vote up
private Node buildItemCell(SocialMediaItem item) {
    HBox hbox = new HBox();
    InputStream resource = item.getClass().getResourceAsStream("icon.png");
    if (resource != null) {
        ImageView sourceImage = new ImageView();
        sourceImage.setFitHeight(18);
        sourceImage.setPreserveRatio(true);
        sourceImage.setSmooth(true);
        sourceImage.setCache(true);
        sourceImage.setImage(new Image(resource));
        hbox.getChildren().add(sourceImage);
    }

    if (item.getImage() != null) {
        HBox picture = new HBox();
        picture.setPadding(new Insets(0, 10, 0, 0));
        ImageView imageView = new ImageView(item.getImage());
        imageView.setPreserveRatio(true);
        imageView.setFitWidth(150);
        picture.getChildren().add(imageView);
        hbox.getChildren().add(picture);
    }

    Label text = new Label(item.getBody());
    text.setFont(Font.font(null, 20));
    text.setWrapText(true);
    hbox.getChildren().add(text);

    return hbox;
}
 
Example 39
Project: Lernkartei_2017   File: SaveDownloadstackOnServerDialogView.java   Source Code and License 5 votes vote down vote up
@Override
public Parent constructContainer()
{
	bp.setId("loginviewbg");
	
	bottom = new HBox(50);
	bottom.setAlignment(Pos.CENTER);
	bottom.setMaxWidth(300);
	bottom.setPadding(new Insets(20,50,150,280));
	
	AllFields = new VBox(50);
	AllFields.setAlignment(Pos.CENTER);
	AllFields.setMaxWidth(300);
	AllFields.setPadding(new Insets(100,20,20,20));

	
	btnOwnDMO = new AppButton("Eigenes DMO");
	btnForeignDMO = new AppButton("Fremdes DMO");
	back = new BackButton(getFXController(), "Zur�ck");
	
	home = new HomeButton(getFXController());
	
	AllFields.getChildren().addAll(btnOwnDMO, btnForeignDMO, back, home);
	bottom.getChildren().addAll(back, home);
	
	bp.setCenter(AllFields);
	bp.setBottom(bottom);
	
	btnOwnDMO.setOnAction(e -> getFXController().showView("savedownloadstackowndmoview"));
	btnForeignDMO.setOnAction(e -> getFXController().showView("savedownloadstackforeigndmoview"));
	back.setOnAction(e -> getFXController().showView("doorsavepathselectionview"));
	
	return bp;
}
 
Example 40
Project: Java-9-Programming-Blueprints   File: ConversationCell.java   Source Code and License 5 votes vote down vote up
protected VBox createConversationSnippet(final Participant participant, String snippet) {
    VBox vbox = new VBox();
    vbox.setPadding(new Insets(0, 0, 0, 5));
    Label sender = new Label(participant.getName());
    sender.setWrapText(true);
    Label phoneNumber = new Label(participant.getPhoneNumber());
    phoneNumber.setWrapText(true);
    Label label = new Label(snippet);
    label.setWrapText(true);
    vbox.getChildren().addAll(sender, phoneNumber, label);
    return vbox;
}