Java Code Examples for javafx.scene.layout.AnchorPane#setRightAnchor()

The following examples show how to use javafx.scene.layout.AnchorPane#setRightAnchor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShareFolderController.java    From PeerWasp with MIT License 7 votes vote down vote up
private void initializeStatusBar() {
	statusBar = new StatusBar();
	pane.getChildren().add(statusBar);
	AnchorPane.setBottomAnchor(statusBar, 0.0);
	AnchorPane.setLeftAnchor(statusBar, 0.0);
	AnchorPane.setRightAnchor(statusBar, 0.0);
	busyProperty.addListener(new ChangeListener<Boolean>() {
		@Override
		public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue,
				Boolean newValue) {
			if(newValue != null && newValue.booleanValue()) {
				statusBar.setProgress(-1);
			} else {
				statusBar.setProgress(0);
			}
		}
	});

	// text in status bar
	statusBar.textProperty().bind(statusProperty);
}
 
Example 2
Source File: TitleBar.java    From desktoppanefx with Apache License 2.0 6 votes vote down vote up
private Pane makeTitlePane(String title) {
    HBox hbLeft = new HBox();
    hbLeft.setSpacing(10d);
    lblTitle = new Label();
    lblTitle.textProperty().bind(titleProperty());
    setTitle(title);
    lblTitle.getStyleClass().add("internal-window-titlebar-title");

    if (icon != null) { hbLeft.getChildren().add(icon); }
    hbLeft.getChildren().add(lblTitle);
    hbLeft.setAlignment(Pos.CENTER_LEFT);
    AnchorPane.setLeftAnchor(hbLeft, 10d);
    AnchorPane.setBottomAnchor(hbLeft, 0d);
    AnchorPane.setRightAnchor(hbLeft, 20d);
    AnchorPane.setTopAnchor(hbLeft, 0d);
    return hbLeft;
}
 
Example 3
Source File: DashboardController.java    From OEE-Designer with MIT License 6 votes vote down vote up
private void onSelectStartupAndYieldPareto() throws Exception {
	List<ParetoItem> items = EquipmentLossManager.getParetoData(equipmentLoss, TimeLoss.STARTUP_YIELD);

	Number divisor = equipmentLoss.getLoss(TimeLoss.STARTUP_YIELD).getSeconds();

	StackPane spYieldPareto = new StackPane();

	AnchorPane.setBottomAnchor(spYieldPareto, 0.0);
	AnchorPane.setLeftAnchor(spYieldPareto, 0.0);
	AnchorPane.setRightAnchor(spYieldPareto, 0.0);
	AnchorPane.setTopAnchor(spYieldPareto, 0.0);

	apYieldPareto.getChildren().clear();
	apYieldPareto.getChildren().add(0, spYieldPareto);

	ParetoChartController controller = new ParetoChartController();
	controller.createParetoChart(DesignerLocalizer.instance().getLangString("startup.pareto"), spYieldPareto, items,
			divisor, DesignerLocalizer.instance().getLangString("time.by.reason"));
}
 
Example 4
Source File: DashboardController.java    From OEE-Designer with MIT License 6 votes vote down vote up
private void onSelectSetupPareto() throws Exception {
	List<ParetoItem> items = EquipmentLossManager.getParetoData(equipmentLoss, TimeLoss.SETUP);

	Number divisor = equipmentLoss.getLoss(TimeLoss.SETUP).getSeconds();

	StackPane spSetupPareto = new StackPane();

	AnchorPane.setBottomAnchor(spSetupPareto, 0.0);
	AnchorPane.setLeftAnchor(spSetupPareto, 0.0);
	AnchorPane.setRightAnchor(spSetupPareto, 0.0);
	AnchorPane.setTopAnchor(spSetupPareto, 0.0);

	apSetupPareto.getChildren().clear();
	apSetupPareto.getChildren().add(0, spSetupPareto);

	ParetoChartController controller = new ParetoChartController();
	controller.createParetoChart(DesignerLocalizer.instance().getLangString("setup.pareto"), spSetupPareto, items,
			divisor, DesignerLocalizer.instance().getLangString("time.by.reason"));
}
 
