javafx.scene.control.ProgressBar#setPrefWidth ( )源码实例Demo

下面列出了javafx.scene.control.ProgressBar#setPrefWidth ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: marathonv5   文件: ProgressBarSample.java
public ProgressBarSample() {
    super(400,100);

    double y = 15;
    final double SPACING = 15;
    ProgressBar p1 = new ProgressBar();
    p1.setLayoutY(y);

    y += SPACING;
    ProgressBar p2 = new ProgressBar();
    p2.setPrefWidth(150);
    p2.setLayoutY(y);

    y += SPACING;
    ProgressBar p3 = new ProgressBar();
    p3.setPrefWidth(200);
    p3.setLayoutY(y);

    y = 15;
    ProgressBar p4 = new ProgressBar();
    p4.setLayoutX(215);
    p4.setLayoutY(y);
    p4.setProgress(0.25);

    y += SPACING;
    ProgressBar p5 = new ProgressBar();
    p5.setPrefWidth(150);
    p5.setLayoutX(215);
    p5.setLayoutY(y);
    p5.setProgress(0.50);

    y += SPACING;
    ProgressBar p6 = new ProgressBar();
    p6.setPrefWidth(200);
    p6.setLayoutX(215);
    p6.setLayoutY(y);
    p6.setProgress(1);
    
    getChildren().addAll(p1,p2,p3,p4,p5,p6);
}
 
源代码2 项目: marathonv5   文件: ProgressBarSample.java
public ProgressBarSample() {
    super(400,100);

    double y = 15;
    final double SPACING = 15;
    ProgressBar p1 = new ProgressBar();
    p1.setLayoutY(y);

    y += SPACING;
    ProgressBar p2 = new ProgressBar();
    p2.setPrefWidth(150);
    p2.setLayoutY(y);

    y += SPACING;
    ProgressBar p3 = new ProgressBar();
    p3.setPrefWidth(200);
    p3.setLayoutY(y);

    y = 15;
    ProgressBar p4 = new ProgressBar();
    p4.setLayoutX(215);
    p4.setLayoutY(y);
    p4.setProgress(0.25);

    y += SPACING;
    ProgressBar p5 = new ProgressBar();
    p5.setPrefWidth(150);
    p5.setLayoutX(215);
    p5.setLayoutY(y);
    p5.setProgress(0.50);

    y += SPACING;
    ProgressBar p6 = new ProgressBar();
    p6.setPrefWidth(200);
    p6.setLayoutX(215);
    p6.setLayoutY(y);
    p6.setProgress(1);
    
    getChildren().addAll(p1,p2,p3,p4,p5,p6);
}
 
源代码3 项目: VocabHunter   文件: MiniGraphTool.java
public static ProgressBar miniGraph(final StatusModel statusModel) {
    ProgressBar bar = new ProgressBar();

    bar.getStyleClass().add(STYLE_CLASS);
    bar.managedProperty().bind(statusModel.graphShownProperty());
    bar.visibleProperty().bind(statusModel.graphShownProperty());
    bar.progressProperty().bind(statusModel.markedFractionProperty());
    bar.setPrefWidth(WIDTH);

    Tooltip tooltip = new Tooltip();
    bar.setTooltip(tooltip);
    tooltip.textProperty().bind(statusModel.graphTextProperty());

    return bar;
}
 
源代码4 项目: springboot-javafx-support   文件: SplashScreen.java
/**
 * Override this to create your own splash pane parent node.
 *
 * @return A standard image
 */
public Parent getParent() {
	final ImageView imageView = new ImageView(getClass().getResource(getImagePath()).toExternalForm());
	final ProgressBar splashProgressBar = new ProgressBar();
	splashProgressBar.setPrefWidth(imageView.getImage().getWidth());

	final VBox vbox = new VBox();
	vbox.getChildren().addAll(imageView, splashProgressBar);

	return vbox;
}
 
