Search in sources :

Example 41 with Region

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

the class BoundsQueryUtilsTest method setupRegion.

private static void setupRegion() {
    region = new Region();
    region.setMaxSize(0, 0);
    region.setBackground(new Background(new BackgroundFill(Color.RED, null, null)));
    // nodeBounds(), nodeBoundsInLocal()
    region.setPadding(new Insets(0, 0, 0, PADDING_LEFT));
    region.setBorder(new Border(new BorderStroke(Color.BLUE, BorderStrokeStyle.SOLID, null, // nodeBounds(), nodeBoundsInLocal()
    new BorderWidths(0, 0, 0, BORDER_LEFT))));
    // nodeBoundsInParent()
    StackPane.setMargin(region, new Insets(0, 0, 0, MARGIN_LEFT));
}
Also used : Insets(javafx.geometry.Insets) Background(javafx.scene.layout.Background) BorderWidths(javafx.scene.layout.BorderWidths) BackgroundFill(javafx.scene.layout.BackgroundFill) Region(javafx.scene.layout.Region) BorderStroke(javafx.scene.layout.BorderStroke) Border(javafx.scene.layout.Border)

Example 42 with Region

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

the class DebugUtilsTest method showFiredEventsInErrorMessage.

@Test
public void showFiredEventsInErrorMessage() throws TimeoutException {
    // given:
    Stage stage = FxToolkit.setupStage(stage0 -> stage0.setScene(new Scene(new Region(), 300, 300)));
    interact(stage::show);
    moveTo(stage).moveBy(20, 20);
    // and:
    FiredEvents events = FiredEvents.beginStoringFiredEventsOf(stage);
    moveBy(1, 0);
    events.stopStoringFiredEvents();
    // when:
    AssertionError error = getThrownErrorPostMapper(showFiredEvents(events, INDENT));
    // then:
    assertThat(error.getMessage(), containsString("MouseEvent"));
    assertThat(error.getMessage(), not(containsString("ScrollEvent")));
}
Also used : FiredEvents(org.testfx.service.support.FiredEvents) DebugUtils.showFiredEvents(org.testfx.util.DebugUtils.showFiredEvents) Stage(javafx.stage.Stage) Region(javafx.scene.layout.Region) Scene(javafx.scene.Scene) Test(org.junit.Test)

Example 43 with Region

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

the class StageHideDeadlockBug method setup.

@Before
public void setup() throws Exception {
    FxToolkit.setupStage(stage -> stage.setScene(new Scene(new Region(), 500, 500)));
    FxToolkit.showStage();
}
Also used : Region(javafx.scene.layout.Region) Scene(javafx.scene.Scene) Before(org.junit.Before)

Example 44 with Region

use of javafx.scene.layout.Region in project JFoenix by jfoenixadmin.

the class JFXTextAreaSkinAndroid method layoutChildren.

@Override
protected void layoutChildren(final double x, final double y, final double w, final double h) {
    super.layoutChildren(x, y, w, h);
    final double height = getSkinnable().getHeight();
    linesWrapper.layoutLines(x, y, w, h, height, promptText == null ? 0 : promptText.getLayoutBounds().getHeight() + 3);
    linesWrapper.layoutPrompt(x, y, w, h);
    errorContainer.layoutPane(x, height + linesWrapper.focusedLine.getHeight(), w, h);
    linesWrapper.updateLabelFloatLayout();
    if (invalid) {
        invalid = false;
        // set the default background of text area viewport to white
        Region viewPort = (Region) scrollPane.getChildrenUnmodifiable().get(0);
        viewPort.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
        // reapply css of scroll pane in case set by the user
        viewPort.applyCss();
        errorContainer.invalid(w);
        // focus
        linesWrapper.invalid();
    }
}
Also used : Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) Region(javafx.scene.layout.Region)

Example 45 with Region

use of javafx.scene.layout.Region in project JFoenix by jfoenixadmin.

the class JFXAutoCompletePopup method show.

public void show(Node node) {
    if (!isShowing()) {
        if (node.getScene() == null || node.getScene().getWindow() == null)
            throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window.");
        Window parent = node.getScene().getWindow();
        this.show(parent, parent.getX() + node.localToScene(0, 0).getX() + node.getScene().getX(), parent.getY() + node.localToScene(0, 0).getY() + node.getScene().getY() + ((Region) node).getHeight());
        ((JFXAutoCompletePopupSkin<T>) getSkin()).animate();
    }
}
Also used : Window(javafx.stage.Window) JFXAutoCompletePopupSkin(com.jfoenix.skins.JFXAutoCompletePopupSkin) Region(javafx.scene.layout.Region)

Aggregations

Region (javafx.scene.layout.Region)106 Text (javafx.scene.text.Text)25 VBox (javafx.scene.layout.VBox)22 Label (javafx.scene.control.Label)21 Pane (javafx.scene.layout.Pane)21 Button (javafx.scene.control.Button)18 InnerShadow (javafx.scene.effect.InnerShadow)17 Scene (javafx.scene.Scene)16 Node (javafx.scene.Node)15 Insets (javafx.geometry.Insets)14 HBox (javafx.scene.layout.HBox)14 DropShadow (javafx.scene.effect.DropShadow)13 ArrayList (java.util.ArrayList)12 StackPane (javafx.scene.layout.StackPane)12 Canvas (javafx.scene.canvas.Canvas)11 Color (javafx.scene.paint.Color)11 GridPane (javafx.scene.layout.GridPane)10 Group (javafx.scene.Group)9 Background (javafx.scene.layout.Background)8 BackgroundFill (javafx.scene.layout.BackgroundFill)8