本文整理汇总了Java中com.sun.javafx.application.PlatformImpl.startup方法的典型用法代码示例。如果您正苦于以下问题:Java PlatformImpl.startup方法的具体用法?Java PlatformImpl.startup怎么用?Java PlatformImpl.startup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.javafx.application.PlatformImpl
的用法示例。
在下文中一共展示了PlatformImpl.startup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setNowObject
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
public static synchronized void setNowObject(Object obj, Field f){
if (!start)
start();
while (!start)
Animation.sleepSeconds(1);
PlatformImpl.startup(() -> {});
Platform.runLater(() -> {
TreeItem<String> rootItem = new TreeItem<String>((f == null ? "" : f.getName()) + obj.getClass().getName() + " : " + obj);
TreeView<String> tree = new TreeView<String> (rootItem);
rootItem.setExpanded(true);
try {
addChildren(obj, obj, f, null, rootItem);
} catch(Exception e){e.printStackTrace();}
StackPane root = new StackPane();
root.getChildren().add(tree);
stage.setScene(new Scene(root));
});
}
示例2: createScene
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
private void createScene() {
PlatformImpl.startup(new Runnable() {
@Override
public void run() {
stage = new Stage();
Group root = new Group();
Scene scene = new Scene(root, 900, 680);
stage.setScene(scene);
// Set up the embedded browser:
browser = new WebView();
browser.setMinSize(900, 680);
webEngine = browser.getEngine();
webEngine.load(getClass().getResource("/index.html").toString());
ObservableList<Node> children = root.getChildren();
children.add(browser);
jfxPanel.setScene(scene);
}
});
}
示例3: initFx
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
private static void initFx() {
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
System.setProperty("javafx.embed.isEventThread", "true");
System.setProperty("glass.win.uiScale", "100%");
System.setProperty("glass.win.renderScale", "100%");
return null;
});
Map map = Application.getDeviceDetails();
if (map == null) {
Application.setDeviceDetails(map = new HashMap());
}
if (map.get("javafx.embed.eventProc") == null) {
long eventProc = 0;
try {
Field field = Display.class.getDeclaredField("eventProc");
field.setAccessible(true);
if (field.getType() == int.class) {
eventProc = field.getLong(Display.getDefault());
} else {
if (field.getType() == long.class) {
eventProc = field.getLong(Display.getDefault());
}
}
} catch (Throwable th) {
//Fail silently
}
map.put("javafx.embed.eventProc", eventProc);
}
// Note that calling PlatformImpl.startup more than once is OK
PlatformImpl.startup(() -> {
Application.GetApplication().setName(Display.getAppName());
});
}
示例4: createScene
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
/**
* createScene
*
* Note: Key is that Scene needs to be created and run on "FX user thread"
* NOT on the AWT-EventQueue Thread
*
*/
@SuppressWarnings("restriction")
private void createScene() {
PlatformImpl.startup(new Runnable() {
@Override
public void run() {
stage = new Stage();
stage.setTitle("Hello Java FX");
stage.setResizable(true);
Group root = new Group();
Scene scene = new Scene(root,80,20);
stage.setScene(scene);
// Set up the embedded browser:
browser = new WebView();
webEngine = browser.getEngine();
webEngine.load("https://sourceforge.net/p/mars-sim/discussion/");//"http://www.google.com");
ObservableList<Node> children = root.getChildren();
children.add(browser);
jfxPanel.setScene(scene);
}
});
}
示例5: createScene
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
private void createScene() {
PlatformImpl.startup(() -> {
Stage stage;
WebView browser;
stage = new Stage();
stage.setTitle("Hello Java FX");
stage.setResizable(true);
Group root = new Group();
Scene scene = new Scene(root, 80, 20);
stage.setScene(scene);
// Set up the embedded browser:
browser = new WebView();
webEngine = browser.getEngine();
// webEngine.load("http://heise.de");
// ScrollPane scrollPane = new ScrollPane();
// scrollPane.setContent(browser);
webEngine.loadContent("<b>asdf</b>");
// root.getChildren().addAll(scrollPane);
// scene.setRoot(root);
// stage.setScene(scene);
root.getChildren().add(browser);
// children.add(browser);
jfxPanel.setScene(scene);
});
while (webEngine == null) {
Utils.sleep(25);
}
}
示例6: createScene
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
/**
* createScene
* <p/>
* Note: Key is that Scene needs to be created and run on "FX user thread" NOT on the AWT-EventQueue Thread
*/
private void createScene() {
PlatformImpl.startup(new Runnable() {
@Override
public void run() {
Stage stage;
WebView browser;
stage = new Stage();
stage.setTitle("Hello Java FX");
stage.setResizable(true);
Group root = new Group();
Scene scene = new Scene(root, 80, 20);
stage.setScene(scene);
// Set up the embedded browser:
browser = new WebView();
webEngine = browser.getEngine();
// webEngine.load("http://heise.de");
// ScrollPane scrollPane = new ScrollPane();
// scrollPane.setContent(browser);
webEngine.loadContent("<b>asdf</b>");
// root.getChildren().addAll(scrollPane);
// scene.setRoot(root);
// stage.setScene(scene);
ObservableList<Node> children = root.getChildren();
children.add(browser);
jfxPanel.setScene(scene);
}
});
}
示例7: initJfx
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
public static void initJfx() {
//new JFXPanel();
// Note that calling PlatformImpl.startup more than once is OK
//if (!initialized.get()) {
PlatformImpl.startup(() -> {
Helper.initJfxStyle();
});
//}
}
示例8: initJavaFX
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
@Before
public void initJavaFX() throws Exception {
// Initialize Platform (required by FX components).
PlatformImpl.startup(() -> {
// Nothing
});
// Initialize injector and fxml loader.
TestApplication app = new TestApplication();
app.init();
fxmlLoader = app.getInjector().getInstance(GuiceFXMLLoader.class);
}
示例9: call3
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
public Sequence call3(XPathContext context, Sequence[] arguments) throws XPathException {
logger.info("call");
try {
FXThread fxThread = new FXThread();
Platform.setImplicitExit(false);
PlatformImpl.startup(fxThread);
fxThread.join();
// Platform.runLater(fxThread);
} catch (Exception e) {
logger.error(e, e);
}
return EmptySequence.getInstance();
// String inputString = "";
// SequenceIterator selectIterator = arguments[HTML].iterate();
// Item item = selectIterator.next();
// while (item != null) {
// if (item instanceof StringValue) {
// inputString += item.getStringValue();
// } else if (item instanceof NodeInfo) {
// inputString += QueryResult.serialize((NodeInfo)item);
// } else {
// throw new XPathException("Can't serialize item: " + item.getClass());
// }
// item = selectIterator.next();
// }
//
// final SequenceOutputter out = context.getController().allocateSequenceOutputter(50);
//
// out.startElement(new NoNamespaceName("Input"), Untyped.getInstance(), locationId, 0);
// out.characters(inputString, locationId, 0);
// out.endElement();
//
// out.startElement(new NoNamespaceName("Result"), Untyped.getInstance(), locationId, 0);
// out.characters("Hello, world!", locationId, 0);
// out.endElement();
//
// return SequenceTool.toLazySequence(out.iterate());
}
示例10: initFx
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
private static void initFx() {
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
System.setProperty("javafx.embed.isEventThread", "true");
return null;
});
Map map = Application.getDeviceDetails();
if (map == null) {
Application.setDeviceDetails(map = new HashMap());
}
if (map.get("javafx.embed.eventProc") == null) {
long eventProc = 0;
try {
Field field = Display.class.getDeclaredField("eventProc");
field.setAccessible(true);
if (field.getType() == int.class) {
eventProc = field.getLong(Display.getDefault());
} else {
if (field.getType() == long.class) {
eventProc = field.getLong(Display.getDefault());
}
}
} catch (Throwable th) {
//Fail silently
}
map.put("javafx.embed.eventProc", eventProc);
}
// Note that calling PlatformImpl.startup more than once is OK
PlatformImpl.startup(() -> {
Application.GetApplication().setName(Display.getAppName());
});
}
示例11: createScene
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
/**
* createScene
*
* Note: Key is that Scene needs to be created and run on "FX user thread"
* NOT on the AWT-EventQueue Thread
*
*/
private void createScene(JFXPanel jfxPanel) {
PlatformImpl.startup(new Runnable() {
@Override
public void run() {
Stage stage = new Stage();
StackPane root = new StackPane();
Scene scene = new Scene(root);
stage.setScene(scene);
Platform.setImplicitExit(false);
// Set up the embedded browser:
browser = new WebView();
final WebEngine webEngine = browser.getEngine();
webEngine.setJavaScriptEnabled(true);
webEngine.load("http://warfront1.github.io/AutoFletcherElite/UserInterfaces/AutoFletcherElitePaint.html");
webEngine.getLoadWorker().stateProperty().addListener(
new ChangeListener<Worker.State>() {
Bridge javaBridge = new Bridge(webEngine);
@Override
public void changed(ObservableValue ov, Worker.State oldState, Worker.State newState) {
if (newState == Worker.State.SUCCEEDED) {
JSObject jso = (JSObject) webEngine.executeScript("window");
jso.setMember("java", javaBridge);
}
}
});
ObservableList<Node> children = root.getChildren();
children.add(browser);
jfxPanel.setScene(scene);
}
});
}
示例12: createScene
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
/**
* createScene
*
* Note: Key is that Scene needs to be created and run on "FX user thread"
* NOT on the AWT-EventQueue Thread
*
*/
private void createScene() {
PlatformImpl.startup(new Runnable() {
@Override
public void run() {
stage = new Stage();
stage.setTitle("Hello Java FX");
StackPane root = new StackPane();
Scene scene = new Scene(root, 470,680);
stage.setScene(scene);
Platform.setImplicitExit(false);
// Set up the embedded browser:
browser = new WebView();
final WebEngine webEngine = browser.getEngine();
webEngine.setJavaScriptEnabled(true);
// webEngine.load("http://elitescripts.tk/AutoFletcherElite/AutoFletcherEliteGUI.html");
webEngine.load("http://warfront1.github.io/AutoFletcherElite/UserInterfaces/AutoFletcherEliteGUI.html");
webEngine.getLoadWorker().stateProperty().addListener(
new ChangeListener<Worker.State>() {
Bridge javaBridge = new Bridge(webEngine);
@Override
public void changed(ObservableValue ov, Worker.State oldState, Worker.State newState) {
if (newState == Worker.State.SUCCEEDED) {
JSObject jso = (JSObject) webEngine.executeScript("window");
jso.setMember("java", javaBridge);
}
}
});
ObservableList<Node> children = root.getChildren();
children.add(browser);
jfxPanel.setScene(scene);
System.out.println("Main FX UI Successfully Created!");
}
});
}
示例13: testSimpleLogin
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
public void testSimpleLogin() throws InterruptedException {
CountDownLatch waitForIt = new CountDownLatch(1);
PlatformImpl.startup(() -> {
WebView loginView = new WebView();
loginView.setPrefWidth(600);
loginView.setPrefHeight(600);
CoinBaseOAuth cbl = new CoinBaseOAuth(loginView);
cbl.checkTokens(true, true);
Scene theScene = new Scene(loginView);
Stage theStage = new Stage();
theStage.setScene(theScene);
theStage.setOnHiding(e -> waitForIt.countDown());
cbl.accessTokenProperty().addListener((change, oldV, newV) -> {
System.out.println(newV);
CoinBaseAPI cbapi = new CoinBaseAPI(cbl);
List<CBAddress> addresses = cbapi.getAddresses();
System.out.println(addresses);
addresses.forEach(a -> System.out.println(a.getJsonSeed()));
waitForIt.countDown();
});
if (!cbl.checkTokens(true, true)) {
theStage.show();
}
});
waitForIt.await();
}
示例14: FXEditorTaskExecutor
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
/**
* Instantiates a new Fx editor task executor.
*/
public FXEditorTaskExecutor() {
setName(FXEditorTaskExecutor.class.getSimpleName());
setPriority(NORM_PRIORITY);
PlatformImpl.startup(this::start);
}
示例15: initialisePlatform
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
@BeforeClass public static void initialisePlatform(){
PlatformImpl.startup( () -> {} );
}