Example usage for javafx.stage Stage setWidth

List of usage examples for javafx.stage Stage setWidth

Introduction

In this page you can find the example usage for javafx.stage Stage setWidth.

Prototype

public final void setWidth(double value) 

Source Link

Usage

From source file:org.jamocha.gui.JamochaGui.java

private void loadState(final Stage primaryStage) {
    final Preferences userPrefs = Preferences.userNodeForPackage(getClass());
    // get window location from user preferences: use x=100, y=100, width=400, height=400 as
    // default/*from   w w w  .  ja v a  2  s. c o m*/
    primaryStage.setX(userPrefs.getDouble("stage.x", 100));
    primaryStage.setY(userPrefs.getDouble("stage.y", 100));
    primaryStage.setWidth(userPrefs.getDouble("stage.width", 800));
    primaryStage.setHeight(userPrefs.getDouble("stage.height", 600));
}

From source file:slideshow.client.ui.ClientUIController.java

/**
 * Set ImageView to fullscreen//w ww  .ja  v a2 s . c om
 * @param event
 */
@FXML
void fullscreenClicked(ActionEvent event) {
    System.out.println("slideshow.client.ui.ClientUIController.fullscreenClicked");
    Stage stage = new Stage();
    stage.setTitle("Fullscreen");

    ImageView iv = this.photoImageView;
    Pane p = new Pane(iv);

    Scene scene = new Scene(p);

    stage.setScene(scene);

    stage.setWidth(100);
    stage.setHeight(200);
    stage.setFullScreen(true);

    stage.show();

}

From source file:org.openbase.display.DisplayView.java

/**
 * {@inheritDoc}/* ww w  . ja  v  a2 s .c  om*/
 *
 * @param visible
 * @throws org.openbase.jul.exception.CouldNotPerformException
 */
@Override
public Future<Void> setVisible(final Boolean visible) throws CouldNotPerformException {
    return runTask(() -> {
        if (visible) {
            Screen screen = getScreen();
            Stage stage = getStage();
            stage.setX(screen.getVisualBounds().getMinX());
            stage.setY(screen.getVisualBounds().getMinY());
            stage.setHeight(screen.getVisualBounds().getHeight());
            stage.setWidth(screen.getVisualBounds().getWidth());
            getStage().setFullScreen(false);
            getStage().setAlwaysOnTop(true);
            getStage().setFullScreen(true);
            getStage().show();

        } else {
            getStage().hide();
            getStage().setFullScreen(false);
        }
        return null;
    });
}

From source file:jp.ac.tohoku.ecei.sb.metabolome.lims.gui.MainWindowController.java

@FXML
void onShowCompoundIntensity(MouseEvent event) {
    if (tableCompound.getSelectionModel().isEmpty())
        return;//from w  ww  .ja  v a2s  . c o m
    for (CompoundImpl compound : tableCompound.getSelectionModel().getSelectedItems()) {
        JFreeChart chart = getChartForCompound(compound);

        StackPane stackPane = new StackPane();
        ChartCanvas chartCanvas = new ChartCanvas(chart);
        stackPane.getChildren().add(chartCanvas);
        chartCanvas.widthProperty().bind(stackPane.widthProperty());
        chartCanvas.heightProperty().bind(stackPane.heightProperty());

        Scene scene = new Scene(stackPane);
        Stage stage = new Stage(StageStyle.UTILITY);
        stage.setScene(scene);
        stage.setWidth(800);
        stage.setHeight(600);
        stage.setTitle(compound.toString());
        stage.show();
    }
}

From source file:jp.ac.tohoku.ecei.sb.metabolome.lims.gui.MainWindowController.java

@FXML
void onShowCompoundIntensityTable(MouseEvent event) {
    if (tableCompound.getSelectionModel().isEmpty())
        return;/*from   w w  w  .ja va 2  s .  c o  m*/

    IntensityMatrixImpl intensityMatrix = dataManager.getIntensityMatrix();

    for (CompoundImpl compound : tableCompound.getSelectionModel().getSelectedItems()) {

        TableView<IntensityValue> tableView = new TableView<>(
                FXCollections
                        .observableArrayList(intensityMatrix
                                .getColumnKeys().stream().map(it -> new IntensityValue(it.getPlate(),
                                        it.getSample(), it, intensityMatrix.get(compound, it)))
                                .collect(Collectors.toList())));

        Arrays.asList("Plate", "Sample", "Injection", "Intensity").forEach(it -> {
            TableColumn<IntensityValue, Double> column = new TableColumn<>();
            column.setText(it);
            //noinspection unchecked
            column.setCellValueFactory(new PropertyValueFactory(it));
            tableView.getColumns().add(column);
        });

        Scene scene = new Scene(tableView);
        Stage stage = new Stage(StageStyle.UTILITY);
        stage.setScene(scene);
        stage.setWidth(800);
        stage.setHeight(600);
        stage.setTitle(compound.toString());
        stage.show();
    }

}

From source file:io.bitsquare.app.BitsquareApp.java

