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


Java Platform.isFxApplicationThread方法代碼示例

本文整理匯總了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);
}
 
開發者ID:Yeregorix,項目名稱:EpiStats,代碼行數:8,代碼來源:ObjectListPanel.java

示例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));
    }
}
 
開發者ID:whitewoodcity,項目名稱:xbrowser,代碼行數:16,代碼來源:Canvas.java

示例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;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:40,代碼來源:DisplayWindow.java

示例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();
}
 
開發者ID:whitewoodcity,項目名稱:xbrowser,代碼行數:15,代碼來源:Canvas.java

示例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);
    }
}
 
開發者ID:neal1991,項目名稱:everywhere,代碼行數:9,代碼來源:GUIUtils.java

示例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));
		}
	}
}
 
開發者ID:macroing,項目名稱:Dayflower-Path-Tracer,代碼行數:13,代碼來源:TestApplication.java

示例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;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:31,代碼來源:Display.java

示例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();
    }
}
 
開發者ID:kasirgalabs,項目名稱:ETUmulator,代碼行數:16,代碼來源:GUISafeDispatcher.java

示例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;
	}
	
}
 
開發者ID:goxr3plus,項目名稱:JavaFXApplicationAutoUpdater,代碼行數:45,代碼來源:ActionTool.java

示例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);
    }
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:13,代碼來源:EditorOperationControl.java

示例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();
}
 
開發者ID:whitewoodcity,項目名稱:xbrowser,代碼行數:7,代碼來源:Chart.java

示例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();
}
 
開發者ID:whitewoodcity,項目名稱:xbrowser,代碼行數:7,代碼來源:Chart.java

示例13: setWidth

import javafx.application.Platform; //導入方法依賴的package包/類
public void setWidth(double width) {
    if (Platform.isFxApplicationThread()) {
        body.setFitWidth(width);
    } else Platform.runLater(() -> body.setFitWidth(width));
}
 
開發者ID:whitewoodcity,項目名稱:xbrowser,代碼行數:6,代碼來源:ImageView.java

示例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));

}
 
開發者ID:whitewoodcity,項目名稱:xbrowser,代碼行數:6,代碼來源:Label.java

示例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();
}
 
開發者ID:whitewoodcity,項目名稱:xbrowser,代碼行數:7,代碼來源:Control.java


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