本文整理汇总了Java中com.sun.javafx.application.PlatformImpl类的典型用法代码示例。如果您正苦于以下问题:Java PlatformImpl类的具体用法?Java PlatformImpl怎么用?Java PlatformImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlatformImpl类属于com.sun.javafx.application包,在下文中一共展示了PlatformImpl类的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: quit
import com.sun.javafx.application.PlatformImpl; //导入依赖的package包/类
/**
* 退出程序
*/
private static void quit(){
// 退出程序
Platform.runLater(() -> {
// 退出监听
PlatformImpl.addListener(new PlatformImpl.FinishListener() {
@Override
public void idle(boolean implicitExit) {
LogUtils.d( "FinishListener idle");
}
@Override
public void exitCalled() {
LogUtils.d( "FinishListener exitCalled");
System.exit(0); //kill process
}
});
Platform.exit();
});
}
示例4: createWindow
import com.sun.javafx.application.PlatformImpl; //导入依赖的package包/类
public void createWindow(Project project) {
jFXPanel = new JFXPanel();
ToolWindow toolWindow = ToolWindowManager.getInstance(project).registerToolWindow("Basis.js", false, ToolWindowAnchor.BOTTOM, false);
toolWindow.setIcon(IconLoader.getIcon("/icons/basisjs.png"));
ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
Content content = contentFactory.createContent(jFXPanel, "inspector", false);
toolWindow.getContentManager().addContent(content);
InspectorController sceneInspectorController = new InspectorController();
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/com/basisjs/ui/windows/tools/inspector/InspectorScene.fxml"));
fxmlLoader.setController(sceneInspectorController);
Platform.setImplicitExit(false);
PlatformImpl.runLater(() -> {
try {
Scene scene = new Scene(fxmlLoader.load());
jFXPanel.setScene(scene);
webView = sceneInspectorController.webView;
webView.setContextMenuEnabled(false);
} catch (IOException e) {
e.printStackTrace();
}
});
}
示例5: SwaggerUIViewer
import com.sun.javafx.application.PlatformImpl; //导入依赖的package包/类
public SwaggerUIViewer() {
super(new BorderLayout());
this.setBackground(JBColor.background());
this.setVisible(false);
Platform.setImplicitExit(false);
ApplicationManager
.getApplication()
.invokeLater(() -> PlatformImpl.startup(this::createWebView));
}
示例6: show
import com.sun.javafx.application.PlatformImpl; //导入依赖的package包/类
public void show(final Object frame, final Object panel) {
SwingAWTUtils.setJFrameTitle(frame, title);
final CountDownLatch sync = new CountDownLatch(1);
PlatformImpl.runAndWait(new Runnable() {
public void run() {
fillScene();
SwingAWTUtils.setJFXPanelScene(panel, scene);
SwingAWTUtils.setJFXPanelSize(panel, (int)scene.getWidth(), (int)scene.getHeight());
sync.countDown();
}
});
try {
sync.await();
} catch (InterruptedException ex) {
Logger.getLogger(CombinedTestChooserPresenter.class.getName()).log(Level.SEVERE, null, ex);
}
SwingAWTUtils.finishShow(frame);
}
示例7: emptyPropertyShouldChangeWhenAllPanelsRemovedAndAdded
import com.sun.javafx.application.PlatformImpl; //导入依赖的package包/类
@Test public void emptyPropertyShouldChangeWhenAllPanelsRemovedAndAdded(){
assertThat( systemUnderTest.emptyProperty().get(), is( false ) );
@SuppressWarnings("unchecked")//mockito mocking
ChangeListener< Boolean > emptyListener = mock( ChangeListener.class );
systemUnderTest.emptyProperty().addListener( emptyListener );
configuration.jobPolicies().entrySet().iterator().next().setValue( BuildWallJobPolicy.NeverShow );
PlatformImpl.runAndWait( () -> {} );
verify( emptyListener, times( 0 ) ).changed( systemUnderTest.emptyProperty(), false, true );
configuration.jobPolicies().entrySet().forEach( entry -> entry.setValue( BuildWallJobPolicy.NeverShow ) );
PlatformImpl.runAndWait( () -> {} );
verify( emptyListener ).changed( systemUnderTest.emptyProperty(), false, true );
configuration.jobPolicies().entrySet().iterator().next().setValue( BuildWallJobPolicy.AlwaysShow );
PlatformImpl.runAndWait( () -> {} );
verify( emptyListener ).changed( systemUnderTest.emptyProperty(), true, false );
configuration.jobPolicies().entrySet().forEach( entry -> entry.setValue( BuildWallJobPolicy.AlwaysShow ) );
PlatformImpl.runAndWait( () -> {} );
verify( emptyListener ).changed( systemUnderTest.emptyProperty(), true, false );
}
示例8: createHtmlPane
import com.sun.javafx.application.PlatformImpl; //导入依赖的package包/类
@SuppressWarnings("restriction")
private Tuple<JFXPanel, WebView> createHtmlPane() {
final JFXPanel fxpanel = new JFXPanel();
final AtomicReference<JFXPanel> panelRef = new AtomicReference<JFXPanel>(fxpanel);
final AtomicReference<WebView> viewRef = new AtomicReference<WebView>();
PlatformImpl.runAndWait( () -> {
final WebView webView = new WebView();
fxpanel.setScene(new Scene(webView));
webView.getEngine().setOnError( (evt) -> {
LOGGER.log(Level.WARNING, evt.toString());
});
panelRef.set(fxpanel);
viewRef.set(webView);
});
contentPanel.add(panelRef.get(), HTML_VIEW_ID);
return new Tuple<>(panelRef.get(), viewRef.get());
}
示例9: 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());
});
}
示例10: executeInFXUIThread
import com.sun.javafx.application.PlatformImpl; //导入依赖的package包/类
@FromAnyThread
private void executeInFXUIThread() {
while (true) {
try {
PlatformImpl.runAndWait(fxTask);
break;
} catch (final IllegalStateException e) {
LOGGER.warning(this, e);
ThreadUtils.sleep(1000);
}
}
}
示例11: createApplication
import com.sun.javafx.application.PlatformImpl; //导入依赖的package包/类
@Override
protected void createApplication(Class<Application> appClass) {
PlatformImpl.runAndWait(() ->
{
try {
app = appClass.newInstance();
} catch (Throwable t) {
reportError("Error creating app class", t);
}
});
}
示例12: startSwing
import com.sun.javafx.application.PlatformImpl; //导入依赖的package包/类
public void startSwing(final Object oFrame, final Object panel,
final Scene scene, final String stageName) {
final JFrame frame = (JFrame) oFrame;
final JFXPanel javafxSwingPanel = ((JFXPanel) panel);
this.javafxSwingPanel = javafxSwingPanel;
this.scene = scene;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
SwingAWTUtils.this.frame = frame;
if (stageName != null) {
frame.setTitle(stageName);
}
frame.setName(this.getClass().getSimpleName());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(javafxSwingPanel, BorderLayout.CENTER);
PlatformImpl.runAndWait(new Runnable() {
public void run() {
Utils.setCustomFont(scene);
javafxSwingPanel.setScene(scene);
scene.heightProperty().addListener(new SwingAWTUtils.SwingSizeListener());
scene.widthProperty().addListener(new SwingAWTUtils.SwingSizeListener());;
}
});
frame.setVisible(true);
PlatformImpl.runAndWait(new Runnable() {
public void run() {
javafxSwingPanel.setSize(new Dimension((int) scene.getWidth(), (int) scene.getHeight()));
}
});
frame.pack();
frame.toFront();
frame.requestFocus();
javafxSwingPanel.requestFocus();
frame.setLocation(30, 30);
}
});
}
示例13: changed
import com.sun.javafx.application.PlatformImpl; //导入依赖的package包/类
public void changed(final ObservableValue<? extends Number> ov, final Number t, final Number t1) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
PlatformImpl.runAndWait(new Runnable() {
public void run() {
javafxSwingPanel.setSize(new Dimension((int) scene.getWidth(), (int) scene.getHeight()));
}
});
frame.pack();
}
});
}
示例14: showNotification
import com.sun.javafx.application.PlatformImpl; //导入依赖的package包/类
/**
* Method to show a notification using {@link Notifications} in the correct style.
* @param notification the {@link BuildResultStatusNotification} to show.
* @param notifications the {@link Notifications} to use.
* @param duration the duration to display for.
*/
public void showNotification( BuildResultStatusNotification notification, Notifications notifications, int duration ) {
PlatformImpl.runAndWait( () -> {
notifications
.darkStyle()
.hideAfter( new Duration( duration ) )
.position( Pos.BOTTOM_RIGHT )
.title( NEW_BUILD )
.text( createText( notification ) )
.graphic( createGraphic( notification ) )
.show();
} );
}
示例15: associateWithConfiguration
import com.sun.javafx.application.PlatformImpl; //导入依赖的package包/类
/**
* Constructs a new {@link DualBuildWallConfigurationWindowController}.
* @param configurationWindow the {@link Parent} to show in the window.
*/
public void associateWithConfiguration(
Parent configurationWindow
) {
Scene configurationScene = new Scene( configurationWindow );
PlatformImpl.runAndWait( () -> {
configurationWindowStage = new Stage();
configurationWindowStage.setTitle( CONFIGURATION_WINDOW_TITLE );
configurationWindowStage.setWidth( WIDTH );
configurationWindowStage.setHeight( HEIGHT );
configurationWindowStage.setFullScreen( false );
configurationWindowStage.setScene( configurationScene );
} );
}