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


Java ProgressBar類代碼示例

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


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

示例1: Resource

import javafx.scene.control.ProgressBar; //導入依賴的package包/類
private Resource(Scene start, String name, int startCost, long value, long delay, double mult, final MoneyListener listener){
    System.out.println(name);
    this.prog = (ProgressBar) start.lookup("#" + name + "_progress");
    this.made = (Label) start.lookup("#" + name + "_money");
    this.buy = (Button) start.lookup("#" + name + "_buy");

    this.multiply = mult;
    this.name = name;
    this.print = (name.charAt(0) + "").toUpperCase() + name.substring(1);
    this.value = value;
    this.cost = startCost;
    this.delay = delay;
    this.listener = listener;

    setText(made, print + " Earnings: " + format.format(money));
    setText(buy, "(" + miners + ") Buy Miner: " + format.format((long)cost));

    this.buy.setOnAction(new EventHandler<ActionEvent>() {
        public void handle(ActionEvent event) {
            listener.buyMiner(Resource.this.name);
        }
    });
}
 
開發者ID:Roxas240,項目名稱:CryptoPayAPI,代碼行數:24,代碼來源:CryptoTest.java

示例2: 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

示例3: NotificationBarPane

import javafx.scene.control.ProgressBar; //導入依賴的package包/類
public NotificationBarPane(Node content) {
    super(content);
    progressBar = new ProgressBar();
    label = new Label("infobar!");
    bar = new HBox(label);
    bar.setMinHeight(0.0);
    bar.getStyleClass().add("info-bar");
    bar.setFillHeight(true);
    setBottom(bar);
    // Figure out the height of the bar based on the CSS. Must wait until after we've been added to the parent node.
    sceneProperty().addListener(o -> {
        if (getParent() == null) return;
        getParent().applyCss();
        getParent().layout();
        barHeight = bar.getHeight();
        bar.setPrefHeight(0.0);
    });
    items = FXCollections.observableArrayList();
    items.addListener((ListChangeListener<? super Item>) change -> {
        config();
        showOrHide();
    });
}
 
開發者ID:Techsoul192,項目名稱:legendary-guide,代碼行數:24,代碼來源:NotificationBarPane.java

示例4: init

import javafx.scene.control.ProgressBar; //導入依賴的package包/類
public void init() {
    ImageView splash = new ImageView(new Image(
            SPLASH_IMAGE
    ));
    loadProgress = new ProgressBar();
    loadProgress.setPrefWidth(SPLASH_WIDTH - 20);
    loadProgress.setStyle("-fx-padding: 10; ");
    progressText = new Label("Loading Chess Bot");
    splashLayout = new VBox();
    splashLayout.getChildren().addAll(splash, loadProgress, progressText);
    progressText.setAlignment(Pos.CENTER);
    splashLayout.setStyle(
            "-fx-padding: 10; "
            + "-fx-background-color: white; "
            + "-fx-border-width:3; "
            + "-fx-border-color: "
            + "linear-gradient("
            + "to bottom, "
            + "chocolate, "
            + "derive(chocolate, 50%)"
            + ");"
    );
    splashLayout.setEffect(new DropShadow());
}
 
開發者ID:mhusam,項目名稱:ChessBot,代碼行數:25,代碼來源:ChessBotAppSplash.java

示例5: createPreloaderScene

import javafx.scene.control.ProgressBar; //導入依賴的package包/類
private Scene createPreloaderScene() {
    splash = new ImageView(new Image(SPLASH_IMAGE));
    loadProgress = new ProgressBar();
    loadProgress.setPrefWidth(SPLASH_WIDTH);
    progressText = new Label();
    progressText.setAlignment(Pos.CENTER);
    progressText.setStyle("-fx-font-weight: bold; -fx-fill: rgb(43,43,43);");
    splashLayout = new VBox(10);
    splashLayout.getChildren().addAll(splash, loadProgress, progressText);
    splashLayout.setAlignment(Pos.CENTER);
    splashLayout.setPadding(new Insets(10, 5, 5, 5));
    splash.setEffect(new DropShadow());
    progressText.setEffect(new DropShadow(4, Color.rgb(133, 191, 37)));
    Scene scene = new Scene(splashLayout, SPLASH_WIDTH, SPLASH_HEIGHT, Color.TRANSPARENT);
    scene.getStylesheets().add("css/styles.css");
    return scene;
}
 
開發者ID:Simego,項目名稱:FXImgurUploader,代碼行數:18,代碼來源:SplashPreloader.java

示例6: LoadingStage

import javafx.scene.control.ProgressBar; //導入依賴的package包/類
public LoadingStage(String title, String  noticeText) {
	this.setWidth(WIDTH);
	this.setHeight(HEIGHT);
	
	this.setTitle(title);
	progressBar = new ProgressBar();
	this.notice = new Label(noticeText);
	BorderPane mainPane = new BorderPane();
	Scene s = new Scene(mainPane);
	
	progressBar.setPrefWidth(WIDTH - 25);
	
	mainPane.setTop(notice);
	mainPane.setCenter(progressBar);
	
	mainPane.setPadding(new Insets(15));
	
	this.setScene(s);
}
 
開發者ID:ScreachFr,項目名稱:titanium,代碼行數:20,代碼來源:LoadingStage.java

示例7: start

