Java Code Examples for javafx.scene.layout.BorderPane#setMinHeight()

The following examples show how to use javafx.scene.layout.BorderPane#setMinHeight() . 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: GraphicsExportDialogFX.java    From mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
public GraphicsExportDialogFX(boolean valueCheckRequired, ParameterSet parameterSet,
    JFreeChart chart) {
  super(valueCheckRequired, parameterSet);

  chartParam = (ChartThemeParameters) parameterSet
      .getParameter(GraphicsExportParameters.chartParameters).getValue();

  colorPalette = parameterSet.getParameter(GraphicsExportParameters.colorPalette).getValue();

  try {
    this.chart = (JFreeChart) chart.clone();
  } catch (CloneNotSupportedException e1) {
    e1.printStackTrace();
    logger.severe("Chart could not be cloned.");
  }

  theme = ChartThemeFactory2.createExportChartTheme("Export theme");
  chartParam.applyToChartTheme(theme);
  pnChartPreview = new BorderPane();

  pnChartPreview.setMinWidth(400);
  pnChartPreview.setMinHeight(300);
  mainPane.setRight(pnChartPreview);
  chartPanel = new EChartViewer(this.chart);
  pnChartPreview.setCenter(chartPanel);

  // add buttons
  btnRenewPreview = new Button("Renew Preview");
  btnRenewPreview.setOnAction(e -> renewPreview());
  pnlButtons.getButtons().add(btnRenewPreview);

  btnApply = new Button("Apply Theme");
  btnApply.setOnAction(e -> applyTheme());
  pnlButtons.getButtons().add(btnApply);

  btnSave = new Button("Save");
  btnSave.setOnAction(e -> saveGraphicsAs());
  pnlButtons.getButtons().add(btnSave);

  setMinWidth(900.0);
  setMinHeight(400.0);

  centerOnScreen();
}
 
Example 2
Source File: PreferencesDialog.java    From Quelea with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Create a new preference dialog.
 *
 * @author Arvid
 */
public PreferencesDialog(Class parent, boolean hasVLC) {
    setTitle(LabelGrabber.INSTANCE.getLabel("options.title"));
    initModality(Modality.APPLICATION_MODAL);
    initOwner(QueleaApp.get().getMainWindow());
    getIcons().add(new Image("file:icons/options.png", 16, 16, false, true));
    mainPane = new BorderPane();

    generalPanel = new OptionsGeneralPanel(bindings);
    displayPanel = new OptionsDisplaySetupPanel(bindings);
    stageViewPanel = new OptionsStageViewPanel(bindings);
    noticePanel = new OptionsNoticePanel(bindings);
    presentationPanel = new OptionsPresentationPanel(bindings);
    biblePanel = new OptionsBiblePanel(bindings);
    optionsServerSettingsPanel = new OptionsServerSettingsPanel(bindings);
    recordingPanel = new OptionsRecordingPanel(bindings, hasVLC);

    preferencesFx =
            PreferencesFx.of(new PreferenceStorageHandler(parent),
                    generalPanel.getGeneralTab(),
                    displayPanel.getDisplaySetupTab(),
                    stageViewPanel.getStageViewTab(),
                    noticePanel.getNoticesTab(),
                    presentationPanel.getPresentationsTab(),
                    biblePanel.getBiblesTab(),
                    optionsServerSettingsPanel.getServerTab(),
                    recordingPanel.getRecordingsTab()
            );

    okButton = new Button(LabelGrabber.INSTANCE.getLabel("ok.button"), new ImageView(new Image("file:icons/tick.png")));
    BorderPane.setMargin(okButton, new Insets(5));
    okButton.setOnAction((ActionEvent t) -> {
        preferencesFx.saveSettings();
        if (displayPanel.isDisplayChange()) {
            updatePos();
        }
        displayPanel.setDisplayChange(false);
        QueleaApp.get().getMainWindow().getMainPanel().getSchedulePanel().getThemeNode().refresh();
        hide();
    });
    BorderPane.setAlignment(okButton, Pos.CENTER);

    mainPane.setBottom(okButton);
    mainPane.setMinWidth(1005);
    mainPane.setMinHeight(600);
    mainPane.setCenter(preferencesFx.getView().getCenter());

    Scene scene = new Scene(mainPane);
    if (QueleaProperties.get().getUseDarkTheme()) {
        scene.getStylesheets().add("org/modena_dark.css");
    }
    setScene(scene);

    getScene().getWindow().addEventFilter(WindowEvent.WINDOW_SHOWN, e -> callBeforeShowing());
    getScene().getWindow().addEventFilter(WindowEvent.WINDOW_CLOSE_REQUEST, e -> callBeforeHiding());

    bindings.forEach(this::bind);
}
 
