Example usage for javafx.geometry Pos TOP_LEFT

List of usage examples for javafx.geometry Pos TOP_LEFT

Introduction

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

Prototype

Pos TOP_LEFT

To view the source code for javafx.geometry Pos TOP_LEFT.

Click Source Link

Document

Represents positioning on the top vertically and on the left horizontally.

Usage

From source file:com.thomaskuenneth.openweathermapweather.BasicView.java

public BasicView(String name) {
    super(name);/* w w w  .j a  v a2  s .c om*/
    bundle = ResourceBundle.getBundle("com.thomaskuenneth.openweathermapweather.strings");
    city = new TextField();
    city.setFloatText(bundle.getString("hint"));
    Button show = new Button(bundle.getString("anzeigen"));
    image = new ImageView();
    temperatur = new Text();
    beschreibung = new Text();
    VBox texts = new VBox(temperatur, beschreibung);
    HBox hb1 = new HBox(10, image, texts);
    hb1.setPadding(new Insets(10, 0, 0, 0));
    hb1.setAlignment(Pos.TOP_LEFT);
    show.setOnAction(e -> doIt());
    VBox controls = new VBox(10, city, show, hb1);
    controls.setPadding(new Insets(14, 14, 14, 14));
    controls.setAlignment(Pos.TOP_LEFT);
    setCenter(controls);
}

From source file:org.pdfsam.App.java

@Override
public void start(Stage primaryStage) {
    STOPWATCH.start();/*  w ww . java 2 s  . c om*/
    LOG.info(DefaultI18nContext.getInstance().i18n("Starting pdfsam"));
    List<String> styles = (List<String>) ApplicationContextHolder.getContext().getBean("styles");
    Map<String, Image> logos = ApplicationContextHolder.getContext().getBeansOfType(Image.class);
    MainPane mainPane = ApplicationContextHolder.getContext().getBean(MainPane.class);

    NotificationsContainer notifications = ApplicationContextHolder.getContext()
            .getBean(NotificationsContainer.class);
    StackPane main = new StackPane();
    StackPane.setAlignment(notifications, Pos.BOTTOM_RIGHT);
    StackPane.setAlignment(mainPane, Pos.TOP_LEFT);
    main.getChildren().addAll(mainPane, notifications);

    Scene scene = new Scene(main);
    scene.getStylesheets().addAll(styles);
    primaryStage.setScene(scene);
    primaryStage.getIcons().addAll(logos.values());
    primaryStage.setTitle(ApplicationContextHolder.getContext().getBean("appName", String.class));
    scene.getAccelerators().put(new KeyCodeCombination(KeyCode.L, KeyCombination.SHORTCUT_DOWN),
            () -> eventStudio().broadcast(new ShowStageRequest(), "LogStage"));
    primaryStage.show();
    eventStudio().add(new TitleController(primaryStage));
    requestCheckForUpdateIfNecessary();
    eventStudio().addAnnotatedListeners(this);
    STOPWATCH.stop();
    LOG.info(DefaultI18nContext.getInstance().i18n("Started in {0}",
            DurationFormatUtils.formatDurationWords(STOPWATCH.getTime(), true, true)));
}

From source file:Main.java

@Override
public void start(final Stage stage) {
    final Node loginPanel = makeDraggable(createLoginPanel());
    final Node confirmationPanel = makeDraggable(createConfirmationPanel());
    final Node progressPanel = makeDraggable(createProgressPanel());

    loginPanel.relocate(0, 0);//from   www  . j a  v a 2  s. com
    confirmationPanel.relocate(0, 67);
    progressPanel.relocate(0, 106);

    final Pane panelsPane = new Pane();
    panelsPane.getChildren().addAll(loginPanel, confirmationPanel, progressPanel);

    final BorderPane sceneRoot = new BorderPane();

    BorderPane.setAlignment(panelsPane, Pos.TOP_LEFT);
    sceneRoot.setCenter(panelsPane);

    final CheckBox dragModeCheckbox = new CheckBox("Drag mode");
    BorderPane.setMargin(dragModeCheckbox, new Insets(6));
    sceneRoot.setBottom(dragModeCheckbox);

    dragModeActiveProperty.bind(dragModeCheckbox.selectedProperty());

    final Scene scene = new Scene(sceneRoot, 400, 300);
    stage.setScene(scene);
    stage.setTitle("Draggable Panels Example");
    stage.show();
}

