Example usage for javafx.geometry Insets Insets

List of usage examples for javafx.geometry Insets Insets

Introduction

In this page you can find the example usage for javafx.geometry Insets Insets.

Prototype

public Insets(@NamedArg("top") double top, @NamedArg("right") double right, @NamedArg("bottom") double bottom,
        @NamedArg("left") double left) 

Source Link

Document

Constructs a new Insets instance with four different offsets.

Usage

From source file:account.management.controller.inventory.InsertStockController.java

public void addRow() {

    ComboBox<Product> select_item = new ComboBox();
    select_item.setPromptText("Select Item");
    select_item.setPrefWidth(190);//w ww.  ja v  a2 s .  c  o m
    select_item.setPrefHeight(25);

    new AutoCompleteComboBoxListener<>(select_item);
    select_item.setOnHiding((e) -> {
        Product a = select_item.getSelectionModel().getSelectedItem();
        select_item.setEditable(false);
        select_item.getSelectionModel().select(a);
    });
    select_item.setOnShowing((e) -> {
        select_item.setEditable(true);
    });

    TextField qty = new TextField();
    qty.setPromptText("Quantity");
    qty.setPrefWidth(97);
    qty.setPrefHeight(25);

    TextField rate = new TextField();
    rate.setPrefWidth(100);
    rate.setPrefHeight(25);

    if (this.voucher_type.getSelectionModel().getSelectedItem().equals("Purchase")) {
        rate.setPromptText("Purchase Rate");
    } else {
        rate.setPromptText("Sell Rate");
    }

    Button del = new Button("Delete");

    HBox row = new HBox();
    row.getChildren().addAll(select_item, qty, rate, del);
    row.setSpacing(10);
    row.setPadding(new Insets(0, 0, 0, 15));

    this.conatiner.getChildren().add(row);

    del.setOnAction((e) -> {
        this.conatiner.getChildren().remove(row);
        this.add_row.setDisable(false);
        calculateTotal();
    });

    select_item.getItems().addAll(this.products_list);

    select_item.setOnAction((e) -> {
        qty.setText("0");
        if (this.voucher_type.getSelectionModel().getSelectedItem().equals("Purchase")) {
            rate.setText(String.valueOf(select_item.getSelectionModel().getSelectedItem().getLast_p_rate()));
        } else {
            rate.setText(String.valueOf(select_item.getSelectionModel().getSelectedItem().getLast_s_rate()));
        }
        calculateTotal();
    });

    qty.setOnKeyReleased((e) -> {
        calculateTotal();
    });
    rate.setOnKeyReleased((e) -> {
        calculateTotal();
    });

    if (this.conatiner.getChildren().size() >= 8) {
        this.add_row.setDisable(true);
        return;
    }

}

From source file:Main.java

private HBox addHBox() {

    HBox hbox = new HBox();
    hbox.setPadding(new Insets(15, 12, 15, 12));
    hbox.setSpacing(10); // Gap between nodes
    hbox.setStyle("-fx-background-color: #336699;");

    Button buttonCurrent = new Button("Current");
    buttonCurrent.setPrefSize(100, 20);/* w w w.j  a va 2s .  c  o  m*/

    Button buttonProjected = new Button("Projected");
    buttonProjected.setPrefSize(100, 20);

    hbox.getChildren().addAll(buttonCurrent, buttonProjected);

    return hbox;
}

From source file:com.gmail.frogocomics.schematic.gui.Main.java