import javafx.scene.control.ProgressBar; //導入依賴的package包/類
@Override
public void start(final Stage primaryStage) throws IOException, UIInitialisationException {
    stage = primaryStage;
    primaryStage.setTitle(Hygene.TITLE);
    primaryStage.initStyle(StageStyle.UNDECORATED);

    progress = new ProgressBar();

    final URL resource = getClass().getResource(PRELOADER_VIEW);
    final Parent root = FXMLLoader.load(resource);
    if (root == null) {
        throw new UIInitialisationException("Root of Preloader could not be found.");
    }

    final Scene rootScene = new Scene(root);
    primaryStage.setScene(rootScene);
    primaryStage.show();
}
 
開發者ID:ProgrammingLife2017,項目名稱:hygene,代碼行數:19,代碼來源:HygenePreloader.java

示例8: getText

import javafx.scene.control.ProgressBar; //導入依賴的package包/類
@Test public void getText() {
    ProgressBar progressBar = (ProgressBar) getPrimaryStage().getScene().getRoot().lookup(".progress-bar");
    LoggingRecorder lr = new LoggingRecorder();
    List<String> text = new ArrayList<>();
    Platform.runLater(() -> {
        RFXProgressBar rfxProgressBar = new RFXProgressBar(progressBar, null, null, lr);
        progressBar.setProgress(0.56);
        rfxProgressBar.mouseReleased(null);
        text.add(rfxProgressBar.getAttribute("text"));
    });
    new Wait("Waiting for progress bar text.") {
        @Override public boolean until() {
            return text.size() > 0;
        }
    };
    AssertJUnit.assertEquals("0.56", text.get(0));
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:18,代碼來源:RFXProgressBarTest.java

示例9: initialize

import javafx.scene.control.ProgressBar; //導入依賴的package包/類
@Override
public void initialize(URL location, ResourceBundle resources) {
	ui.setProgressBarScene(this);

	for (int i = 0; i < progressBarArray.length; i++) {
		if (ui.getMainScene().getProgressBarStageArray()[i] == null) {
			index = i;
			break;
		}
	}

	number++;

	textArray[index] = text;
	if (RetrofitDownloadData.isDownloading) {
		textArray[index].setText("Downloading");
	}

	progressBarArray[index] = progressBar;
	progressBarArray[index].setProgress(ProgressBar.INDETERMINATE_PROGRESS);
}
 
開發者ID:Team-Sprout,項目名稱:Clipcon-Client,代碼行數:22,代碼來源:ProgressBarScene.java

示例10: 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

示例11: 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

示例12: 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

示例13: LoadingProgressDisplay

import javafx.scene.control.ProgressBar; //導入依賴的package包/類
/**
 * Creates a UI display monitor for provided worker.
 *
 * Assumes the worker is reporting progress as work done on a scale from 0 to 100 (other values indicate indeterminate progress).
 *
 * @param worker the worker whose progress is to be monitored and displayed.
 */
public LoadingProgressDisplay(Worker worker) {
    setMaxWidth(Double.MAX_VALUE);

    ColorAdjust bleach = new ColorAdjust();
    bleach.setSaturation(-0.6);
    setEffect(bleach);

    HBox.setHgrow(this, Priority.ALWAYS);

    visibleProperty().bind(worker.runningProperty());

    // as the webview load progresses update progress.
    worker.workDoneProperty().addListener((observableValue, oldNumber, newNumber) -> {
        if (newNumber == null) newNumber = -1.0;
        final double newValue = newNumber.doubleValue();
        if (newValue < 0.0 || newValue > 100.0) {
            setProgress(ProgressBar.INDETERMINATE_PROGRESS);
        }
        setProgress(newValue / 100.0);
    });
}
 
開發者ID:proofy,項目名稱:willow-browser,代碼行數:29,代碼來源:LoadingProgressDisplay.java

示例14: createUI

import javafx.scene.control.ProgressBar; //導入依賴的package包/類
private void createUI() {
    ProgressBar hpBar = new ProgressBar();
    hpBar.setTranslateX(50);
    hpBar.setTranslateY(50);
    hpBar.setStyle("-fx-accent: rgb(0, 255, 0);");
    hpBar.progressProperty().bind(player.health.divide(10.0f));

    ProgressBar gBar = new ProgressBar();
    gBar.setTranslateX(50);
    gBar.setTranslateY(75);
    gBar.progressProperty().bind(player.power.divide(player.maxPower.multiply(1.0f)));

    Text score = new Text();
    score.setTranslateX(50);
    score.setTranslateY(25);
    score.setFont(Config.FONT);
    score.setFill(Color.GOLD);
    score.textProperty().bind(player.score.asString());

    UI_ROOT.getChildren().setAll(score, hpBar, gBar, createInfo());
}
 
開發者ID:AlmasB,項目名稱:FXGLGames,代碼行數:22,代碼來源:App.java

示例15: start

import javafx.scene.control.ProgressBar; //導入依賴的package包/類
@Override
public void start(Stage primaryStage) throws Exception {
    logger.debug("Starting Preloader");
    preloaderStage = primaryStage;
    VBox loading = new VBox(20);
    loading.setMaxWidth(Region.USE_PREF_SIZE);
    loading.setMaxHeight(Region.USE_PREF_SIZE);
    ProgressBar progressBar = new ProgressBar();
    progressBar.setPrefWidth(240);
    loading.getChildren().add(progressBar);
    infoLabel = new Label("Initializing application...");
    loading.getChildren().add(infoLabel);
    BorderPane root = new BorderPane(loading);
    Scene scene = new Scene(root);
    primaryStage.setWidth(300);
    primaryStage.setHeight(150);
    primaryStage.initStyle(StageStyle.UNDECORATED);
    primaryStage.setScene(scene);
    primaryStage.show();
}
 
開發者ID:m-krajcovic,項目名稱:photometric-data-retriever,代碼行數:21,代碼來源:MainPreloader.java


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