From source file:org.pdfsam.PdfsamApp.java

private void initScene() {
    MainPane mainPane = ApplicationContextHolder.getContext().getBean(MainPane.class);

    NotificationsContainer notifications = ApplicationContextHolder.getContext()
            .getBean(NotificationsContainer.class);
    StackPane main = new StackPane();
    StackPane.setAlignment(notifications, Pos.BOTTOM_RIGHT);
    StackPane.setAlignment(mainPane, Pos.TOP_LEFT);
    main.getChildren().addAll(mainPane, notifications);

    StylesConfig styles = ApplicationContextHolder.getContext().getBean(StylesConfig.class);

    mainScene = new Scene(main);
    mainScene.getStylesheets().addAll(styles.styles());
    mainScene.getAccelerators().put(new KeyCodeCombination(KeyCode.L, KeyCombination.SHORTCUT_DOWN),
            () -> eventStudio().broadcast(new ShowStageRequest(), "LogStage"));
}

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  v a  2s  .c  om
        if (currentColumn >= columnCount) {
            currentRow++;
            currentColumn = 0;
        }

    }

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

}

From source file:org.sleuthkit.autopsy.timeline.ui.detailview.AggregateEventNode.java

public AggregateEventNode(final AggregateEvent event, AggregateEventNode parentEventNode,
        EventDetailChart chart) {//from  w  ww . ja  v a2s .c o m
    this.event = event;
    descLOD.set(event.getLOD());
    this.parentEventNode = parentEventNode;
    this.chart = chart;
    final Region region = new Region();
    HBox.setHgrow(region, Priority.ALWAYS);
    final HBox hBox = new HBox(descrLabel, countLabel, region, minusButton, plusButton);
    hBox.setPrefWidth(USE_COMPUTED_SIZE);
    hBox.setMinWidth(USE_PREF_SIZE);
    hBox.setPadding(new Insets(2, 5, 2, 5));
    hBox.setAlignment(Pos.CENTER_LEFT);

    minusButton.setVisible(false);
    plusButton.setVisible(false);
    minusButton.setManaged(false);
    plusButton.setManaged(false);
    final BorderPane borderPane = new BorderPane(subNodePane, hBox, null, null, null);
    BorderPane.setAlignment(subNodePane, Pos.TOP_LEFT);
    borderPane.setPrefWidth(USE_COMPUTED_SIZE);

    getChildren().addAll(spanRegion, borderPane);

    setAlignment(Pos.TOP_LEFT);
    setMinHeight(24);
    minWidthProperty().bind(spanRegion.widthProperty());
    setPrefHeight(USE_COMPUTED_SIZE);
    setMaxHeight(USE_PREF_SIZE);

    //set up subnode pane sizing contraints
    subNodePane.setPrefHeight(USE_COMPUTED_SIZE);
    subNodePane.setMinHeight(USE_PREF_SIZE);
    subNodePane.setMinWidth(USE_PREF_SIZE);
    subNodePane.setMaxHeight(USE_PREF_SIZE);
    subNodePane.setMaxWidth(USE_PREF_SIZE);
    subNodePane.setPickOnBounds(false);

    //setup description label
    eventTypeImageView.setImage(event.getType().getFXImage());
    descrLabel.setGraphic(eventTypeImageView);
    descrLabel.setPrefWidth(USE_COMPUTED_SIZE);
    descrLabel.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS);

    descrLabel.setMouseTransparent(true);
    setDescriptionVisibility(chart.getDescrVisibility().get());

    //setup backgrounds
    final Color evtColor = event.getType().getColor();
    spanFill = new Background(
            new BackgroundFill(evtColor.deriveColor(0, 1, 1, .1), CORNER_RADII, Insets.EMPTY));
    setBackground(
            new Background(new BackgroundFill(evtColor.deriveColor(0, 1, 1, .1), CORNER_RADII, Insets.EMPTY)));
    setCursor(Cursor.HAND);
    spanRegion.setStyle("-fx-border-width:2 0 2 2; -fx-border-radius: 2; -fx-border-color: "
            + ColorUtilities.getRGBCode(evtColor) + ";"); // NON-NLS
    spanRegion.setBackground(spanFill);

    //set up mouse hover effect and tooltip
    setOnMouseEntered((MouseEvent e) -> {
        //defer tooltip creation till needed, this had a surprisingly large impact on speed of loading the chart
        installTooltip();
        spanRegion.setEffect(new DropShadow(10, evtColor));
        minusButton.setVisible(true);
        plusButton.setVisible(true);
        minusButton.setManaged(true);
        plusButton.setManaged(true);
        toFront();

    });

    setOnMouseExited((MouseEvent e) -> {
        spanRegion.setEffect(null);
        minusButton.setVisible(false);
        plusButton.setVisible(false);
        minusButton.setManaged(false);
        plusButton.setManaged(false);

    });

    setOnMouseClicked(new EventMouseHandler());

    plusButton.disableProperty().bind(descLOD.isEqualTo(DescriptionLOD.FULL));
    minusButton.disableProperty().bind(descLOD.isEqualTo(event.getLOD()));

    plusButton.setOnMouseClicked(e -> {
        final DescriptionLOD next = descLOD.get().next();
        if (next != null) {
            loadSubClusters(next);
            descLOD.set(next);
        }
    });
    minusButton.setOnMouseClicked(e -> {
        final DescriptionLOD previous = descLOD.get().previous();
        if (previous != null) {
            loadSubClusters(previous);
            descLOD.set(previous);
        }
    });
}

