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


Java PlatformImpl类代码示例

本文整理汇总了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));
	});
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:19,代码来源:ActivityTreeViewSample.java

示例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);
		}
	});
}
 
开发者ID:thibaultcha,项目名称:TweetStats,代码行数:20,代码来源:MapView.java

示例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();
    });
}
 
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:22,代码来源:AppManager.java

示例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();
        }
    });
}
 
开发者ID:smelukov,项目名称:intellij-basisjs-plugin,代码行数:26,代码来源:InspectorWindow.java

示例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));
}
 
开发者ID:zalando,项目名称:intellij-swagger,代码行数:11,代码来源:SwaggerUIViewer.java

示例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);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:22,代码来源:CombinedTestChooserPresenter.java

示例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 );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:25,代码来源:GridWallImplTest.java

示例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());
}
 
开发者ID:phon-ca,项目名称:phon,代码行数:21,代码来源:BufferPanel.java

示例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());
    });
}
 
开发者ID:TRUEJASONFANS,项目名称:JavaFX-FrameRateMeter,代码行数:34,代码来源:OldFXCanvas.java

示例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);
        }
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:13,代码来源:FXEditorTaskExecutor.java

示例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);
        }
    });
}
 
开发者ID:edvin,项目名称:fxlauncher,代码行数:12,代码来源:Launcher.java

示例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);
        }
    });
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:38,代码来源:SwingAWTUtils.java

示例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();
        }
    });
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:13,代码来源:SwingAWTUtils.java

示例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();
   } );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:19,代码来源:BuildResultStatusDesktopNotification.java

示例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 );
      } );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:18,代码来源:PreferenceWindowController.java


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