當前位置: 首頁>>代碼示例>>Java>>正文


Java ProgressBar.setProgress方法代碼示例

本文整理匯總了Java中javafx.scene.control.ProgressBar.setProgress方法的典型用法代碼示例。如果您正苦於以下問題:Java ProgressBar.setProgress方法的具體用法?Java ProgressBar.setProgress怎麽用?Java ProgressBar.setProgress使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.control.ProgressBar的用法示例。


在下文中一共展示了ProgressBar.setProgress方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: start

import javafx.scene.control.ProgressBar; //導入方法依賴的package包/類
@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250);
    stage.setScene(scene);
    stage.setTitle("Progress Controls");

    for (int i = 0; i < values.length; i++) {
        final Label label = labels[i] = new Label();
        label.setText("progress:" + values[i]);

        final ProgressBar pb = pbs[i] = new ProgressBar();
        pb.setProgress(values[i]);

        final ProgressIndicator pin = pins[i] = new ProgressIndicator();
        pin.setProgress(values[i]);
        final HBox hb = hbs[i] = new HBox();
        hb.setSpacing(5);
        hb.setAlignment(Pos.CENTER);
        hb.getChildren().addAll(label, pb, pin);
    }

    final VBox vb = new VBox();
    vb.setSpacing(5);
    vb.getChildren().addAll(hbs);
    scene.setRoot(vb);
    stage.show();
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:29,代碼來源:ProgressSample.java

示例2: updateModule

import javafx.scene.control.ProgressBar; //導入方法依賴的package包/類
private void updateModule(Group group, BatteryModule module) {
        //System.out.println(group.getChildren());
        //voltage, percentage, progressbar, name(is ok)
        Label moduleVolt = (Label) group.getChildren().get(0);
        Label modulePercent = (Label) group.getChildren().get(1);
        ProgressBar progress = (ProgressBar) group.getChildren().get(2);
        Label averageTemperature = (Label) group.getChildren().get(4);

        double progressValue = ((module.getVoltage() - 48) / (66.666 - 48));
        int percentage = (int) (progressValue * 100);

        moduleVolt.setText(module.getVoltageAsString());
        modulePercent.setText(percentage + " %");
        progress.setProgress(progressValue);
//        if(module.getId()==1){
//            System.out.println("module 1 average temp: "+module.getAverageTemperatureAsString());
//        }
        averageTemperature.setText(module.getAverageTemperatureAsString());
    }
 
開發者ID:de-sach,項目名稱:BatpackJava,代碼行數:20,代碼來源:batteryMonitorLayoutController.java

示例3: updateCell

import javafx.scene.control.ProgressBar; //導入方法依賴的package包/類
private void updateCell(Group cellDisp, BatteryCell cell) {
        //disp: V, %, progressbar, name
        Label voltage = (Label) cellDisp.getChildren().get(0);
        Label percentage = (Label) cellDisp.getChildren().get(1);
        ProgressBar progressBar = (ProgressBar) cellDisp.getChildren().get(2);
        Label temperature = (Label) cellDisp.getChildren().get(4);

        double progress = (double) cell.getStateOfCharge();
        int percent = (int) (progress);

        voltage.setText(cell.getVoltageAsString());
        percentage.setText(percent + " %");
        progressBar.setProgress(progress / 100);
//        System.out.println("cell id: " + cell.getId());
        temperature.setText(cell.getTemperatureAsString());
    }
 
開發者ID:de-sach,項目名稱:BatpackJava,代碼行數:17,代碼來源:batteryMonitorLayoutController.java

示例4: TalkWithSMTP

import javafx.scene.control.ProgressBar; //導入方法依賴的package包/類
public TalkWithSMTP(Domain domain) {

        this.domain = domain;
        hbox = new HBox();

        midProgress = new ProgressBar();
        midProgress.setProgress(0.0d);

        progresLabel = new Label(domain.getName());

        List<String> inside = new ArrayList<>();
        int count = 0;
        for (String email : domain.getEmails()) {
            if (count == 10) {
                count = 0;
                this.emails.add(new ArrayList<>(inside));
                inside.clear();
            }

            inside.add(email);
            count++;
        }
    }
 