源代码5 项目: HubTurbo   文件: UpdateProgressWindow.java
/**
 * Creates a new download progress bar
 *
 * @param downloadUri uri of download as identifier to the progress bar
 * @param downloadLabel label of progress bar
 * @return the download progress bar created
 */
public LabeledDownloadProgressBar createNewDownloadProgressBar(URI downloadUri, String downloadLabel) {
    ProgressBar progressBar = new ProgressBar(-1.0);
    progressBar.setPrefWidth(400);
    LabeledDownloadProgressBar downloadProgressBar =
            new LabeledDownloadProgressBar(downloadUri, downloadLabel, progressBar);

    downloads.add(downloadProgressBar);

    reloadWindowLayout();

    return downloadProgressBar;
}
 
源代码6 项目: latexdraw   文件: LaTeXDraw.java
private void showSplash(final Stage initStage, final Task<Void> task) {
	final ProgressBar loadProgress = new ProgressBar();
	loadProgress.progressProperty().bind(task.progressProperty());

	final Pane splashLayout = new VBox();
	final Image img = new Image("res/LaTeXDrawSmall.png", 450, 250, true, true); //NON-NLS
	final ImageView splash = new ImageView(img);
	splashLayout.getChildren().addAll(splash, loadProgress);
	splashLayout.setEffect(new DropShadow());
	loadProgress.setPrefWidth(img.getWidth());

	task.setOnSucceeded(ignore -> {
		loadProgress.progressProperty().unbind();
		loadProgress.setProgress(1d);
		final FadeTransition fadeSplash = new FadeTransition(Duration.seconds(0.8), splashLayout);
		fadeSplash.setFromValue(1d);
		fadeSplash.setToValue(0d);
		fadeSplash.setOnFinished(evt -> {
			initStage.hide();
			mainStage.setIconified(false);
			mainStage.toFront();
		});
		fadeSplash.play();
	});

	final Scene splashScene = new Scene(splashLayout);
	initStage.setScene(splashScene);
	initStage.initStyle(StageStyle.UNDECORATED);
	initStage.getIcons().add(new Image("/res/LaTeXDrawIcon.png")); //NON-NLS
	initStage.centerOnScreen();
	initStage.toFront();
	initStage.show();
}
 
源代码7 项目: TerasologyLauncher   文件: TerasologyLauncher.java
@Override
public void init() {
    ImageView splash = new ImageView(BundleUtils.getFxImage("splash"));
    loadProgress = new ProgressBar();
    loadProgress.setPrefWidth(SPLASH_WIDTH);
    progressText = new Label();
    splashLayout = new VBox();
    splashLayout.getChildren().addAll(splash, loadProgress, progressText);
    progressText.setAlignment(Pos.CENTER);
    splashLayout.getStylesheets().add(BundleUtils.getStylesheet("css_splash"));
    splashLayout.setEffect(new DropShadow());
    hostServices = new HostServices();
}
 
