Search in sources :

Example 61 with AnchorPane

use of javafx.scene.layout.AnchorPane in project NumberMagic by MaslEberl.

the class main_screen method showPersonOverview.

/**
 * Shows the person overview inside the root layout.
 */
public void showPersonOverview() {
    try {
        // Load person overview.
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(main_screen.class.getResource("haupt_scene.fxml"));
        AnchorPane personOverview = (AnchorPane) loader.load();
        // Set person overview into the center of root layout.
        rootLayout.setCenter(personOverview);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : IOException(java.io.IOException) FXMLLoader(javafx.fxml.FXMLLoader) AnchorPane(javafx.scene.layout.AnchorPane)

Example 62 with AnchorPane

use of javafx.scene.layout.AnchorPane in project Media-Library by The-Rain-Goddess.

the class ApplicationWindow method start.

@Override
public void start(Stage rootStage) throws Exception {
    AnchorPane componentWindow = new AnchorPane();
    VBox componentLayout = new VBox();
    BorderPane tableDisplay = new BorderPane();
    search = new TextField();
    // set main window size
    componentWindow.setMinHeight(WINDOW_MIN_HEIGHT);
    componentWindow.setMinWidth(WINDOW_MIN_WIDTH);
    // align dataTable
    tableDisplay.setRight(setupMediaDataTable());
    tableDisplay.setLeft(setupMediaFileBrowser());
    tableDisplay.setTop(setupMediaPlayer());
    ;
    VBox.setMargin(tableDisplay, new Insets(10, 10, 10, 10));
    componentLayout.getChildren().addAll(setupMenuBar(), tableDisplay);
    // add componentLayout to Window
    componentWindow.getChildren().addAll(componentLayout);
    // Create the scene and add the parent container to it
    Scene scene = new Scene(componentWindow, WINDOW_MIN_WIDTH, WINDOW_MIN_HEIGHT);
    // Add the Scene to the Stage
    rootStage.setScene(scene);
    rootStage.getIcons().add(new Image(this.getClass().getResourceAsStream("media_library.png")));
    rootStage.show();
}
Also used : BorderPane(javafx.scene.layout.BorderPane) Insets(javafx.geometry.Insets) TextField(javafx.scene.control.TextField) Scene(javafx.scene.Scene) Image(javafx.scene.image.Image) AnchorPane(javafx.scene.layout.AnchorPane) VBox(javafx.scene.layout.VBox)

Example 63 with AnchorPane

use of javafx.scene.layout.AnchorPane in project POL-POM-5 by PhoenicisOrg.

the class SearchBoxSkin method initialise.

/**
 * {@inheritDoc}
 */
@Override
public void initialise() {
    AnchorPane container = new AnchorPane();
    container.getStyleClass().add("searchBox");
    this.searchField = createTextField(container);
    this.clearButton = createClearButton();
    container.getChildren().addAll(searchField, clearButton);
    getChildren().addAll(container);
}
Also used : AnchorPane(javafx.scene.layout.AnchorPane)

Example 64 with AnchorPane

use of javafx.scene.layout.AnchorPane in project TestFX by TestFX.

the class BoundsLocatorImplTest method setupStages.

private void setupStages() {
    primaryWindow = new Stage();
    CountDownLatch setSceneLatch = new CountDownLatch(1);
    InvalidationListener invalidationListener = observable -> setSceneLatch.countDown();
    primaryWindow.sceneProperty().addListener(observable -> {
        setSceneLatch.countDown();
        primaryWindow.sceneProperty().removeListener(invalidationListener);
    });
    nodeInsideOfScene = new Rectangle(INSIDE_SCENE_X, INSIDE_SCENE_Y, INSIDE_SCENE_WIDTH, INSIDE_SCENE_HEIGHT);
    nodePartiallyOutsideOfScene = new Rectangle(partialOutsideSceneX, partialOutsideSceneY, PARTIAL_OUTSIDE_SCENE_WIDTH, PARTIAL_OUTSIDE_SCENE_HEIGHT);
    nodeOutsideOfScene = new Rectangle(sceneWidth + 300, sceneHeight + 300, 100, 100);
    AnchorPane nodeContainer = new AnchorPane(nodeInsideOfScene, nodePartiallyOutsideOfScene, nodeOutsideOfScene);
    primaryScene = new Scene(nodeContainer, sceneWidth, sceneHeight);
    // totally outside the bounds, no longer partially.
    if (System.getProperty("os.name").toLowerCase(Locale.US).startsWith("win") && System.getProperty("testfx.robot", "awt").toLowerCase(Locale.US).equals("awt") && (JavaVersionAdapter.getScreenScaleX() != 1d || JavaVersionAdapter.getScreenScaleY() != 1d)) {
        primaryScene.widthProperty().addListener((observable, oldVal, newVal) -> {
            waitForNewSize = true;
            partialOutsideSceneX = partialOutsideSceneX - (oldVal.doubleValue() - newVal.doubleValue());
            nodeContainer.getChildren().remove(nodePartiallyOutsideOfScene);
            nodePartiallyOutsideOfScene = new Rectangle(partialOutsideSceneX, nodePartiallyOutsideOfScene.getBoundsInLocal().getMinY(), PARTIAL_OUTSIDE_SCENE_WIDTH, nodePartiallyOutsideOfScene.getBoundsInLocal().getHeight());
            nodeContainer.getChildren().add(1, nodePartiallyOutsideOfScene);
            sceneWidth = newVal.doubleValue();
        });
        primaryScene.heightProperty().addListener((observable, oldVal, newVal) -> {
            waitForNewSize = true;
            partialOutsideSceneY = partialOutsideSceneY - (oldVal.doubleValue() - newVal.doubleValue());
            nodeContainer.getChildren().remove(nodePartiallyOutsideOfScene);
            nodePartiallyOutsideOfScene = new Rectangle(nodePartiallyOutsideOfScene.getBoundsInLocal().getMinX(), partialOutsideSceneY, nodePartiallyOutsideOfScene.getBoundsInLocal().getWidth(), PARTIAL_OUTSIDE_SCENE_HEIGHT);
            nodeContainer.getChildren().add(1, nodePartiallyOutsideOfScene);
            sceneHeight = newVal.doubleValue();
        });
    }
    primaryWindow.setX(WINDOW_TRANSLATE_X);
    primaryWindow.setY(WINDOW_TRANSLATE_X);
    primaryWindow.setScene(primaryScene);
    try {
        if (!setSceneLatch.await(10, TimeUnit.SECONDS)) {
            fail("Timeout while waiting for scene to be set on stage.");
        }
    } catch (Exception ex) {
        fail("Unexpected exception: " + ex);
    }
    primaryWindow.show();
}
Also used : Scene(javafx.scene.Scene) BoundingBox(javafx.geometry.BoundingBox) CoreMatchers.equalTo(org.hamcrest.CoreMatchers.equalTo) TimeoutException(java.util.concurrent.TimeoutException) FxToolkit(org.testfx.api.FxToolkit) InvalidationListener(javafx.beans.InvalidationListener) BoundsLocatorException(org.testfx.service.locator.BoundsLocatorException) Insets(javafx.geometry.Insets) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) Locale(java.util.Locale) After(org.junit.After) Assert.fail(org.junit.Assert.fail) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Before(org.junit.Before) JavaVersionAdapter(org.testfx.internal.JavaVersionAdapter) Node(javafx.scene.Node) Rectangle(javafx.scene.shape.Rectangle) Test(org.junit.Test) TimeUnit(java.util.concurrent.TimeUnit) CountDownLatch(java.util.concurrent.CountDownLatch) Region(javafx.scene.layout.Region) Rule(org.junit.Rule) Stage(javafx.stage.Stage) TestFXRule(org.testfx.TestFXRule) AnchorPane(javafx.scene.layout.AnchorPane) Window(javafx.stage.Window) Bounds(javafx.geometry.Bounds) BoundsLocator(org.testfx.service.locator.BoundsLocator) Rectangle(javafx.scene.shape.Rectangle) Stage(javafx.stage.Stage) InvalidationListener(javafx.beans.InvalidationListener) CountDownLatch(java.util.concurrent.CountDownLatch) Scene(javafx.scene.Scene) AnchorPane(javafx.scene.layout.AnchorPane) TimeoutException(java.util.concurrent.TimeoutException) BoundsLocatorException(org.testfx.service.locator.BoundsLocatorException)

Aggregations

AnchorPane (javafx.scene.layout.AnchorPane)64 IOException (java.io.IOException)26 FXMLLoader (javafx.fxml.FXMLLoader)22 Scene (javafx.scene.Scene)22 ChangeListener (javafx.beans.value.ChangeListener)18 Label (javafx.scene.control.Label)16 ImageView (javafx.scene.image.ImageView)16 FXML (javafx.fxml.FXML)15 Insets (javafx.geometry.Insets)15 URL (java.net.URL)13 Pane (javafx.scene.layout.Pane)13 GridPane (javafx.scene.layout.GridPane)12 Inject (javax.inject.Inject)12 JFXButton (com.jfoenix.controls.JFXButton)11 ResourceBundle (java.util.ResourceBundle)11 KeyFrame (javafx.animation.KeyFrame)11 Timeline (javafx.animation.Timeline)11 Initializable (javafx.fxml.Initializable)11 Duration (javafx.util.Duration)11 Button (javafx.scene.control.Button)10