From source file:Testing.TestMain.java

public static void grid(Stage stage) {
    GridPane grid = new GridPane();
    grid.setHgap(8);// w  w w  . ja va  2 s  . c o m
    grid.setVgap(8);
    grid.setPadding(new Insets(5));

    Text mp3FileNameT, trackNoT, titleT, artistsT, lengthT, albumT, yearT, genreT, commentsT;

    mp3FileNameT = new Text("Filename:");
    trackNoT = new Text("Track Number:");
    titleT = new Text("Title:");
    artistsT = new Text("Artists:");
    lengthT = new Text("Track Length:");
    albumT = new Text("Album:");
    yearT = new Text("Year:");
    genreT = new Text("Genere:");
    commentsT = new Text("Comments/Lyrics: ");

    TextField mp3FileNameTF, trackNoTF, titleTF, artistsTF, lengthTF, albumTF, yearTF, genreTF;
    TextArea commentsTF;

    mp3FileNameTF = new TextField("");
    trackNoTF = new TextField("");
    titleTF = new TextField("");
    artistsTF = new TextField("");
    lengthTF = new TextField("");
    albumTF = new TextField("");
    yearTF = new TextField("");
    genreTF = new TextField("");
    commentsTF = new TextArea("");

    grid.addColumn(0, mp3FileNameT, trackNoT, titleT, artistsT, lengthT, albumT, yearT, genreT, commentsT);
    grid.addColumn(1, mp3FileNameTF, trackNoTF, titleTF, artistsTF, lengthTF, albumTF, yearTF, genreTF,
            commentsTF);
    grid.setAlignment(Pos.TOP_LEFT);
    Scene scene = new Scene(grid, 500, 500);

    stage.setTitle("Grid Test");
    stage.setScene(scene);
    stage.show();
}