private void showFPSWindow() {
    Label label = new Label();
    EventStreams.animationTicks().latestN(100).map(ticks -> {
        int n = ticks.size() - 1;
        return n * 1_000_000_000.0 / (ticks.get(n) - ticks.get(0));
    }).map(d -> String.format("FPS: %.3f", d)).feedTo(label.textProperty());

    Pane root = new StackPane();
    root.getChildren().add(label);/*from w  w  w .  j  a va  2  s.c om*/
    Stage stage = new Stage();
    stage.setScene(new Scene(root));
    stage.setTitle("FPS");
    stage.initModality(Modality.NONE);
    stage.initStyle(StageStyle.UTILITY);
    stage.initOwner(scene.getWindow());
    stage.setX(primaryStage.getX() + primaryStage.getWidth() + 10);
    stage.setY(primaryStage.getY());
    stage.setWidth(200);
    stage.setHeight(100);
    stage.show();
}

From source file:com.antonjohansson.svncommit.SvnCommitApplication.java

private void configure(Stage stage, String application, File path, Configuration configuration) {
    Module applicationModule = new ApplicationModule();
    Module utilityModule = new UtilityModule();
    Module configurationModule = (binder) -> {
        binder.bind(File.class).toInstance(path);
        binder.bind(Configuration.class).toInstance(configuration);
    };//from   w  w  w  .ja  va 2 s.c o m

    Injector injector = Guice.createInjector(applicationModule, utilityModule, configurationModule);
    Worker worker = injector.getInstance(Worker.class);
    Controller controller = injector.getInstance(Key.get(Controller.class, named(application)));
    controller.initialize();
    View view = controller.getView();

    stage.setScene(new Scene(view.getParent()));
    stage.setTitle("svn-commit");
    stage.setWidth(1200);
    stage.setHeight(400);
    stage.getIcons().add(new Image("svn.png"));
    stage.setOnCloseRequest(e -> worker.shutdown());
    stage.show();
}

From source file:org.jfree.fx.demo.FXGraphics2DDemo1.java

@Override
public void start(Stage stage) throws Exception {
    XYDataset dataset = createDataset();
    JFreeChart chart = createChart(dataset);
    ChartCanvas canvas = new ChartCanvas(chart);
    StackPane stackPane = new StackPane();
    stackPane.getChildren().add(canvas);
    // Bind canvas size to stack pane size. 
    canvas.widthProperty().bind(stackPane.widthProperty());
    canvas.heightProperty().bind(stackPane.heightProperty());
    stage.setScene(new Scene(stackPane));
    stage.setTitle("FXGraphics2DDemo1.java");
    stage.setWidth(700);
    stage.setHeight(390);/*  w  w  w .  j av a 2  s. c  o  m*/
    stage.show();
}

From source file:jp.co.heppokoact.autocapture.FXMLDocumentController.java

/**
 * ???????????//  w w w.  j  a va 2 s.  co m
 * ????????
 * ???ESC????????
 *
 * @return ???????
 * @throws IOException ?????
 */
private Stage createTransparentStage() throws IOException {
    // ??????????
    Stage transparentStage = new Stage(StageStyle.TRANSPARENT);
    transparentStage.initOwner(anchorPane.getScene().getWindow());
    transparentStage.initModality(Modality.APPLICATION_MODAL);
    transparentStage.setResizable(false);
    Rectangle2D rect = Screen.getPrimary().getVisualBounds();
    transparentStage.setWidth(rect.getWidth());
    transparentStage.setHeight(rect.getHeight());

    // ???
    java.awt.Rectangle awtRect = new java.awt.Rectangle((int) rect.getWidth(), (int) rect.getHeight());
    BufferedImage captureImage = robot.createScreenCapture(awtRect);

    // ??????
    ByteArrayInputStream in = ImageUtil.convToInputStream(captureImage);
    BackgroundImage bgImage = new BackgroundImage(new Image(in), BackgroundRepeat.NO_REPEAT,
            BackgroundRepeat.NO_REPEAT, BackgroundPosition.DEFAULT, BackgroundSize.DEFAULT);
    Pane pane = new Pane();
    pane.setBackground(new Background(bgImage));
    pane.setStyle("-fx-border-color: rgba(255, 255, 0, 0.5); -fx-border-style: solid; -fx-border-width: 15;");

    // ???ESC?????
    Scene scene = new Scene(pane);
    transparentStage.setScene(scene);
    scene.setOnKeyPressed(e -> {
        if (e.getCode() == KeyCode.ESCAPE) {
            transparentStage.close();
        }
    });

    return transparentStage;
}

From source file:com.github.drbookings.ui.controller.MainController.java

private void showAddBookingDialog(final LocalDate date, final String roomName) {
    try {//from   ww w .  j a v a 2 s  .  co m
        final FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/AddBookingView.fxml"));
        final Parent root = loader.load();
        final Stage stage = new Stage();
        stage.setWidth(300);
        stage.setHeight(600);
        final Scene scene = new Scene(root);
        stage.setTitle("Add BookingBean");
        stage.setScene(scene);
        final AddBookingController c = loader.getController();
        c.setManager(manager);
        c.datePickerCheckIn.setValue(date);
        c.comboBoxRoom.getSelectionModel().select(roomName);
        final Stage windowStage = (Stage) node.getScene().getWindow();
        stage.initOwner(windowStage);
        stage.initModality(Modality.WINDOW_MODAL);
        stage.setX(windowStage.getX() + windowStage.getWidth() / 2 - stage.getWidth() / 2);
        stage.setY((windowStage.getY() + windowStage.getHeight()) / 2 - stage.getHeight() / 2);
        stage.show();
    } catch (final IOException e) {
        logger.error(e.getLocalizedMessage(), e);
    }
}