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


Java ProgressBar.setPrefWidth方法代碼示例

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


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

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

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

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

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

示例5: init

import javafx.scene.control.ProgressBar; //導入方法依賴的package包/類
@Override
public void init() {
    ImageView splash = new ImageView(new Image(
            SPLASH_IMAGE,
            SPLASH_WIDTH,
            SPLASH_HEIGHT,
            true,
            true
    ));
    loadProgress = new ProgressBar(0);
    loadProgress.setPrefWidth(SPLASH_WIDTH);
    progressText = new Label("Initializing . . .");
    progressText.setBackground(new Background(new BackgroundFill(Color.GHOSTWHITE,new CornerRadii(5),new Insets(0))));
    splashLayout = new VBox();
    splashLayout.getChildren().addAll(splash, loadProgress, progressText);
    progressText.setAlignment(Pos.CENTER);
    splashLayout.setBackground(Background.EMPTY);
}
 
開發者ID:NonlinearFruit,項目名稱:Retrospector,代碼行數:19,代碼來源:Retrospector.java

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

示例7: getProgress

import javafx.scene.control.ProgressBar; //導入方法依賴的package包/類
public ProgressBar getProgress(){
	final ProgressBar progressBar = new ProgressBar();
	progressBar.setPrefWidth(300);
	progressBar.getStyleClass().addAll("my-progress-bar");
	progressBar.progressProperty().addListener(new ChangeListener<Number>() {
		@Override
		public void changed(ObservableValue<? extends Number> arg0,	Number arg1, Number value) {
			progressBar.getStyleClass().removeAll("red-progress-bar","blue-progress-bar","green-progress-bar");
			if(value.doubleValue()<.3){
				progressBar.getStyleClass().add("green-progress-bar");
			}else if(value.doubleValue()<.7){
				progressBar.getStyleClass().add("blue-progress-bar");
			}else{
				progressBar.getStyleClass().add("red-progress-bar");
			}
		}
	});
	return progressBar;
}
 
開發者ID:SaiPradeepDandem,項目名稱:javafx-demos,代碼行數:20,代碼來源:ProgressBarDemo.java

示例8: runProgressTask

import javafx.scene.control.ProgressBar; //導入方法依賴的package包/類
public void runProgressTask(String labelText, Consumer<DoubleConsumer> task, Runnable onSuccess, Consumer<Throwable> onError) {
	Stage stage = new Stage(StageStyle.UTILITY);
	stage.initOwner(this.scene.getWindow());
	VBox pane = new VBox(GuiConstants.padding);

	stage.setScene(new Scene(pane));
	stage.initModality(Modality.APPLICATION_MODAL);
	stage.setOnCloseRequest(event -> event.consume());
	stage.setResizable(false);
	stage.setTitle("Operation progress");

	pane.setPadding(new Insets(GuiConstants.padding));

	pane.getChildren().add(new Label(labelText));

	ProgressBar progress = new ProgressBar(0);
	progress.setPrefWidth(400);
	pane.getChildren().add(progress);

	stage.show();

	Task<Void> jfxTask = new Task<Void>() {
		@Override
		protected Void call() throws Exception {
			task.accept(cProgress -> Platform.runLater(() -> progress.setProgress(cProgress)));

			return null;
		}
	};

	jfxTask.setOnSucceeded(event -> {
		onSuccess.run();
		stage.hide();
	});

	jfxTask.setOnFailed(event -> {
		onError.accept(jfxTask.getException());
		stage.hide();
	});

	threadPool.execute(jfxTask);
}
 
開發者ID:sfPlayer1,項目名稱:Matcher,代碼行數:43,代碼來源:Gui.java

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

示例10: getParent

import javafx.scene.control.ProgressBar; //導入方法依賴的package包/類
public Parent getParent() {
    ImageView imageView = new ImageView(getClass().getResource(getImagePath()).toExternalForm());
    ProgressBar splashProgressBar = new ProgressBar();
    splashProgressBar.setPrefWidth(imageView.getImage().getWidth());
    VBox vbox = new VBox();
    vbox.getChildren().addAll(new Node[]{imageView, splashProgressBar});
    return vbox;
}
 