開發者ID:MaximKulikov,項目名稱:Validation-Emails-List,代碼行數:24,代碼來源:TalkWithSMTP.java

示例5: Mp3ImportProgress

import javafx.scene.control.ProgressBar; //導入方法依賴的package包/類
public Mp3ImportProgress() {
    this.getStyleClass().add("import-progress");

    setAlignment(Pos.CENTER);
    setSpacing(35);

    Label lblTitle = new Label("Importing mp3s");
    lblTitle.getStyleClass().add("settings-page-title");

    pbImporting = new ProgressBar();
    pbImporting.setProgress(0.5);
    pbImporting.maxWidthProperty().bind(this.widthProperty().multiply(.8));

    lblPath = new Label();
    lblPath.getStyleClass().add("settings-page-title2");

    btnCancel = new Button("Cancel");
    btnCancel.getStyleClass().add("btn-cancel");

    this.getChildren().addAll(lblTitle, pbImporting, lblPath, btnCancel);
}
 
開發者ID:MolaynoxX,項目名稱:amperfi,代碼行數:22,代碼來源:Mp3ImportProgress.java

示例6: drawNode

import javafx.scene.control.ProgressBar; //導入方法依賴的package包/類
@Override
public Node drawNode() {
    GridPane root = new GridPane();
    root.setVgap(spacing / 2);
    root.setHgap(spacing);
    double d, _d = -0.25;
    for (int i = 0; _d < 1; i++) {
        d = _d + 0.25;
        _d = d;
        ProgressBar bar = progressBarCreate();
        VBox box = new VBox();
        box.setAlignment(Pos.CENTER);
        box.getChildren().add(new Label("[" + d + "]"));
        bar.setProgress(d);
        if (bar.getProgress() != d) {
            reportGetterFailure("progress_indicator.getProgress()");
        }
        box.getChildren().add(bar);
        root.add(box, i % 3, i / 3);
    }
    return root;
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:23,代碼來源:ProgressApp.java

示例7: start

import javafx.scene.control.ProgressBar; //導入方法依賴的package包/類
@Override
public void start(Stage primaryStage) throws Exception {

    List<Stage> benchmarkList = new ArrayList<>();

    benchmarkList.add(new VectorBall(false));
    benchmarkList.add(new VectorBall(true));
    benchmarkList.add(new BitmapBall(false));
    benchmarkList.add(new BitmapBall(true));
    benchmarkList.add(new ListViewBenchmark(false));
    benchmarkList.add(new ListViewBenchmark(true));
    benchmarkList.add(new AreaChartBenchmark(false));
    benchmarkList.add(new AreaChartBenchmark(true));

    ProgressBar bar = getProgressBar(primaryStage);
    for (int i = 0; i < benchmarkList.size(); i++) {
        if (benchmarkList.size() != 0) {
            bar.setProgress((double) i / (double) benchmarkList.size());
        }
        benchmarkList.get(i).showAndWait();
        Thread.sleep(2000);
    }
    primaryStage.close();
}
 
開發者ID:rvictor89,項目名稱:benchmarkjfx,代碼行數:25,代碼來源:BenchmarkJFX.java

示例8: ProgressDialog

import javafx.scene.control.ProgressBar; //導入方法依賴的package包/類
/**
 * ProgressDialog constructor.
 *
 * @throws IOException An exception occurred while getting the theme
 */
public ProgressDialog() throws IOException {
    dialogStage = new Stage();
    dialogStage.initStyle(StageStyle.UTILITY);
    dialogStage.initModality(Modality.APPLICATION_MODAL);
    dialogStage.setTitle("Update");

    mBar = new ProgressBar();
    mBar.setPrefWidth(WIDTH);
    mBar.setProgress(-1);
    mMessage = new Label("");

    final VBox hb = new VBox();
    hb.setPadding(new Insets(5, 5, 5, 5));
    hb.setSpacing(5);
    hb.setAlignment(Pos.CENTER_LEFT);
    hb.getChildren().addAll(mMessage, mBar);

    Scene scene = new Scene(hb);
    scene.getStylesheets().add(ProgressDialog.class.getResource(
            Theme.getProgressCss(Theme.getTheme())).toExternalForm());
    dialogStage.setScene(scene);
}
 
開發者ID:Alkisum,項目名稱:YTSubscriber,代碼行數:28,代碼來源:ProgressDialog.java

示例9: start

import javafx.scene.control.ProgressBar; //導入方法依賴的package包/類
@Override
public void start(Stage stage) throws Exception {
	this.stage = stage;
	configureScene();
	configureStage();
	
	VBox vb = VBoxBuilder.create().spacing(15).padding(new Insets(15)).build();
	root.getChildren().add(vb);
	
	ProgressBar defaultProgressBar = new ProgressBar();
	
	ProgressBar progress1 = getProgress();
	progress1.setProgress(.2F);
	
	ProgressBar progress2 = getProgress();
	progress2.setProgress(.6F);
	
	ProgressBar progress3 = getProgress();
	progress3.setProgress(.9F);
	
	vb.getChildren().addAll(defaultProgressBar, progress1, progress2, progress3);
	
	Label lbl = new Label();
	lbl.setWrapText(true);
	
}
 
開發者ID:SaiPradeepDandem,項目名稱:javafx-demos,代碼行數:27,代碼來源:ProgressBarDemo.java

示例10: ProgressBarSample

import javafx.scene.control.ProgressBar; //導入方法依賴的package包/類
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);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:41,代碼來源:ProgressBarSample.java