@Override
public void start(Stage primaryStage) throws Exception {
    this.primaryStage = primaryStage;
    this.root = new GridPane();
    this.primaryScene = new Scene(this.root, 1000, 600, Color.AZURE);

    Label title = new Label("Schematic Utilities");
    title.setId("schematic-utilities");
    title.setPrefWidth(this.primaryScene.getWidth() + 500);
    this.root.add(title, 0, 0);

    filesSelected.setId("files-selected");
    this.root.add(filesSelected, 0, 1);

    Region spacer1 = new Region();
    spacer1.setPrefWidth(30);/*from   w ww . jav  a2s  .  c  o m*/
    spacer1.setPrefHeight(30);

    Region spacer2 = new Region();
    spacer2.setPrefWidth(30);
    spacer2.setPrefHeight(30);

    Region spacer3 = new Region();
    spacer3.setPrefWidth(30);
    spacer3.setPrefHeight(250);

    Region spacer4 = new Region();
    spacer4.setPrefWidth(1000);
    spacer4.setPrefHeight(10);

    Region spacer5 = new Region();
    spacer5.setPrefWidth(30);
    spacer5.setPrefHeight(30);

    Region spacer6 = new Region();
    spacer6.setPrefWidth(1000);
    spacer6.setPrefHeight(10);

    Region spacer7 = new Region();
    spacer7.setPrefWidth(1000);
    spacer7.setPrefHeight(100);

    Region spacer8 = new Region();
    spacer8.setPrefWidth(30);
    spacer8.setPrefHeight(30);

    this.root.add(spacer4, 0, 3);

    listView.setId("schematic-list");
    listView.setEditable(false);
    listView.setPrefWidth(500);
    listView.setPrefHeight(250);
    this.root.add(new HBox(spacer3, listView), 0, 4);

    uploadFiles.setPadding(new Insets(5, 5, 5, 5));
    uploadFiles.setPrefWidth(120);
    uploadFiles.setPrefHeight(30);
    uploadFiles.setOnAction((event) -> {
        FileChooser fileChooser = new FileChooser();
        fileChooser.setTitle("Select schematic(s)");
        fileChooser.getExtensionFilters().addAll(
                new FileChooser.ExtensionFilter("MCEdit Schematic File", "*.schematic"),
                new FileChooser.ExtensionFilter("Biome World Object Version 2", "*.bo2"));
        List<File> selectedFiles = fileChooser.showOpenMultipleDialog(this.primaryStage);
        if (selectedFiles != null) {
            if (selectedFiles.size() == 1) {
                filesSelected.setText("There is currently 1 file selected");
            } else {
                filesSelected.setText(
                        "There are currently " + String.valueOf(selectedFiles.size()) + " files selected");
            }
            ObservableList<SchematicLocation> selectedSchematicFiles = FXCollections.observableArrayList();
            selectedSchematicFiles.addAll(selectedFiles.stream().map(f -> new SchematicLocation(f, f.getName()))
                    .collect(Collectors.toList()));
            listView.setItems(selectedSchematicFiles);
            this.schematics = selectedSchematicFiles;
        }

    });
    this.root.add(new HBox(spacer1, uploadFiles, spacer2,
            new Label("Only .schematic files are allowed at this point!")), 0, 2);

    editing.setPadding(new Insets(5, 5, 5, 5));
    editing.setPrefWidth(240);
    editing.setPrefHeight(30);
    editing.setDisable(true);
    editing.setOnAction(event -> this.primaryStage.setScene(Editing.getScene()));
    this.root.add(new HBox(spacer8, editing), 0, 8);

    loadSchematics.setPadding(new Insets(5, 5, 5, 5));
    loadSchematics.setPrefWidth(120);
    loadSchematics.setPrefHeight(30);
    loadSchematics.setOnAction(event -> {
        if (this.schematics != null) {
            ((Runnable) () -> {
                for (SchematicLocation location : this.schematics) {
                    if (FilenameUtils.isExtension(location.getLocation().getName(), "schematic")) {
                        try {
                            Schematics.schematics.add(McEditSchematicObject.load(location.getLocation()));
                        } catch (ParseException | ClassicNotSupportedException | IOException e) {
                            e.printStackTrace();
                        }
                    } else if (FilenameUtils.isExtension(location.getLocation().getName(), "bo2")) {
                        try {
                            Schematics.schematics.add(BiomeWorldV2Object.load(location.getLocation()));
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                    }
                }
            }).run();
            loadSchematics.setDisable(true);
            uploadFiles.setDisable(true);
            listView.setDisable(true);
            editing.setDisable(false);
        }
    });
    this.root.add(spacer6, 0, 5);
    this.root.add(new HBox(spacer5, loadSchematics), 0, 6);
    this.root.add(spacer7, 0, 7);

    this.primaryScene.getStylesheets()
            .add("https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800");
    this.primaryScene.getStylesheets().add(new File("style.css").toURI().toURL().toExternalForm());
    this.primaryStage.setScene(this.primaryScene);
    this.primaryStage.setResizable(false);
    this.primaryStage.setTitle("Schematic Utilities - by frogocomics");
    this.primaryStage.show();
}

From source file:poe.trade.assist.SearchPane.java

public SearchPane(List<Search> searchList) {
    data = new SimpleListProperty<>(FXCollections.observableArrayList(searchList));
    website.setOnAction(e -> SwingUtil.openUrlViaBrowser(website.getText()));
    setupSearchTable();//from www .ja va 2  s .co  m
    setupFilterTextField();
    info.setWrapText(true);

    //      setupColumns();
    setupAddFields();
    setupTableClickListener();

    addButton.setOnAction((ActionEvent e) -> {
        data.add(new Search(addName.getText(), addTags.getText(), addURL.getText(), addAuto.isSelected(),
                "price_in_chaos"));
        addName.clear();
        addTags.clear();
        addURL.clear();
        addAuto.setSelected(false);
    });

    remButton.setOnAction((ActionEvent e) -> {
        int index = searchTable.getSelectionModel().getSelectedIndex();
        //         if (index != -1) {
        //            searchTable.getItems().remove(index);
        //         }
        searchTable.remove(index);
    });

    final HBox hb = new HBox(3);
    hb.getChildren().addAll(addAuto, addButton, remButton);

    final VBox vb = new VBox(3, addName, addTags, addURL, hb);

    setSpacing(5);
    setPadding(new Insets(10, 0, 0, 10));
    getChildren().addAll(tagFilterField, nameFilterField, showOnlyNew, searchTable, vb, info);
    VBox.setVgrow(searchTable, Priority.ALWAYS);
    setMaxWidth(Double.MAX_VALUE);
}

From source file:ch.tuason.djbattlescore.lib.components.comps.ResultGridPane.java

/**
 * adds a certain DjEntity to the ranking grid panel...
 * /*from   w w  w  . j  av a2 s  . com*/
 * @param results a Collection of DjEntity...
 */
public void addCurrentDJRanking(Collection<DjEntity> results) {
    this.addedRankingComponents.clear();
    this.currentDjRanking = results;
    if (this.currentDjRanking != null && !this.currentDjRanking.isEmpty()) {
        int iPos = 1;
        for (DjEntity dj : this.currentDjRanking) {

            Image djImage = null;

            if (!StringUtils.isEmpty(dj.getAvatarPicPath32())) {
                djImage = getImageFromCache(dj);

                if (djImage == null) {
                    try {
                        djImage = new Image(getClass().getResourceAsStream(
                                DjBattleConstants.IMAGE_RESOURCE_BASE_FOR_DJ_PICS + dj.getAvatarPicPath32()));
                        if (!djImage.isError()) {
                            imageCache.put(dj.getId(), djImage);
                        }
                    } catch (Exception e) {
                        System.out.println("the image for dj '" + dj.getName()
                                + "' could not be loaded for the avatar image... " + e.getMessage());
                        djImage = null;
                    }
                }

                // it might be an absolute path?
                if (djImage == null) {
                    try {
                        djImage = new Image(
                                DjBattleConstants.ABSOLUTE_IMAGE_FILEPATH_PREFIX + dj.getAvatarPicPath32());
                        if (!djImage.isError()) {
                            imageCache.put(dj.getId(), djImage);
                        }
                    } catch (Exception e) {
                        System.out.println("the image for dj '" + dj.getName()
                                + "' could not be loaded for the avatar image... " + e.getMessage());
                        djImage = null;
                    }
                }

                if (djImage == null) {
                    djImage = getStandardImage();
                }
            }

            if (StringUtils.isEmpty(dj.getAvatarPicPath32()) || djImage == null) {
                djImage = getStandardImage();
            }

            HBox djComponent = new HBox();
            djComponent.setPadding(new Insets(5, 0, 0, 20));

            Label djLabel = new Label(dj.getDjNameWithSoundStyle(), new ImageView(djImage));
            djLabel.setFont(new Font("Arial", 20));
            // component.setTextFill(Color.web(DjBattleConstants.COLOR_RESULT_TITLE_TEXT));
            djComponent.getChildren().add(djLabel);

            this.addedRankingComponents.add(djComponent);
            this.add(djComponent, 0, iPos);
            iPos++;
        }
    }
}

From source file:de.pixida.logtest.designer.automaton.RectangularNode.java

RectangularNode(final Graph graph, final ContentDisplayMode aContentDisplayMode, final int zIndex) {
    super(graph);

    Validate.notNull(aContentDisplayMode);
    this.contentDisplayMode = aContentDisplayMode;

    this.rectangle.setStroke(BORDER_COLOR_DEFAULT);

    final Font titleFont = Font.font(Font.getDefault().getFamily(), FontWeight.BOLD, 10.0);
    this.titleText.setFont(titleFont);

    final Font contentFont = Font.font(titleFont.getFamily(), FontWeight.NORMAL, titleFont.getSize());
    this.contentText.setFont(contentFont);

    this.textFlow.getChildren().addAll(this.titleText, this.separatorText, this.contentText);
    this.textFlow.layoutXProperty().bind(this.rectangle.xProperty());
    this.textFlow.layoutYProperty().bind(this.rectangle.yProperty());
    final double insetTop = 0.0;
    final double insetRight = 3.0;
    final double insetBottom = 3.0;
    final double insetLeft = 3.0;
    this.textFlow.setPadding(new Insets(insetTop, insetRight, insetBottom, insetLeft));
    this.textFlow.setMouseTransparent(true);

    this.contentDisplayMode.init(this.textFlow, this.rectangle);

    if (this.contentDisplayMode.isResizable()) {
        //            this.createResizeSpots();
    }/*from   w w w . j ava  2s  .co  m*/

    this.registerPart(this.rectangle, zIndex);
    this.registerPart(this.textFlow, zIndex);
    this.registerActionHandler(this.rectangle);

    this.loadDimensionsFromJson(new JSONObject());

    this.setColor(Color.WHITE);

    this.setContent(null);
}

From source file:jlotoprint.MainViewController.java

public static void showExceptionAlert(String message, String details) {
    Alert alert = new Alert(Alert.AlertType.ERROR, message, ButtonType.OK);
    alert.initModality(Modality.APPLICATION_MODAL);
    alert.initOwner(JLotoPrint.stage.getScene().getWindow());
    TextArea textArea = new TextArea(details);
    textArea.setEditable(false);//  w  ww .  j a va 2s . c  om
    textArea.setWrapText(true);

    GridPane grid = new GridPane();
    grid.setPadding(new Insets(10, 10, 0, 10));
    grid.add(textArea, 0, 0);

    //set content
    alert.getDialogPane().setExpandableContent(grid);
    alert.showAndWait();
}

From source file:de.perdian.apps.tagtiger.fx.handlers.batchupdate.UpdateFileNamesFromTagsActionEventHandler.java

private Parent createLegendPane() {

    GridPane legendPane = new GridPane();
    legendPane.setPadding(new Insets(5, 5, 5, 5));
    int columnCount = 3;
    int currentRow = 0;
    int currentColumn = 0;
    for (UpdateFileNamesPlaceholder placeholder : UpdateFileNamesPlaceholder.values()) {

        StringBuilder placeholderText = new StringBuilder();
        placeholderText.append("${").append(placeholder.getPlaceholder()).append("}: ");
        placeholderText.append(placeholder.resolveLocalization(this.getLocalization()));

        Label placeholderLabel = new Label(placeholderText.toString());
        placeholderLabel.setMaxWidth(Double.MAX_VALUE);
        placeholderLabel.setPadding(new Insets(3, 3, 3, 3));
        placeholderLabel.setAlignment(Pos.TOP_LEFT);
        legendPane.add(placeholderLabel, currentColumn, currentRow);
        GridPane.setFillWidth(placeholderLabel, Boolean.TRUE);
        GridPane.setHgrow(placeholderLabel, Priority.ALWAYS);

        currentColumn++;//from   ww  w  .j a va 2 s.c o  m
        if (currentColumn >= columnCount) {
            currentRow++;
            currentColumn = 0;
        }

    }

    TitledPane legendTitlePane = new TitledPane(this.getLocalization().legend(), legendPane);
    legendTitlePane.setCollapsible(false);
    return legendTitlePane;

}

From source file:ch.tuason.djbattlescore.lib.components.comps.NowPlayingImageRotator.java

private HBox getImageViewPanel(ImageView view) {
    if (imageViewPanel == null) {
        imageViewPanel = new HBox();
        imageViewPanel.setPadding(new Insets(5, 0, 0, 30));
        imageViewPanel.getChildren().add(view);
    }//  w w  w  . j av  a2 s  .  c om
    return imageViewPanel;
}

From source file:org.jacp.demo.components.ContactChartViewComponent.java

protected BarChart<String, Number> createChart() {

    this.xAxis = new CategoryAxis();
    this.yAxis = new NumberAxis();
    this.yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(this.yAxis, "$", null));
    this.bc = new BarChart<String, Number>(this.xAxis, this.yAxis);
    this.bc.setAnimated(true);
    this.bc.setTitle(" ");

    this.xAxis.getStyleClass().add("jacp-bar");
    this.yAxis.getStyleClass().add("jacp-bar");
    this.xAxis.setLabel("Year");
    this.yAxis.setLabel("Price");

    this.series1 = new XYChart.Series<String, Number>();
    this.series1.setName("electronic");
    this.series2 = new XYChart.Series<String, Number>();
    this.series2.setName("clothes");
    this.series3 = new XYChart.Series<String, Number>();
    this.series3.setName("hardware");
    this.series4 = new XYChart.Series<String, Number>();
    this.series4.setName("books");

    GridPane.setHalignment(this.bc, HPos.CENTER);
    GridPane.setVgrow(this.bc, Priority.ALWAYS);
    GridPane.setHgrow(this.bc, Priority.ALWAYS);
    GridPane.setMargin(this.bc, new Insets(0, 6, 0, 0));
    return this.bc;
}