開發者ID:CLARIN-PL,項目名稱:WordnetLoom,代碼行數:9,代碼來源:SplashScreen.java

示例11: getProgressBar

import javafx.scene.control.ProgressBar; //導入方法依賴的package包/類
private ProgressBar getProgressBar(Stage primaryStage) {
    ProgressBar bar = new ProgressBar();
    GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
    int width = device.getDisplayMode().getWidth();
    int height = device.getDisplayMode().getHeight();
    bar.setPrefWidth(width * 0.8);
    bar.setPrefHeight(height * 0.025);
    Scene scene = new Scene(bar);
    primaryStage.initStyle(StageStyle.UNDECORATED);
    primaryStage.setScene(scene);
    primaryStage.setY(height - height * 0.025);
    primaryStage.setX(width - primaryStage.getWidth() / 2);
    primaryStage.show();
    return bar;
}
 
開發者ID:rvictor89,項目名稱:benchmarkjfx,代碼行數:16,代碼來源:BenchmarkJFX.java

示例12: getParent

import javafx.scene.control.ProgressBar; //導入方法依賴的package包/類
/**
 * 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;
}
 
開發者ID:roskenet,項目名稱:springboot-javafx-support,代碼行數:16,代碼來源:SplashScreen.java

示例13: init

import javafx.scene.control.ProgressBar; //導入方法依賴的package包/類
@Override public void init() {
  Locale.setDefault(new Locale("en", "US"));
  
  String strTest = System.getProperty("test");
  if(strTest!=null && strTest.equalsIgnoreCase("true") ){
    Config.PPK_ODIN_MARK_PUBKEY_HEX=Config.PPK_ODIN_MARK_PUBKEY_HEX_TESTNET;
    Config.appName += "Test";
  }else{
    Config.PPK_ODIN_MARK_PUBKEY_HEX=Config.PPK_ODIN_MARK_PUBKEY_HEX_MAINNET;
  }
  
  String strLang = System.getProperty("lang");
  if(strLang!=null){
      Language.setLang(strLang);
  }
  
  System.out.println(Language.getLangLabel("PPkPub"));
  System.out.println(Language.getLangLabel("Loading")+" "+Config.appName+" V"+Config.version);
  
  GUI.bShowGui=true;
  String strNoGuiSet = System.getProperty("nogui");
  if(strNoGuiSet!=null){
      GUI.bShowGui=false;
  }
  
  if(GUI.bShowGui){
      ImageView splash = new ImageView(new Image("file:./resources/static/images/logo.png"));
      loadProgress = new ProgressBar();
      loadProgress.setPrefWidth(SPLASH_WIDTH);
      progressText = new Label("");
      splashLayout = new VBox();
      splashLayout.getChildren().addAll(splash, loadProgress, progressText);
      progressText.setAlignment(Pos.CENTER);
      splashLayout.setStyle("-fx-padding: 5; -fx-background-color: linear-gradient(to bottom, #ffffff, #ffffff); -fx-border-width:1; -fx-border-color: black;");
      splashLayout.setEffect(new DropShadow());
  }else{
                  
  }
}
 
開發者ID:ppkpub,項目名稱:javatool,代碼行數:40,代碼來源:GUI.java

示例14: miniGraph

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

示例15: init

import javafx.scene.control.ProgressBar; //導入方法依賴的package包/類
@Override
public void init()
{
    ImageView splash = new ImageView(new Image(getClass().getResourceAsStream("/rocket.png")));
    loadProgress = new ProgressBar();
    loadProgress.setPrefWidth(SPLASH_WIDTH - 20);
    progressText = new Label("Starte epub4mmee ...");
    splashLayout = new VBox();
    splashLayout.getChildren().addAll(splash, loadProgress, progressText);
    splash.setStyle("fx-margin: auto;");
    progressText.setAlignment(Pos.CENTER);
    splashLayout.setStyle("-fx-padding: 5; -fx-background-color: white; -fx-border-width:5; -fx-border-color: #B3204D;");
    splashLayout.setEffect(new DropShadow());
    applicationIcon = new Image(getClass().getResourceAsStream("/rocket.png"));
}
 
開發者ID:finanzer,項目名稱:epubfx,代碼行數:16,代碼來源:EpubEditorApplication.java


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