本文整理汇总了Java中javafx.application.Platform.isFxApplicationThread方法的典型用法代码示例。如果您正苦于以下问题:Java Platform.isFxApplicationThread方法的具体用法?Java Platform.isFxApplicationThread怎么用?Java Platform.isFxApplicationThread使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.application.Platform
的用法示例。
在下文中一共展示了Platform.isFxApplicationThread方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateObjectList
import javafx.application.Platform; //导入方法依赖的package包/类
private void updateObjectList() {
if (Platform.isFxApplicationThread()) {
this.players.setText(Integer.toString(this.list.players.size()));
this.guilds.setText(Integer.toString(this.list.guilds.size()));
} else
Platform.runLater(this::updateObjectList);
}
示例2: image
import javafx.application.Platform; //导入方法依赖的package包/类
public void image(Image img,
double sx, double sy, double sw, double sh,
double dx, double dy, double dw, double dh) throws InterruptedException,ExecutionException{
if (Platform.isFxApplicationThread()) {
imageBase(img,sx,sy,sw,sh,dx,dy,dw,dh);
}else {
counter++;
if(counter>maxCounter){
throw new ExecutionException(new Exception(hint));
}
Platform.runLater(() -> imageBase(img, sx, sy, sw, sh, dx, dy, dw, dh));
}
}
示例3: trackProgress
import javafx.application.Platform; //导入方法依赖的package包/类
@Override public int trackProgress(final SourceLine line, int type) {
if (scriptConsole != null) {
return IPlaybackListener.CONTINUE;
}
if (getFilePath().equals(line.fileName)) {
if (Platform.isFxApplicationThread()) {
currentEditor.highlightLine(line.lineNumber - 1);
} else {
Platform.runLater(() -> {
currentEditor.highlightLine(line.lineNumber - 1);
});
}
}
if (debugging == false) {
return IPlaybackListener.CONTINUE;
}
callStack.update(type, line);
BreakPoint bp = new BreakPoint(line.fileName, line.lineNumber - 1);
if (type == Display.LINE_REACHED && (stepIntoActive || breakpoints.contains(bp)
|| breakStackDepth != -1 && callStack.getStackDepth() <= breakStackDepth)) {
if (!getFilePath().equals(line.fileName)) {
File file = new File(line.fileName);
if (file.exists()) {
Platform.runLater(new Runnable() {
@Override public void run() {
goToFile(line.fileName, line.lineNumber - 1);
}
});
} else {
return IPlaybackListener.CONTINUE;
}
}
stepIntoActive = false;
breakStackDepth = -1;
Platform.runLater(() -> display.pausePlay());
return IPlaybackListener.PAUSE;
}
return IPlaybackListener.CONTINUE;
}
示例4: getHeight
import javafx.application.Platform; //导入方法依赖的package包/类
public double getHeight() throws InterruptedException,ExecutionException{
if (Platform.isFxApplicationThread()) {
return getHeightBase();
}
counter++;
if(counter>maxCounter){
throw new ExecutionException(new Exception(hint));
}
final FutureTask<Double> task = new FutureTask<>(() -> getHeightBase());
Platform.runLater(task);
return task.get();
}
示例5: runSafe
import javafx.application.Platform; //导入方法依赖的package包/类
public static void runSafe(final Runnable runnable) {
Objects.requireNonNull(runnable, "runnable");
if (Platform.isFxApplicationThread()) {
runnable.run();
} else {
Platform.runLater(runnable);
}
}
示例6: yawChanged
import javafx.application.Platform; //导入方法依赖的package包/类
@Override
public void yawChanged(final Camera camera, final Angle yaw) {
final Slider sliderYaw = this.sliderYaw;
if(sliderYaw != null) {
if(Platform.isFxApplicationThread()) {
sliderYaw.setValue(yaw.degrees);
} else {
Platform.runLater(() -> sliderYaw.setValue(yaw.degrees));
}
}
}
示例7: playbackFinished
import javafx.application.Platform; //导入方法依赖的package包/类
@Override public void playbackFinished(final PlaybackResult result, boolean shutdown) {
this.autShutdown = shutdown;
displayView.endTest(result);
if (ddTestRunner != null && ddTestRunner.hasNext() && !playbackStopped) {
ddTestRunner.next();
Platform.runLater(new Runnable() {
@Override public void run() {
if (result.failureCount() == 0) {
shouldClose = !reuseFixture;
displayView.trackProgress();
ignoreReuse = false;
} else {
ignoreReuse = true;
shouldClose = false;
}
stopApplicationIfNecessary();
runTest(debugging);
}
});
return;
}
displayView.stopInserting();
if (Platform.isFxApplicationThread()) {
showResult(result);
} else {
Platform.runLater(() -> showResult(result));
}
displayView.endTestRun();
ddTestRunner = null;
}
示例8: notifyObservers
import javafx.application.Platform; //导入方法依赖的package包/类
@Override
public void notifyObservers(Class<?> clazz, Object arg) {
final CountDownLatch latch = new CountDownLatch(1);
Platform.runLater(() -> {
super.notifyObservers(clazz, arg);
latch.countDown();
});
try {
if(!Platform.isFxApplicationThread()) {
latch.await();
}
} catch(InterruptedException ex) {
throw new CancellationException();
}
}
示例9: showNotification
import javafx.application.Platform; //导入方法依赖的package包/类
/**
* Show a notification.
*
* @param title
* The notification title
* @param text
* The notification text
* @param d
* The duration that notification will be visible
* @param t
* The notification type
*/
public static void showNotification(String title , String text , Duration d , NotificationType t) {
//Check if it is JavaFX Application Thread
if (!Platform.isFxApplicationThread()) {
Platform.runLater(() -> showNotification(title, text, d, t));
return;
}
Notifications notification1 = Notifications.create().title(title).text(text);
notification1.hideAfter(d);
switch (t) {
case CONFIRM:
notification1.showConfirm();
break;
case ERROR:
notification1.showError();
break;
case INFORMATION:
notification1.showInformation();
break;
case SIMPLE:
notification1.show();
break;
case WARNING:
notification1.showWarning();
break;
default:
break;
}
}
示例10: clear
import javafx.application.Platform; //导入方法依赖的package包/类
/**
* Clear operation history.
*/
@FromAnyThread
public void clear() {
if (Platform.isFxApplicationThread()) {
clearImpl();
} else {
final ExecutorManager executorManager = ExecutorManager.getInstance();
executorManager.addFXTask(this::clearImpl);
}
}
示例11: xProperty
import javafx.application.Platform; //导入方法依赖的package包/类
public DoubleProperty xProperty() throws InterruptedException,ExecutionException{
if(Platform.isFxApplicationThread()) return body.layoutXProperty();
final FutureTask<DoubleProperty> task = new FutureTask<>(()->body.layoutXProperty());
Platform.runLater(task);
return task.get();
}
示例12: getX
import javafx.application.Platform; //导入方法依赖的package包/类
public double getX() throws InterruptedException,ExecutionException {
if(Platform.isFxApplicationThread()) return body.getLayoutX();
final FutureTask<Double> task = new FutureTask<>(()->body.getLayoutX());
Platform.runLater(task);
return task.get();
}
示例13: setWidth
import javafx.application.Platform; //导入方法依赖的package包/类
public void setWidth(double width) {
if (Platform.isFxApplicationThread()) {
body.setFitWidth(width);
} else Platform.runLater(() -> body.setFitWidth(width));
}
示例14: Label
import javafx.application.Platform; //导入方法依赖的package包/类
public Label(String text, javafx.scene.Node graphic) {
if (Platform.isFxApplicationThread()) body = new javafx.scene.control.Label(text,graphic);
else Platform.runLater(() -> body = new javafx.scene.control.Label(text,graphic));
}
示例15: getY
import javafx.application.Platform; //导入方法依赖的package包/类
public double getY() throws InterruptedException,ExecutionException{
if(Platform.isFxApplicationThread()) return body.getLayoutY();
final FutureTask<Double> task = new FutureTask<>(()->body.getLayoutY());
Platform.runLater(task);
return task.get();
}