Example 5
Source File: AnchorPaneSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public static Node createIconContent() {
    StackPane sp = new StackPane();
    AnchorPane anchorPane = new AnchorPane();

    Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    anchorPane.setPrefSize(rectangle.getWidth(), rectangle.getHeight());

    Rectangle r1 = new Rectangle(14, 14, Color.web("#1c89f4"));
    Rectangle r2 = new Rectangle(45, 10, Color.web("#349b00"));
    Rectangle r3 = new Rectangle(35, 14, Color.web("#349b00"));

    anchorPane.getChildren().addAll(r1, r2, r3);
    AnchorPane.setTopAnchor(r1, Double.valueOf(1));
    AnchorPane.setLeftAnchor(r1, Double.valueOf(1));
    AnchorPane.setTopAnchor(r2, Double.valueOf(20));
    AnchorPane.setLeftAnchor(r2, Double.valueOf(1));
    AnchorPane.setBottomAnchor(r3, Double.valueOf(1));
    AnchorPane.setRightAnchor(r3, Double.valueOf(5));

    sp.getChildren().addAll(rectangle, anchorPane);
    return new Group(sp);
}
 
Example 6
Source File: TimeAxisTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createRightYAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
    Axis axis = new Axis(Orientation.VERTICAL, Position.RIGHT);
    axis.setMinValue(MIN);
    axis.setMaxValue(MAX);
    axis.setPrefWidth(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setRightAnchor(axis, 0d);
    AnchorPane.setTopAnchor(axis, 0d);
    AnchorPane.setBottomAnchor(axis, 25d);

    return axis;
}
 
Example 7
Source File: CreatureLabControlsTab.java    From BowlerStudio with GNU General Public License v3.0 5 votes vote down vote up
public void setOverlayTopRight(JogWidget walkWidget) {
	// TODO Auto-generated method stub
	walkingBox.getChildren().clear();
	walkingBox.getChildren().add(walkWidget);
	AnchorPane.setTopAnchor(walkWidget, 0.0);
	AnchorPane.setLeftAnchor(walkWidget, 0.0);
    	AnchorPane.setRightAnchor(walkWidget, 0.0);
    	AnchorPane.setBottomAnchor(walkWidget, 0.0);
}
 
Example 8
Source File: MonitorController.java    From OEE-Designer with MIT License 5 votes vote down vote up
private void onSelectDashboard() throws Exception {
	if (dashboardController == null) {
		FXMLLoader loader = FXMLLoaderFactory.dashboardLoader();
		SplitPane pane = (SplitPane) loader.getRoot();

		apDashboard.getChildren().add(pane);

		AnchorPane.setTopAnchor(pane, 0.0);
		AnchorPane.setBottomAnchor(pane, 0.0);
		AnchorPane.setLeftAnchor(pane, 0.0);
		AnchorPane.setRightAnchor(pane, 0.0);

		dashboardController = loader.getController();
	}
}
 
Example 9
Source File: InfoTextField.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public void setContent(MaterialDesignIcon icon, String info, String style, double opacity) {
    hideIcons();

    currentIcon = new Label();
    Text textIcon = getRegularIconForLabel(icon, currentIcon);

    setActionHandlers(new Label(info));

    currentIcon.setLayoutY(5);
    textIcon.getStyleClass().addAll("icon", style);
    currentIcon.setOpacity(opacity);
    AnchorPane.setRightAnchor(currentIcon, 7.0);

    getChildren().add(currentIcon);
}
 
Example 10
Source File: GridTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createBottomXAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
    Axis axis = new Axis(Orientation.HORIZONTAL, Position.BOTTOM);
    axis.setMinValue(MIN);
    axis.setMaxValue(MAX);
    axis.setPrefHeight(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setBottomAnchor(axis, 0d);
    AnchorPane.setLeftAnchor(axis, 25d);
    AnchorPane.setRightAnchor(axis, 25d);

    return axis;
}
 