示例11: createContentProgressListener

import javafx.scene.control.ProgressBar; //導入方法依賴的package包/類
private InvalidationListener createContentProgressListener(MediaPlayer aMediaPlayer, ProgressBar aContentProgress) {
	return (listener -> {
       	double seek = 0;
       	double duration = aMediaPlayer.getTotalDuration().toMillis();
       	if (duration > 0) {
       		seek = aMediaPlayer.currentTimeProperty().getValue().toMillis() / duration;
       	}
       	aContentProgress.setProgress(seek);
       });
}
 
開發者ID:mikelaud,項目名稱:fx-media-catalog,代碼行數:11,代碼來源:FxMediaCatalog.java

示例12: unbindContentProgress

import javafx.scene.control.ProgressBar; //導入方法依賴的package包/類
private void unbindContentProgress(MediaView aMediaView, ProgressBar aContentProgress) {
	unbindContentProgressClick(aContentProgress);
	aContentProgress.setProgress(0);
	if (null == aMediaView || null == mContentProgressListener) return;
	final MediaPlayer mediaPlayer = aMediaView.getMediaPlayer();
	if (null == mediaPlayer) return;
	mediaPlayer.currentTimeProperty().removeListener(mContentProgressListener);
	mContentProgressListener = null;
}
 
開發者ID:mikelaud,項目名稱:fx-media-catalog,代碼行數:10,代碼來源:FxMediaCatalog.java

示例13: ProgressSlider

import javafx.scene.control.ProgressBar; //導入方法依賴的package包/類
public ProgressSlider(int minWidth, int minHeight, int maxWidth, int maxHeight) {
	progressBar = new ProgressBar();
	progressBar.setProgress(0D);
	slider = new Slider();
	slider.setValue(1);
	slider.setValue(0);
	
	if(minWidth != -1) this.setMinWidth(minWidth);
	if(maxWidth != -1) this.setMaxWidth(maxWidth);
	if(minHeight != -1) this.setMinHeight(minHeight);
	if(maxHeight != -1) this.setMaxHeight(maxHeight);
	
	progressBar.prefWidthProperty().bind(this.widthProperty());
	slider.prefWidthProperty().bind(this.widthProperty());
	slider.prefHeightProperty().bind(this.heightProperty());
	
	this.heightProperty().addListener((observeable, oldValue, newValue) -> {
		progressBar.prefHeightProperty().set(newValue.doubleValue() / 6);
	});
	
	slider.valueProperty().addListener((observeable, oldValue, newValue) -> {
		double progress = newValue.doubleValue() / slider.getMax();
		progressBar.setProgress(progress);
	});
	
	this.getChildren().add(progressBar);
	this.getChildren().add(slider);
	
	progressBar.getStyleClass().add("slider_Progress");
	slider.getStyleClass().add("slider_Slider");
}
 