源代码8 项目: ns-usbloader   文件: DriversInstall.java
public DriversInstall(ResourceBundle rb){

        if (DriversInstall.isRunning)
            return;

        DriversInstall.isRunning = true;

        DownloadDriversTask downloadTask = new DownloadDriversTask();

        Button cancelButton = new Button(rb.getString("btn_Cancel"));

        HBox hBoxInformation = new HBox();
        hBoxInformation.setAlignment(Pos.TOP_LEFT);
        hBoxInformation.getChildren().add(new Label(rb.getString("windowBodyDownloadDrivers")));

        ProgressBar progressBar = new ProgressBar();
        progressBar.setPrefWidth(Double.MAX_VALUE);
        progressBar.progressProperty().bind(downloadTask.progressProperty());

        Label downloadStatusLabel = new Label();
        downloadStatusLabel.setWrapText(true);
        downloadStatusLabel.textProperty().bind(downloadTask.messageProperty());

        runInstallerStatusLabel = new Label();
        runInstallerStatusLabel.setWrapText(true);

        Pane fillerPane1 = new Pane();
        Pane fillerPane2 = new Pane();

        VBox parentVBox = new VBox();
        parentVBox.setAlignment(Pos.TOP_CENTER);
        parentVBox.setFillWidth(true);
        parentVBox.setSpacing(5.0);
        parentVBox.setPadding(new Insets(5.0));
        parentVBox.setFillWidth(true);
        parentVBox.getChildren().addAll(
                hBoxInformation,
                fillerPane1,
                downloadStatusLabel,
                runInstallerStatusLabel,
                fillerPane2,
                progressBar,
                cancelButton
        ); // TODO:FIX

        VBox.setVgrow(fillerPane1, Priority.ALWAYS);
        VBox.setVgrow(fillerPane2, Priority.ALWAYS);

        Stage stage = new Stage();

        stage.setTitle(rb.getString("windowTitleDownloadDrivers"));
        stage.getIcons().addAll(
                new Image("/res/dwnload_ico32x32.png"),    //TODO: REDRAW
                new Image("/res/dwnload_ico48x48.png"),
                new Image("/res/dwnload_ico64x64.png"),
                new Image("/res/dwnload_ico128x128.png")
        );
        stage.setMinWidth(400);
        stage.setMinHeight(150);

        Scene mainScene = new Scene(parentVBox, 405, 155);

        mainScene.getStylesheets().add(AppPreferences.getInstance().getTheme());

        stage.setOnHidden(windowEvent -> {
            downloadTask.cancel(true );
            DriversInstall.isRunning = false;
        });

        stage.setScene(mainScene);
        stage.show();
        stage.toFront();

        downloadTask.setOnSucceeded(event -> {
            cancelButton.setText(rb.getString("btn_Close"));

            String returnedValue = downloadTask.getValue();

            if (returnedValue == null)
                return;

            if (runInstaller(returnedValue))
                stage.close();
        });

        Thread downloadThread = new Thread(downloadTask);
        downloadThread.start();

        cancelButton.setOnAction(actionEvent -> {
            downloadTask.cancel(true );
            stage.close();
        });
    }
 
源代码9 项目: JFoenix   文件: ProgressBarDemo.java
@Override
public void start(Stage stage) throws Exception {

    final VBox pane = new VBox();
    pane.setSpacing(30);
    pane.setStyle("-fx-background-color:WHITE");

    ProgressBar bar = new ProgressBar();
    bar.setPrefWidth(500);

    ProgressBar cssBar = new ProgressBar();
    cssBar.setPrefWidth(500);
    cssBar.setProgress(-1.0f);

    JFXProgressBar jfxBar = new JFXProgressBar();
    jfxBar.setPrefWidth(500);

    JFXProgressBar jfxBarInf = new JFXProgressBar();
    jfxBarInf.setPrefWidth(500);
    jfxBarInf.setProgress(-1.0f);

    Timeline timeline = new Timeline(
        new KeyFrame(
            Duration.ZERO,
            new KeyValue(bar.progressProperty(), 0),
            new KeyValue(jfxBar.secondaryProgressProperty(), 0),
            new KeyValue(jfxBar.progressProperty(), 0)),
        new KeyFrame(
            Duration.seconds(1),
            new KeyValue(jfxBar.secondaryProgressProperty(), 1)),
        new KeyFrame(
            Duration.seconds(2),
            new KeyValue(bar.progressProperty(), 1),
            new KeyValue(jfxBar.progressProperty(), 1)));

    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.play();

    pane.getChildren().addAll(bar, jfxBar, cssBar, jfxBarInf);

    StackPane main = new StackPane();
    main.getChildren().add(pane);
    main.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY)));
    StackPane.setMargin(pane, new Insets(20, 0, 0, 20));

    final Scene scene = new Scene(main, 600, 200, Color.WHITE);
    scene.getStylesheets().add(ProgressBarDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
    stage.setTitle("JFX ProgressBar Demo ");
    stage.setScene(scene);
    stage.setResizable(false);
    stage.show();

}