Example 11
Source File: OfferBookChartView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private void createChart() {
    xAxis = new NumberAxis();
    xAxis.setForceZeroInRange(false);
    xAxis.setAutoRanging(false);
    xAxis.setTickLabelGap(6);
    xAxis.setTickMarkVisible(false);
    xAxis.setMinorTickVisible(false);

    NumberAxis yAxis = new NumberAxis();
    yAxis.setForceZeroInRange(false);
    yAxis.setSide(Side.RIGHT);
    yAxis.setAutoRanging(true);
    yAxis.setTickMarkVisible(false);
    yAxis.setMinorTickVisible(false);
    yAxis.setTickLabelGap(5);
    yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis, "", " " + Res.getBaseCurrencyCode()));

    seriesBuy = new XYChart.Series<>();
    seriesSell = new XYChart.Series<>();

    areaChart = new AreaChart<>(xAxis, yAxis);
    areaChart.setLegendVisible(false);
    areaChart.setAnimated(false);
    areaChart.setId("charts");
    areaChart.setMinHeight(270);
    areaChart.setPrefHeight(270);
    areaChart.setCreateSymbols(true);
    areaChart.setPadding(new Insets(0, 10, 0, 10));
    areaChart.getData().addAll(List.of(seriesBuy, seriesSell));

    chartPane = new AnchorPane();
    chartPane.getStyleClass().add("chart-pane");

    AnchorPane.setTopAnchor(areaChart, 15d);
    AnchorPane.setBottomAnchor(areaChart, 10d);
    AnchorPane.setLeftAnchor(areaChart, 10d);
    AnchorPane.setRightAnchor(areaChart, 0d);

    chartPane.getChildren().add(areaChart);
}
 
Example 12
Source File: LogChartTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createBottomXAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
    Axis axis = new Axis(MIN, MAX, Orientation.HORIZONTAL, AxisType.LOGARITHMIC, Position.BOTTOM);
    axis.setPrefHeight(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setBottomAnchor(axis, 0d);
    AnchorPane.setLeftAnchor(axis, 25d);
    AnchorPane.setRightAnchor(axis, 25d);

    return axis;
}
 
Example 13
Source File: LogGridTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createRightYAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
    Axis axis = new Axis(Orientation.VERTICAL, Position.RIGHT);
    axis.setMinValue(MIN);
    axis.setMaxValue(MAX);
    axis.setPrefWidth(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setRightAnchor(axis, 0d);
    AnchorPane.setTopAnchor(axis, 0d);
    AnchorPane.setBottomAnchor(axis, 25d);

    return axis;
}
 
Example 14
Source File: FundsTextField.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public FundsTextField() {
    super();
    textField.textProperty().unbind();
    textField.textProperty().bind(Bindings.concat(textProperty(), " ", fundsStructure));

    Label copyIcon = getIcon(AwesomeIcon.COPY);
    copyIcon.setLayoutY(5);
    copyIcon.getStyleClass().addAll("icon", "highlight");
    Tooltip.install(copyIcon, new Tooltip(Res.get("shared.copyToClipboard")));
    copyIcon.setOnMouseClicked(e -> {
        String text = getText();
        if (text != null && text.length() > 0) {
            String copyText;
            String[] strings = text.split(" ");
            if (strings.length > 1)
                copyText = strings[0]; // exclude the BTC postfix
            else
                copyText = text;

            Utilities.copyToClipboard(copyText);
        }
    });

    AnchorPane.setRightAnchor(copyIcon, 30.0);
    AnchorPane.setRightAnchor(infoIcon, 62.0);
    AnchorPane.setRightAnchor(textField, 55.0);

    getChildren().add(copyIcon);
}
 
Example 15
Source File: BsqAddressTextField.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
public BsqAddressTextField() {
    TextField textField = new BisqTextField();
    textField.setId("address-text-field");
    textField.setEditable(false);
    textField.textProperty().bind(address);
    String tooltipText = Res.get("addressTextField.copyToClipboard");
    textField.setTooltip(new Tooltip(tooltipText));

    textField.setOnMousePressed(event -> wasPrimaryButtonDown = event.isPrimaryButtonDown());
    textField.setOnMouseReleased(event -> {
        if (wasPrimaryButtonDown && address.get() != null && address.get().length() > 0) {
            Utilities.copyToClipboard(address.get());
            Notification walletFundedNotification = new Notification()
                    .notification(Res.get("addressTextField.addressCopiedToClipboard"))
                    .hideCloseButton()
                    .autoClose();

            walletFundedNotification.show();
        }

        wasPrimaryButtonDown = false;
    });

    textField.focusTraversableProperty().set(focusTraversableProperty().get());
    //TODO app wide focus
    //focusedProperty().addListener((ov, oldValue, newValue) -> textField.requestFocus());


    Label copyIcon = new Label();
    copyIcon.setLayoutY(3);
    copyIcon.getStyleClass().addAll("icon", "highlight");
    copyIcon.setTooltip(new Tooltip(Res.get("addressTextField.copyToClipboard")));
    AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
    copyIcon.setOnMouseClicked(e -> GUIUtil.showFeeInfoBeforeExecute(() -> {
        if (address.get() != null && address.get().length() > 0)
            Utilities.copyToClipboard(address.get());
    }));

    AnchorPane.setRightAnchor(copyIcon, 5.0);
    AnchorPane.setRightAnchor(textField, 30.0);
    AnchorPane.setLeftAnchor(textField, 0.0);

    getChildren().addAll(textField, copyIcon);
}
 