Example 3
Source File: InternalWindow.java    From desktoppanefx with Apache License 2.0 4 votes vote down vote up
public void detachOrAttachWindow() {
    setDetached(!isDetached());

    if (isDetached()) {
        fireEvent(new InternalWindowEvent(this, InternalWindowEvent.WINDOW_DETACHING));

        Point2D locationOnScreen = this.localToScreen(0, 0);
        detachedWindow.getScene().getStylesheets().setAll(collectStylesheets());

        captureBounds();

        dp = desktopPane.removeInternalWindow(this);

        double width = contentPane.getWidth();
        double height = titleBar.getHeight() + contentPane.getHeight();
        BorderPane bp = new BorderPane();
        bp.setId(getId());
        bp.getStyleClass().addAll(getStyleClass());

        bp.setMinWidth(getMinWidth());
        bp.setMinHeight(getMinHeight());
        bp.setPrefWidth(width);
        bp.setPrefHeight(height);

        bp.setTop(titleBar);
        bp.setCenter(contentPane);
        detachedWindow.getScene().setRoot(bp);

        detachedWindow.addEventHandler(MouseEvent.MOUSE_PRESSED, windowMousePressed);
        detachedWindow.addEventHandler(MouseEvent.MOUSE_MOVED, windowMouseMoved);
        detachedWindow.addEventHandler(MouseEvent.MOUSE_DRAGGED, windowMouseDragged);

        detachedWindow.setX(locationOnScreen.getX());
        detachedWindow.setY(locationOnScreen.getY());

        fireEvent(new InternalWindowEvent(this, InternalWindowEvent.WINDOW_DETACHED));
        detachedWindow.show();

        if (isMaximized()) {
            maximizeDetachedWindow();
        } else {
            bp.setMaxWidth(getMaxWidth());
            bp.setMaxHeight(getMaxHeight());
        }
    } else {
        fireEvent(new InternalWindowEvent(this, InternalWindowEvent.WINDOW_ATTACHING));
        detachedWindow.hide();
        detachedWindow.removeEventHandler(MouseEvent.MOUSE_PRESSED, windowMousePressed);
        detachedWindow.removeEventHandler(MouseEvent.MOUSE_MOVED, windowMouseMoved);
        detachedWindow.removeEventHandler(MouseEvent.MOUSE_DRAGGED, windowMouseDragged);

        setTop(titleBar);
        setCenter(contentPane);

        captureDetachedWindowBounds();

        setPrefSize(previousWidth, previousHeight);

        Bounds boundsInScreen = dp.localToScreen(dp.getBoundsInLocal());
        previousX = Math.max(previousX - boundsInScreen.getMinX(), 0);
        previousY = Math.max(previousY - boundsInScreen.getMinY(), 0);

        double maxX = boundsInScreen.getMaxX() - boundsInScreen.getMinX();
        if (previousX + previousWidth > maxX) {
            previousX = maxX - previousWidth;
        }

        double maxY = boundsInScreen.getMaxY() - boundsInScreen.getMinY();
        if (previousY + previousHeight > maxY) {
            previousY = maxY - previousHeight;
        }

        fireEvent(new InternalWindowEvent(this, InternalWindowEvent.WINDOW_ATTACHED));
        dp.addInternalWindow(this, new Point2D(previousX, previousY));
    }
}