開發者ID:domkog,項目名稱:OcrePlayer,代碼行數:32,代碼來源:ProgressSlider.java

示例14: JobProgressImpl

import javafx.scene.control.ProgressBar; //導入方法依賴的package包/類
/**
 * Constructs a new {@link JobProgressImpl}.
 * @param dynamicProperties the {@link DynamicCssOnlyProperties} for changing the {@link javafx.scene.paint.Color}
 * of the {@link ProgressBar}.
 * @param job the associated {@link JenkinsJob}.
 * @param theme the {@link BuildWallTheme} associated to control the {@link Color}s.
 */
JobProgressImpl( DynamicCssOnlyProperties dynamicProperties, JenkinsJob job, BuildWallTheme theme ) {
   this.job = job;
   this.dynamicProperties = dynamicProperties;
   this.theme = theme;
   this.registrations = new RegistrationManager();
   
   progress = new ProgressBar();
   setCenter( progress );
   
   progress.prefWidthProperty().bind( widthProperty() );
   progress.prefHeightProperty().bind( heightProperty() );
   
   progress.setProgress( calculateProgress( job ) );
   registrations.apply( new ChangeListenerRegistrationImpl<>( 
            job.currentBuildTimeProperty(), ( source, old, updated ) -> updateProgress( job ) 
   ) );
   registrations.apply( new ChangeListenerRegistrationImpl<>( 
            job.expectedBuildTimeProperty(), ( source, old, updated ) -> updateProgress( job ) 
   ) );
   registrations.apply( new ChangeListenerRegistrationImpl<>( 
            job.buildProperty(), ( source, old, updated ) -> updateStyle( job ) 
   ) );
   
   FunctionMapChangeListenerImpl< BuildResultStatus, Color > coloursListener = new FunctionMapChangeListenerImpl<>(
            theme.barColoursMap(), 
            ( k, v ) -> updateStyle( job ), 
            ( k, v ) -> updateStyle( job ) 
   );
   registrations.apply( new MapChangeListenerRegistrationImpl<>( 
            theme.barColoursMap(), 
            coloursListener
   ) );
   registrations.apply( new MapChangeListenerRegistrationImpl<>( 
            theme.trackColoursMap(), 
            coloursListener
   ) );
   updateStyle( job );
}
 
開發者ID:DanGrew,項目名稱:JttDesktop,代碼行數:46,代碼來源:JobProgressImpl.java

示例15: start

import javafx.scene.control.ProgressBar; //導入方法依賴的package包/類
@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250);
    stage.setScene(scene);
    stage.setTitle("Progress Controls");

    for (int i = 0; i < values.length; i++) {
        final Label label = labels[i] = new Label();
        label.setText("progress:" + values[i]);

        final ProgressBar pb = pbs[i] = new ProgressBar();
        pb.setProgress(values[i]);

        final ProgressIndicator pin = pins[i] = new ProgressIndicator();
        pin.setProgress(values[i]);
        final HBox hb = hbs[i] = new HBox();
        hb.setSpacing(5);
        hb.setAlignment(Pos.CENTER);
        //hb.getChildren().addAll(label, pb, pin);
        hb.getChildren().addAll(pin);

    }

    final VBox vb = new VBox();
    vb.setSpacing(5);
    vb.getChildren().addAll(hbs);
    scene.setRoot(vb);
    stage.show();
}
 
開發者ID:mars-sim,項目名稱:mars-sim,代碼行數:31,代碼來源:ProgressSample.java


注:本文中的javafx.scene.control.ProgressBar.setProgress方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。