Example 16
Source File: ConsoleView.java    From ARMStrong with Mozilla Public License 2.0 4 votes vote down vote up
/**
 * Creates a new instance of a console and redirect the java output to it
 */
public ConsoleView() {
	try {
		mainPane = FXMLLoader.load(getClass().getResource("/resources/ConsoleView.fxml"));
	} catch (IOException e) {
		e.printStackTrace();
	}

	this.dockNode = new DockNode(mainPane, "Console", new ImageView(dockImage));
	this.dockNode.setPrefSize(1000, 1500);
	this.dockNode.setClosable(false);
	dockNode.setMaxHeight(300); //mmm

	this.mainPane.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
	this.dockNode.getStylesheets().add("/resources/style.css");
	ScrollPane scrollPane = (ScrollPane) mainPane.lookup("#scrollPane");

	this.textField = new TextField();
	this.textField.setId("consoleInput");
	this.mainPane.getChildren().add(this.textField);
	AnchorPane.setBottomAnchor(this.textField, (double)0);
	AnchorPane.setLeftAnchor(this.textField, (double)23);
	AnchorPane.setRightAnchor(this.textField, (double)0);


	this.textFlow = new TextFlow();
	this.textFlow.setPadding(new Insets(5));
	this.textFlow.setId("textConsole");

	scrollPane.setContent(this.textFlow);

	output = new OutputStream() {
		private ConcurrentLinkedQueue<Character> consoleBuffer = new ConcurrentLinkedQueue<>();
		@Override
		public void write(int b) throws IOException {
			this.consoleBuffer.add((char)b);
			if (b == '\n') {
				ArrayList<Byte> list = new ArrayList<>();
				while (!this.consoleBuffer.peek().equals('\n')) {
					list.add((byte) (char) this.consoleBuffer.poll());
				}
				list.add((byte) (char) this.consoleBuffer.poll());
				String currentLine = new String(Bytes.toArray(list), "ASCII");
				Platform.runLater(() -> {
					textFlow.getChildren().add(new Text(currentLine));
					scrollPane.setVvalue(scrollPane.getHmax());
					if (textFlow.getChildren().size() > 100) {
						textFlow.getChildren().clear();
					}
				});
			}
		}
	};
}
 
Example 17
Source File: TransfersStage.java    From dm3270 with Apache License 2.0 4 votes vote down vote up
public TransfersStage (Screen screen)
{
  setTitle ("File Transfers");

  setOnCloseRequest (e -> closeWindow ());
  btnHide.setOnAction (e -> closeWindow ());

  tsoCommand = new TSOCommand ();
  screen.getFieldManager ().addScreenChangeListener (tsoCommand);

  datasetTab = new DatasetTab (screen, tsoCommand);
  jobTab = new BatchJobTab (screen, tsoCommand);
  filesTab = new FilesTab (screen, tsoCommand, prefs);
  commandsTab = new CommandsTab (screen, tsoCommand);
  transfersTab = new TransfersTab (screen, tsoCommand);
  tabPane.getTabs ().addAll (datasetTab, jobTab, filesTab, commandsTab, transfersTab);
  tabPane.setTabMinWidth (80);

  screenChangeListeners =
      Arrays.asList (datasetTab, jobTab, filesTab, commandsTab, transfersTab);
  keyboardStatusListeners =
      Arrays.asList (datasetTab, jobTab, filesTab, commandsTab, transfersTab);

  datasetTab.addDatasetSelectionListener (transfersTab);
  filesTab.addFileSelectionListener (transfersTab);
  jobTab.addJobSelectionListener (transfersTab);

  AnchorPane anchorPane = new AnchorPane ();
  AnchorPane.setLeftAnchor (tsoCommand.getBox (), 10.0);
  AnchorPane.setBottomAnchor (tsoCommand.getBox (), 10.0);
  AnchorPane.setTopAnchor (tsoCommand.getBox (), 10.0);
  AnchorPane.setTopAnchor (btnHide, 10.0);
  AnchorPane.setBottomAnchor (btnHide, 10.0);
  AnchorPane.setRightAnchor (btnHide, 10.0);
  anchorPane.getChildren ().addAll (tsoCommand.getBox (), btnHide);

  BorderPane borderPane = new BorderPane ();
  menuBar = filesTab.getMenuBar ();
  borderPane.setTop (menuBar);
  borderPane.setCenter (tabPane);
  borderPane.setBottom (anchorPane);

  menuBar.setUseSystemMenuBar (SYSTEM_MENUBAR);

  Scene scene = new Scene (borderPane, 800, 500);             // width/height
  setScene (scene);

  windowSaver = new WindowSaver (prefs, this, "DatasetStage");
  windowSaver.restoreWindow ();

  tabPane.getSelectionModel ().selectedItemProperty ()
      .addListener ( (obs, oldSelection, newSelection) -> select (newSelection));

  tabPane.getSelectionModel ().select (datasetTab);
}
 
