当前位置: 首页>>代码示例>>Java>>正文


Java Platform.runLater方法代码示例

本文整理汇总了Java中javafx.application.Platform.runLater方法的典型用法代码示例。如果您正苦于以下问题:Java Platform.runLater方法的具体用法?Java Platform.runLater怎么用?Java Platform.runLater使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.application.Platform的用法示例。


在下文中一共展示了Platform.runLater方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: gotoLine

import javafx.application.Platform; //导入方法依赖的package包/类
/**
 * Goto a line
 */
private void gotoLine() {
    if (currentEditor == null || currentEditor.getData("editorType") != IEditorProvider.EditorType.OTHER) {
        return;
    }
    int lastOffset = currentEditor.getText().length();
    int lastLine;
    lastLine = currentEditor.getLineOfOffset(lastOffset);
    Platform.runLater(() -> {
        Stage stage = lineNumberStage.getStage();
        lineNumberStage.setMaxLineNumber(lastLine + 1);
        lineNumberStage.setLine(currentEditor.getCaretLine() + 1);
        lineNumberStage.setInputHandler(new GoToLineHandler());
        stage.showAndWait();
    });
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:DisplayWindow.java

示例2: isValidInput

import javafx.application.Platform; //导入方法依赖的package包/类
@Override public boolean isValidInput(boolean showAlert) {
    if (projectNameField.getText() == null || projectNameField.getText().equals("")) {
        if (showAlert) {
            FXUIUtils.showMessageDialog(parent.getStage(), "Project name can't be empty", "Project Name", AlertType.ERROR);
        }
        Platform.runLater(() -> projectNameField.requestFocus());
        return false;
    }
    if (dirField.getText() == null || dirField.getText().equals("")) {
        if (showAlert) {
            FXUIUtils.showMessageDialog(parent.getStage(), "Project directory can't be empty", "Project Directory",
                    AlertType.ERROR);
        }
        Platform.runLater(() -> browseButton.requestFocus());
        return false;
    }
    return true;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:ProjectLayout.java

示例3: select

import javafx.application.Platform; //导入方法依赖的package包/类
@Test public void select() {
    TableView<?> tableView = (TableView<?>) getPrimaryStage().getScene().getRoot().lookup(".table-view");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        Point2D point = getPoint(tableView, 1, 1);
        TableCellFactorySample.EditingCell tf = (EditingCell) getCellAt(tableView, 1, 1);
        RFXTableView rfxTableView = new RFXTableView(tableView, null, point, lr);
        rfxTableView.focusGained(null);
        tf.startEdit();
        tf.updateItem("Cell Modified", false);
        rfxTableView.focusLost(null);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals("Cell Modified", recording.getParameters()[0]);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:18,代码来源:RFXTableViewTextFieldTableCellTest.java

示例4: hashChanged

import javafx.application.Platform; //导入方法依赖的package包/类
/**
 * Called from JavaScript in the browser when the page hash location changes
 * 
 * @param hashLoc The new has location, e.g. #SAMPLES
 */
public void hashChanged(String hashLoc) {
    if (hashLoc != null) {
        // remove # 
        if (hashLoc.length() == 0) {
            hashLoc = null;
        } else {
            hashLoc = hashLoc.substring(1);
        }
        // if new page then navigate to it
        final String path = hashLoc;
        Platform.runLater(new Runnable() {
            public void run() {
                if (!path.equals(currentPagePath)) goToPage(path);
            }
        });
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:23,代码来源:Ensemble2.java

示例5: setProgeress

import javafx.application.Platform; //导入方法依赖的package包/类
/** set progress value at progress bar when send file */
public void setProgeress(int index, double value, long onGoing, long fileLength, boolean isDownloading) {
	double onGoingMB = ((onGoing / 1024.0) / 1024.0);
	double fileLengthMB = ((fileLength / 1024.0) / 1024.0);

	DecimalFormat dec = new DecimalFormat("0.0");

	String progress = (int) value + "% (" + dec.format(onGoingMB) + " / " + dec.format(fileLengthMB) + " MB)";

	Platform.runLater(() -> {
		try {
			if(!isDownloading)
				textArray[index].setText("Uploading " + progress);
			else
				textArray[index].setText("Downloading " + progress);

			progressBarArray[index].setProgress(value*0.01);
		} catch (ArrayIndexOutOfBoundsException e) {
			System.out.println("index exception");
		}
	});
}
 
开发者ID:Team-Sprout,项目名称:Clipcon-Client,代码行数:23,代码来源:ProgressBarScene.java

示例6: completeProgress

import javafx.application.Platform; //导入方法依赖的package包/类
/** set complete at progress bar when  file  */
public void completeProgress(int index) {
	Platform.runLater(() -> {
		textArray[index].setText("Complete!");
		progressBarArray[index].setProgress(1);
	});
}
 
开发者ID:Team-Sprout,项目名称:Clipcon-Client,代码行数:8,代码来源:ProgressBarScene.java

示例7: initialize

import javafx.application.Platform; //导入方法依赖的package包/类
/**
 * Initializes the controller class.
 *
 * @param url
 * @param rb
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    btnUpdate.setVisible(false);
    Platform.runLater(() -> {
        loadDrug();
        loadTemplate();
        loadPrescription();
    });
}
 
开发者ID:kmrifat,项目名称:Dr-Assistant,代码行数:16,代码来源:NewPrescriptionController.java

示例8: testGauge

import javafx.application.Platform; //导入方法依赖的package包/类
@Test
public void testGauge() throws InterruptedException {
  GridPane pane = new GridPane();
  Gauge gauge = GaugeBuilder.create().minValue(0).maxValue(100)
      .tickLabelDecimals(0).decimals(1).autoScale(true).animated(true)
      // .backgroundPaint(Color.TRANSPARENT)
      // .borderPaint(Color.LIGHTGRAY)
      // .knobColor(Color.rgb(0, 90, 120))
      .shadowsEnabled(true)
      // .tickLabelColor(Color.rgb(0, 175, 248))
      // .ledColor(Color.rgb(0, 175, 248))
      .ledVisible(true).ledBlinking(true).sectionsVisible(true)
      .sections(new Section(75, 100, Color.rgb(139, 195, 102, 0.5)))
      .areasVisible(true)
      .areas(new Section(0.00, 25, Color.rgb(234, 83, 79, 0.5)))
      .majorTickMarkColor(Color.MAGENTA)
      // .minorTickMarkColor(Color.rgb(0, 175, 248))
      .majorTickMarkType(TickMarkType.TRAPEZOID)
      .mediumTickMarkType(TickMarkType.DOT)
      .minorTickMarkType(TickMarkType.LINE)
      .tickLabelOrientation(TickLabelOrientation.ORTHOGONAL)
      .tickMarkSections(new Section(0.25, 0.5, Color.rgb(241, 161, 71)))
      .tickMarkSectionsVisible(true)
      .markers(new Marker(0.5, "", Color.CYAN, MarkerType.TRIANGLE))
      .markersVisible(true)
      // .majorTickMarksVisible(true)
      // .minorTickMarksVisible(true)
      .tickLabelLocation(TickLabelLocation.INSIDE)
      // .tickLabelsVisible(true)
      .tickLabelSections(new Section(0.1, 0.3, Color.rgb(0, 175, 248)))
      // .tickLabelSectionsVisible(true)
      .title("SOC")
      // .titleColor(Color.rgb(223, 223, 223))
      .unit("%").lcdDesign(LcdDesign.SECTIONS).lcdVisible(true)
      .lcdFont(LcdFont.STANDARD)
      // .unitColor(Color.rgb(223, 223, 223))
      // .valueColor(Color.rgb(223, 223, 223))
      .needleSize(NeedleSize.THICK).build();
  FGauge framedGauge = new FGauge(gauge, GaugeDesign.ENZO,
      GaugeBackground.DARK_GRAY);

  pane.add(framedGauge, 0, 0);

  DoubleProperty dproperty = new SimpleDoubleProperty(85.0);

  SampleApp sampleApp = new SampleApp("Gauge", pane, 67, 2, 2);
  sampleApp.show();
  sampleApp.waitOpen();
  Stage stage = sampleApp.getStage();
  framedGauge.prefWidthProperty().bind(stage.widthProperty());
  framedGauge.prefHeightProperty().bind(stage.heightProperty());
  gauge.valueProperty().bind(dproperty);
  while (stage.isShowing()) {
    Thread.sleep(15);
    Platform.runLater(() -> dproperty.setValue(dproperty.getValue() - 0.1));
    if (dproperty.getValue() < 45)
      sampleApp.close();
  }
}
 
开发者ID:BITPlan,项目名称:can4eve,代码行数:60,代码来源:TestAppGUI.java

示例9: onRequestUpdate

import javafx.application.Platform; //导入方法依赖的package包/类
public void onRequestUpdate(int id, String status){
    Platform.runLater(() -> {
        for(TX tx : model){
            if(tx.sortID == id){
                tx.setStatus(status);
            }
        }
        table.refresh();
    });
}
 
开发者ID:Roxas240,项目名称:CryptoPayAPI,代码行数:11,代码来源:Main.java

示例10: reloadContentGallery

import javafx.application.Platform; //导入方法依赖的package包/类
private void reloadContentGallery() {
//        System.out.println("reload content Gallery");
        Platform.runLater(() -> {
            masonryPane.getChildren().clear();
            masonryPane.getChildren().addAll(children);
        });
    }
 
开发者ID:maximova136,项目名称:j-demo,代码行数:8,代码来源:ScreenshotController.java

示例11: selectMulptipleRows

import javafx.application.Platform; //导入方法依赖的package包/类
@Test public void selectMulptipleRows() {
    TreeTableView<?> treeTableView = (TreeTableView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-table-view");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        treeTableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
        RFXTreeTableView rfxTreeTableView = new RFXTreeTableView(treeTableView, null, null, lr);
        treeTableView.getSelectionModel().selectIndices(2, 4);
        rfxTreeTableView.focusLost(null);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals("{\"rows\":[\"/Sales Department/Emma Jones\",\"/Sales Department/Anna Black\"]}",
            recording.getParameters()[0]);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:16,代码来源:RFXTreeTableViewTest.java

示例12: setValue

import javafx.application.Platform; //导入方法依赖的package包/类
public void setValue(String selected){
    if (Platform.isFxApplicationThread()){
        ((javafx.scene.control.ChoiceBox)body).setValue(selected);
    }
    else Platform.runLater(() -> {
        ((javafx.scene.control.ChoiceBox)body).setValue(selected);
    });
}
 
开发者ID:whitewoodcity,项目名称:xbrowser,代码行数:9,代码来源:ChoiceBox.java

示例13: consoleUpdater

import javafx.application.Platform; //导入方法依赖的package包/类
protected Consumer<ByteBuffer> consoleUpdater(ObjectProperty<Color> colorBinding){
    return  b -> {
        Text text = new Text(getCharset().decode(b).toString());
        text.fillProperty().bind(colorBinding);
        //need to use platform here as the consumer is invoked by the console pipe's thread
        Platform.runLater(() -> consoleArea.getChildren().add(text));
    };
}
 
开发者ID:gmuecke,项目名称:boutique-de-jus,代码行数:9,代码来源:ProcessController.java

示例14: engineStopped

import javafx.application.Platform; //导入方法依赖的package包/类
@Override
public void engineStopped(IExecutionEngine engine) {
	executedModel = null;
	eventTypeToEventTableView.clear();
	Platform.runLater(() -> {
		eventList.clear();
		scrollPane.setContent(null);
	});
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:10,代码来源:EventManagerRenderer.java

示例15: updateCaptureMessage

import javafx.application.Platform; //导入方法依赖的package包/类
public void updateCaptureMessage(String message, String label) {
    //<editor-fold defaultstate="collapsed" desc="On capture button clicked">
    Platform.runLater(() -> {
        String oldMessage = messages.getText();
        if (oldMessage != null && oldMessage.trim().length() > 0) {
            messages.setText(oldMessage + "\n" + message);
        } else {
            messages.setText(message);
        }
        if (label != null) {
            recorderBtn.setText(label);
        }
    });
    //</editor-fold>
}
 
开发者ID:mhusam,项目名称:ChessBot,代码行数:16,代码来源:Home.java


注:本文中的javafx.application.Platform.runLater方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。