Example usage for javafx.scene.layout AnchorPane setBottomAnchor

List of usage examples for javafx.scene.layout AnchorPane setBottomAnchor

Introduction

In this page you can find the example usage for javafx.scene.layout AnchorPane setBottomAnchor.

Prototype

public static void setBottomAnchor(Node child, Double value) 

Source Link

Document

Sets the bottom anchor for the child when contained by an anchor pane.

Usage

From source file:main.Content.java

public void showTreeView() {
    try {/*from w  ww.j  a  va2 s.c o m*/
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(Main.class.getResource("view/TreePane.fxml"));
        AnchorPane activityPaneOverview = (AnchorPane) loader.load();

        TreeViewController controller = loader.getController();
        ScrollPane scrollPane = new ScrollPane();

        controller.setMainApp(this);
        controller.setTableData(data);
        controller.startTreeView();

        TreeView<String> treeView = controller.getTree();

        scrollPane.setContent(treeView);
        treeView.autosize();

        activityPaneOverview.getStylesheets()
                .add(Main.class.getResource("view/DarkTheme.css").toExternalForm());

        activityPaneOverview.getChildren().add(scrollPane);
        activityPaneOverview.setTopAnchor(scrollPane, 10.0);
        activityPaneOverview.setLeftAnchor(scrollPane, 10.0);
        activityPaneOverview.setRightAnchor(scrollPane, 10.0);
        activityPaneOverview.setBottomAnchor(scrollPane, 10.0);

        scrollPane.setFitToHeight(true);
        scrollPane.setFitToWidth(true);

        rootLayout.setLeft(activityPaneOverview);

        System.out.println("showTreeOveerview u therrit" + index);

    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:de.micromata.mgc.javafx.launcher.gui.AboutDialogController.java

@Override
public void initializeWithModel() {
    MgcApplicationInfo ai = model.getApplicationInfo();

    AnchorPane.setTopAnchor(aboutLogoPanel, 2.0);
    AnchorPane.setRightAnchor(aboutLogoPanel, 2.0);
    AnchorPane.setLeftAnchor(aboutLogoPanel, 2.0);
    AnchorPane.setTopAnchor(aboutLogoPanel, 2.0);
    AnchorPane.setRightAnchor(licensePanel, 2.0);
    AnchorPane.setLeftAnchor(licensePanel, 2.0);
    AnchorPane.setRightAnchor(licenceTextArea, 5.0);
    AnchorPane.setLeftAnchor(licenceTextArea, 2.0);
    //    AnchorPane.setTopAnchor(licensePanel, 100.0);
    //    AnchorPane.setBottomAnchor(configurationTabs, 5.0);
    AnchorPane.setRightAnchor(buttonPanel, 2.0);
    AnchorPane.setLeftAnchor(buttonPanel, 2.0);
    AnchorPane.setBottomAnchor(buttonPanel, 2.0);

    okButton.setOnAction(event -> getStage().close());

    String name = ai.getName() + " " + ai.getVersion();
    Text text1 = new Text(name);
    text1.setFont(Font.font("Verdana", FontWeight.BOLD, 20));
    Text text2 = new Text("\n\n" + ai.getCopyright() + "\n");
    TextFlow apptext = new TextFlow(text1, text2);
    appInfo.getChildren().add(apptext);//from w  w  w. jav a2s  . c o m

    if (ai.getLogoLargePath() != null) {
        logo.setImage(new Image(this.getClass().getResource(ai.getLogoLargePath()).toString()));
    }

    String sdetailText = ai.getDetailInfo();
    if (StringUtils.isNotBlank(ai.getLicense()) == true) {
        sdetailText += "\n\nLicense: " + ai.getLicense();
    }
    TextFlow detailText = new TextFlow();
    detailText.getChildren().add(new Text(sdetailText));

    if (StringUtils.isNotBlank(ai.getHomeUrl()) == true) {
        detailText.getChildren().add(new Text("\n\nHomepage: "));
        Hyperlink hlink = new Hyperlink(ai.getHomeUrl());
        hlink.setOnAction(event -> SystemService.get().openUrlInBrowser(ai.getHomeUrl()));
        detailText.getChildren().add(hlink);
    }
    appDetails.getChildren().add(detailText);
    initLicenseText();
}

From source file:Main.java

@Override
public void start(final Stage stage) throws Exception {
    fonts = Font.getFamilies().toArray(fonts);
    pagination = new Pagination(fonts.length / itemsPerPage(), 0);
    pagination.setPageFactory((Integer pageIndex) -> createPage(pageIndex));

    AnchorPane anchor = new AnchorPane();
    AnchorPane.setTopAnchor(pagination, 10.0);
    AnchorPane.setRightAnchor(pagination, 10.0);
    AnchorPane.setBottomAnchor(pagination, 10.0);
    AnchorPane.setLeftAnchor(pagination, 10.0);
    anchor.getChildren().addAll(pagination);
    Scene scene = new Scene(anchor, 400, 450);
    stage.setScene(scene);/*from w  w  w.  j av  a  2 s.  co m*/
    stage.show();
}

From source file:Main.java

@Override
public void start(final Stage stage) throws Exception {
    pagination = new Pagination(28, 0);
    pagination.setPageFactory((Integer pageIndex) -> {
        if (pageIndex >= textPages.length) {
            return null;
        } else {//from   w ww.j  a v  a 2 s  .c o m
            return createPage(pageIndex);
        }
    });

    AnchorPane anchor = new AnchorPane();
    AnchorPane.setTopAnchor(pagination, 10.0);
    AnchorPane.setRightAnchor(pagination, 10.0);
    AnchorPane.setBottomAnchor(pagination, 10.0);
    AnchorPane.setLeftAnchor(pagination, 10.0);
    anchor.getChildren().addAll(pagination);
    Scene scene = new Scene(anchor, 400, 250);
    stage.setScene(scene);
    stage.setTitle("PaginationSample");
    stage.show();
}

From source file:de.micromata.mgc.javafx.launcher.gui.AbstractConfigDialog.java

@Override
public void initializeWithModel() {
    configModel = model;//from   w w  w. java 2s  . com
    addCss();
    ControllerService cv = ControllerService.get();
    List<TabConfig> tabs = getConfigurationTabs();
    tabs.sort((e1, e2) -> Integer.compare(e1.prio, e2.prio));
    for (TabConfig tabc : tabs) {
        Pair<Pane, ? extends AbstractConfigTabController<?>> wc = cv
                .loadControllerControl(tabc.tabControlerClass, Pane.class, this);
        createTab(tabc.configModel, wc);
    }
    AnchorPane.setTopAnchor(mainPane, 5.0);
    AnchorPane.setRightAnchor(mainPane, 5.0);
    AnchorPane.setLeftAnchor(mainPane, 5.0);
    AnchorPane.setBottomAnchor(mainPane, 50.0);

    AnchorPane.setTopAnchor(configurationTabs, 5.0);
    AnchorPane.setRightAnchor(configurationTabs, 5.0);
    AnchorPane.setLeftAnchor(configurationTabs, 5.0);
    AnchorPane.setBottomAnchor(configurationTabs, 5.0);

    //    AnchorPane.setTopAnchor(buttonHBox, 5.0);
    AnchorPane.setRightAnchor(buttonPane, 5.0);
    AnchorPane.setLeftAnchor(buttonPane, 5.0);
    AnchorPane.setBottomAnchor(buttonPane, 5.0);

}

From source file:io.uploader.drive.auth.webbrowser.SimpleBrowserImpl.java

public SimpleBrowserImpl(Stage stage, String url) throws IOException {

    super();/*from   ww w .ja  v a  2s . co  m*/

    Preconditions.checkNotNull(stage);

    this.stage = stage;
    stage.setTitle("Drive Uploader - Authentication");
    UiUtils.setStageAppSize(stage);
    Scene scene = new Scene(new Group());

    AnchorPane root = new AnchorPane();

    final WebView browser = new WebView();
    webEngine = browser.getEngine();

    /*
    Menu settingsMenu = new Menu ("Settings") ;
    MenuItem proxy = new MenuItem ("Proxy") ;
    settingsMenu.getItems().add(proxy) ;
    MenuBar menuBar = new MenuBar () ;
    menuBar.getMenus().add(settingsMenu) ;
    proxy.setOnAction(new EventHandler<ActionEvent> () {
            
     @Override
     public void handle(ActionEvent event) {
    try {
       ProxySettingDialog dlg = new ProxySettingDialog (stage, Configuration.INSTANCE) ;
       dlg.showDialog();
    } catch (IOException e) {
       logger.error("Error occurred while opening the proxy setting dialog", e);
    }
     }});*/

    FXMLLoader mainMenuLoader = new FXMLLoader(getClass().getResource("/fxml/MainMenu.fxml"));
    VBox mainMenuBar = (VBox) mainMenuLoader.load();
    AnchorPane.setTopAnchor(mainMenuBar, 0.0);
    AnchorPane.setLeftAnchor(mainMenuBar, 0.0);
    AnchorPane.setRightAnchor(mainMenuBar, 0.0);
    MainMenuController mainMenuController = mainMenuLoader.<MainMenuController>getController();
    mainMenuController.setOwner(stage);
    mainMenuController.setConfiguration(Configuration.INSTANCE);
    mainMenuController.hideAccountMenu(true);

    ScrollPane scrollPane = new ScrollPane();
    scrollPane.setContent(browser);
    scrollPane.setFitToWidth(true);
    scrollPane.setFitToHeight(true);

    if (StringUtils.isNotEmpty(url)) {
        goTo(url);
    }

    if (DriveUploader.isMacOsX()) {
        AnchorPane.setTopAnchor(scrollPane, 5.0);
    } else {
        AnchorPane.setTopAnchor(scrollPane, 35.0);
    }
    AnchorPane.setLeftAnchor(scrollPane, 5.0);
    AnchorPane.setRightAnchor(scrollPane, 5.0);
    AnchorPane.setBottomAnchor(scrollPane, 5.0);

    root.getChildren().add(mainMenuBar);
    root.getChildren().addAll(scrollPane);
    scene.setRoot(root);

    stage.setScene(scene);
}

From source file:de.micromata.mgc.javafx.launcher.gui.AbstractConfigDialog.java

private Tab createTab(LocalSettingsConfigModel configModel,
        Pair<Pane, ? extends AbstractConfigTabController<?>> wc) {
    AbstractConfigTabController<?> contrl = wc.getSecond();
    contrl.setConfigDialog(this);

    Pane tabPane = wc.getFirst();/*from w w  w  . j  a  va2s.  com*/

    contrl.setTabPane(tabPane);
    Tab tabB = new Tab();

    AnchorPane tabContentPane = new AnchorPane();
    tabContentPane.setMaxHeight(Integer.MAX_VALUE);
    //    tabContentPane.setPrefHeight(500);
    FeedbackPanel feedback = new FeedbackPanel();

    feedback.setPrefHeight(100);
    feedback.setMinHeight(100);
    FXEvents.get().addEventHandler(this, feedback, FeedbackPanelEvents.CLEAR, event -> {
        feedback.clearMessages();
    });
    contrl.setFeedback(feedback);
    tabContentPane.getChildren().add(tabPane);
    tabContentPane.getChildren().add(feedback);
    AnchorPane.setTopAnchor(tabPane, 2.0);
    AnchorPane.setRightAnchor(tabPane, 0.0);
    AnchorPane.setLeftAnchor(tabPane, 0.0);
    AnchorPane.setBottomAnchor(tabPane, 70.0);
    AnchorPane.setBottomAnchor(feedback, 0.0);

    tabB.setContent(tabContentPane);
    AnchorPane.setTopAnchor(tabContentPane, 0.0);
    AnchorPane.setRightAnchor(tabContentPane, 0.0);
    AnchorPane.setLeftAnchor(tabContentPane, 0.0);
    AnchorPane.setBottomAnchor(tabContentPane, 0.0);

    Node scrollPane = tabPane.getChildren().get(0);
    AnchorPane.setTopAnchor(scrollPane, 0.0);
    AnchorPane.setRightAnchor(scrollPane, 0.0);
    AnchorPane.setLeftAnchor(scrollPane, 0.0);
    AnchorPane.setBottomAnchor(scrollPane, 0.0);

    configurationTabs.getTabs().add(tabB);
    tabController.add(contrl);
    contrl.setTab(tabB);
    ((ModelController) contrl).setModel(configModel);
    contrl.initializeWithModel();
    contrl.addToolTips();
    tabB.setText(contrl.getTabTitle());
    contrl.registerValMessageReceivers();

    return tabB;
}

From source file:de.unibw.inf2.fishification.buttons.ButtonManager.java

/**
 * Initializes source- or person-centric category buttons.
 *//* w w w .  j a v a 2s. com*/
public void initCategoryButtons() {

    // Create Buttons
    List<SyncedToggleButton> buttonList1;
    List<SyncedToggleButton> buttonList2;

    // Create Source- or Person-Centric Button Lists
    if (m_fishWorld.isPersonCentric()) {
        buttonList1 = createPersonCategoryButtons();
        buttonList2 = createPersonCategoryButtons();
    } else {
        buttonList1 = createSourceCategoryButtons();
        buttonList2 = createSourceCategoryButtons();
    }

    // Sync all buttons
    for (int i = 0; i < buttonList1.size(); i++) {
        SyncedToggleButton button1 = buttonList1.get(i);
        SyncedToggleButton button2 = buttonList2.get(i);
        SyncedToggleGroup syncedToggleGroup = new SyncedToggleGroup();
        button1.setSyncedToggleGroup(syncedToggleGroup);
        button2.setSyncedToggleGroup(syncedToggleGroup);
    }

    synchronized (m_syncCategoryButtonAccess) {
        m_categoryButtonsLeft = ButtonPaneFactory.createTilePane(BUTTON_SPACING, buttonList1,
                Orientation.VERTICAL);
        m_categoryButtonsRight = ButtonPaneFactory.createTilePane(BUTTON_SPACING, buttonList2,
                Orientation.VERTICAL);

        // Assign to Layout Pane
        AnchorPane.setTopAnchor(m_categoryButtonsLeft, BORDER_SPACING_TOP);
        AnchorPane.setTopAnchor(m_categoryButtonsRight, BORDER_SPACING_TOP);
        AnchorPane.setLeftAnchor(m_categoryButtonsLeft, BORDER_SPACING);
        AnchorPane.setRightAnchor(m_categoryButtonsRight, BORDER_SPACING);
        AnchorPane.setBottomAnchor(m_categoryButtonsLeft, BORDER_SPACING);
        AnchorPane.setBottomAnchor(m_categoryButtonsRight, BORDER_SPACING);
        m_layoutPane.getChildren().addAll(m_categoryButtonsLeft, m_categoryButtonsRight);
    }
}

From source file:ijfx.ui.canvas.FxCanvasTester.java

@Override
public void start(Stage primaryStage) {

    final SCIFIO scifio = new SCIFIO();
    MenuBar menuBar = new MenuBar();
    InputControl parameterInput = null;//from w w w .  j a va  2 s . c o  m
    try {
        System.setProperty("imagej.legacy.sync", "true");
        //reader.getContext().inject(this);
        ImageJ imagej = new ImageJ();
        context = imagej.getContext();
        CommandInfo command = imagej.command().getCommand(GaussianBlur.class);

        CommandModuleItem input = command.getInput("sigma");
        Class<?> type = input.getType();
        if (type == double.class) {
            type = Double.class;
        }

        context.inject(this);

        GaussianBlur module = new GaussianBlur();

        imagej.ui().showUI();

        //reader = scifio.initializer().initializeReader("./stack.tif");
        commandService.run(OpenFile.class, true, new HashMap<String, Object>());

        menuBar = new MenuBar();
        menuService.createMenus(new FxMenuCreator(), menuBar);
        ObjectMapper mapper = new ObjectMapper();
        SimpleModule simpleModule = new SimpleModule("ModuleSerializer");
        // simpleModule.addSerializer(ModuleItem<?>.class,new ModuleItemSerializer());
        simpleModule.addSerializer(ModuleInfo.class, new ModuleSerializer());
        simpleModule.addSerializer(ModuleItem.class, new ModuleItemSerializer());
        mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
        mapper.enable(SerializationFeature.INDENT_OUTPUT);
        mapper.registerModule(simpleModule);

        mapper.writeValue(new File("modules.json"), moduleService.getModules());

    } catch (Exception ex) {
        ImageJFX.getLogger();
    }

    //imageView.fitImageToScreen();
    Button reset = new Button("Reset");

    reset.setOnAction(event -> update());

    BorderPane pane = new BorderPane();

    Button test = new Button("Test");

    AnchorPane root = new AnchorPane();
    root.getChildren().add(pane);
    root.getStylesheets().add(ArcMenu.class.getResource("arc-default.css").toExternalForm());
    root.getStylesheets().add(ImageJFX.class.getResource(("flatterfx.css")).toExternalForm());
    AnchorPane.setTopAnchor(pane, 0.0);
    AnchorPane.setBottomAnchor(pane, 0.0);
    AnchorPane.setLeftAnchor(pane, 0.0);
    AnchorPane.setRightAnchor(pane, 0.0);
    pane.setTop(menuBar);

    HBox vbox = new HBox();
    vbox.getChildren().addAll(reset, test, parameterInput);
    vbox.setSpacing(10);
    vbox.setPadding(new Insets(10, 10, 10, 10));
    // update();
    pane.setCenter(ImageWindowContainer.getInstance());
    // pane.setPrefSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
    pane.setBottom(vbox);

    Scene scene = new Scene(root, 600, 600);

    test.setOnAction(event -> {

        test();
    });

    primaryStage.setTitle("ImageCanvasTest");
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:de.unibw.inf2.fishification.buttons.ButtonManager.java

/**
 * Initializes utilities buttons./*  w  w w  . j ava 2s  . c om*/
 */
private void initUtilButtons() {

    // Create Buttons and Pane
    createCentricButtons();
    createPauseButton();
    createRefreshButton();
    TilePane utilButtonsPane = createUtilPane();

    // Align and assign to Layout Pane
    AnchorPane.setLeftAnchor(utilButtonsPane, BORDER_SPACING);
    AnchorPane.setRightAnchor(utilButtonsPane, BORDER_SPACING);
    AnchorPane.setBottomAnchor(utilButtonsPane, BORDER_SPACING_BOTTOM);
    utilButtonsPane.setAlignment(Pos.BOTTOM_CENTER);
    m_layoutPane.getChildren().add(utilButtonsPane);

}