Example 18
Source File: InternalWindow.java    From desktoppanefx with Apache License 2.0 4 votes vote down vote up
private void addListenerToResizeMaximizedWindows() {
    AnchorPane.setBottomAnchor(this, 0d);
    AnchorPane.setTopAnchor(this, 0d);
    AnchorPane.setLeftAnchor(this, 0d);
    AnchorPane.setRightAnchor(this, 0d);
}
 
Example 19
Source File: GuiUtils.java    From kafka-message-tool with MIT License 4 votes vote down vote up
public static void expandNodeToAnchorPaneBorders(Node child, double margins) {
    AnchorPane.setTopAnchor(child, margins);
    AnchorPane.setBottomAnchor(child, margins);
    AnchorPane.setLeftAnchor(child, margins);
    AnchorPane.setRightAnchor(child, margins);
}
 
Example 20
Source File: TimelinePanel.java    From constellation with Apache License 2.0 4 votes vote down vote up
/**
     * Creates organises the TimelinePanel's layers.
     */
    private void doLayout() {
        // Layer that contains the timelinechart component:
        final BorderPane timelinePane = new BorderPane();

        timelinePane.setCenter(timeline);
        // The layer that contains the time extent labels:
        final BorderPane labelsPane = new BorderPane();
        BorderPane.setAlignment(lowerTime, Pos.CENTER);
        BorderPane.setAlignment(upperTime, Pos.CENTER);
        BorderPane.setMargin(lowerTime, new Insets(-32.0, -40.0, 0.0, -60.0));
        BorderPane.setMargin(upperTime, new Insets(-32.0, -60.0, 0.0, -40.0));
        labelsPane.setLeft(lowerTime);
        labelsPane.setRight(upperTime);
        labelsPane.setMouseTransparent(true);

        // Layer that combines the newly constructed time-extents with the timeline layer:
        final StackPane stackPane = new StackPane();
        StackPane.setAlignment(labelsPane, Pos.CENTER);
//        extentLabelPane.maxHeightProperty().bind(stackPane.heightProperty());
        StackPane.setAlignment(timelinePane, Pos.CENTER);
//        timelinePane.prefHeightProperty().bind(stackPane.heightProperty());
        stackPane.setPadding(Insets.EMPTY);
        stackPane.getChildren().addAll(timelinePane, labelsPane);

        // Layout the menu bar and the timeline object:
        final VBox vbox = new VBox();
//        stackPane.prefHeightProperty().bind(vbox.heightProperty());
        VBox.setVgrow(toolbar, Priority.NEVER);
        VBox.setVgrow(stackPane, Priority.ALWAYS);
        vbox.getChildren().addAll(toolbar, stackPane);
        vbox.setAlignment(Pos.TOP_CENTER);
        vbox.setFillWidth(true);

        // Organise the inner pane:
        AnchorPane.setTopAnchor(vbox, 0d);
        AnchorPane.setBottomAnchor(vbox, 0d);
        AnchorPane.setLeftAnchor(vbox, 0d);
        AnchorPane.setRightAnchor(vbox, 0d);
        innerPane.getChildren().add(vbox);
        innerPane.prefHeightProperty().bind(super.heightProperty());
        innerPane.prefWidthProperty().bind(super.widthProperty());

        // Attach the inner pane to the root:
        this.getChildren().add(innerPane);
    }