JavaFX-Platform&Screen
1Platform常用方法有exit()、runlater()、isSupported()
exit():
Stage stage = new Stage();
Stage stage1 = new Stage();
Stage stage2 = new Stage();
stage.show();
stage1.show();
stage2.show();
Platform.exit ();//退出所有的界面
runLater():
System.out.println("Runnable外的线程 "+Thread.currentThread().getName());
//Runnable外的线程 JavaFX Application Thread
Platform.runLater(new Runnable() {
@Override
public void run() {
while(true){
try {
Thread.sleep(1000);
System.out.println("Runnable内的线程"+Thread.currentThread().getName());
//Runnable内的线程JavaFX Application Thread
}catch (InterruptedException e){
}
}}
});System.out.println("123");//先执行Runnable外的然后再执行Runnnable里的
isSupported():
Platform.isSupported(ConditionalFeature.CONTROLS);//检测是否具有运行该控件的环境
Screen:主要的方法是查看屏幕硬件参数:
//getPrimary()返回主屏幕
System.out.println("实际屏幕宽度:"+Screen.getPrimary().getBounds().getWidth());
System.out.println("实际屏幕高度:"+Screen.getPrimary().getBounds().getHeight());
//以左上角为X=0,Y=0 Y向下递增 X向右递增
System.out.println("屏幕最小X:"+Screen.getPrimary().getBounds().getMinX()+
"屏幕最大X:"+Screen.getPrimary().getBounds().getMaxX());
System.out.println("屏幕最小Y:"+Screen.getPrimary().getBounds().getMinY()+
"屏幕最大Y:"+Screen.getPrimary().getBounds().getMaxY());
System.out.println("可见屏幕高度:"+Screen.getPrimary().getVisualBounds().getHeight());
System.out.println("可见屏幕高度:"+Screen.getPrimary().getVisualBounds().getHeight());
System.out.println("可见屏幕最小X:"+Screen.getPrimary().getVisualBounds().getMinX()+
"可见屏幕最大X:"+Screen.getPrimary().getVisualBounds().getMaxX());
System.out.println("可见屏幕最小Y:"+Screen.getPrimary().getVisualBounds().getMinY()+
"可见屏幕最大Y:"+Screen.getPrimary().getVisualBounds().getMaxY());
System.out.println("屏幕DPI:"+Screen.getPrimary().getDpi());
System.out.println("屏幕列表:"+Screen.getScreens());
补充:Platform的setImplictExit()方法用于设置当界面关闭时程序是否终止
Platform.setImplicitExit(false);//即界面关闭时程序不会终止 Platform.setImpliatExit(true);//界面关闭时程序终止
JavaFX-Platform&Screen的更多相关文章
- (转) [it-ebooks]电子书列表
[it-ebooks]电子书列表 [2014]: Learning Objective-C by Developing iPhone Games || Leverage Xcode and Obj ...
- Styling FX Buttons with CSS
http://fxexperience.com/2011/12/styling-fx-buttons-with-css/ ——————————————————————————————————————— ...
- 【转】Android4.4 之Bluetooth整理
原文网址:http://www.cnblogs.com/shed/p/3737016.html Android 4.4上蓝牙协议栈采用的是BRCM和Google共同开发的bluedroid,代替了之前 ...
- Delphi 10.2 Tokyo的新特性
Delphi 10.2(Tokyo)出来一段时间了,最重要的新特性就是支持Linux的服务端. 官网有详细的介绍: 这里是主要的特性介绍:https://www.embarcadero.com/pro ...
- Customize Netbeans Platform Splash Screen and About Dialog
原帖一直打不开,通过谷歌翻译找到的 http://blogs.kiyut.com/tonny/2007/10/18/customize-netbeans-platform-splash-screen- ...
- javafx笔记----非javafx线程Platform.runLater赋值不生效情况
Platform.runLater(() -> { // }); Platform.runLater一些情况下没有赋值到fx页面上 采用task方式 Task<SB> task = ...
- A JavaFX based Game Authoring System
http://www.mirkosertic.de/doku.php/javastuff/javafxgameauthoring ——————————————————————————————————— ...
- JavaFx客户端服务器C/S架构搭建
客户端获取服务器端软件更新版本方法: package com.platform.ui.update; import java.io.BufferedInputStream; import java.i ...
- android platform下载地址
大陆直接访问Android的光放网站一般情况下比较困难,特此列出了Android各个SDK版本的直接下载地址. ADT 23.0.4:https://dl.google.com/android/ADT ...
随机推荐
- Urozero Autumn 2016. NCPC 2016
A. Artwork 倒过来并查集维护即可. #include<cstdio> #include<algorithm> using namespace std; const i ...
- 【C语言程序】法雷数列
对任意给定的一个自然数n,将分母小于等于n的不可约的真分数按升序排列,并且在第一个分数之前加上0/1,在最后一个分数之后加上1/1,这个序列称为n级法雷数列,以Fn表示.如F5为:0/1,1/5, 1 ...
- SpringCloud中之Ribbon实现负载均衡
之前都不能够理解负载均衡,不知道其怎么实现.现在学习了ribbon后,知道了可以开启多个服务实例,那么选择其中一个服务实例的策略就是负载均衡了,感觉还是很神奇的.
- JBPM工作流(八)——流程实例(PI)Process Instance
/** * 流程实例 * * 启动流程实例 * * 完成任务 * * 查询 * * 查询流程实例 * * 查询任务 * * 查询正在 ...
- Unity进阶----AssetBundle_02(加载依赖关系及网络资源)(2018/10/31)
网络资源加载: string path ="file://"+ Application.streamingAssetsPath + "\\windows\\123&quo ...
- C语言面试题分类->宏定义
1.写一个“标准”宏,这个宏输入两个参数并返回较小的一个 答:#define MIN(x, y) ((x)<(y)?(x):(y))//注意x,y要加括号,因为x,y如果有复合运算会出现问题. ...
- Lecture4_1&4_2.多维随机变量及其概率分布
1.二维随机变量(X,Y)的联合分布函数: F(x,y)=P(X≤x,Y≤y) 2.二维随机变量(X,Y)关于X的边缘分布函数: FX(x)=P(X≤x) =P(X≤x,Y<+∞) =F(x,+ ...
- 反射RelectionDemo
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threa ...
- Multi-Projector Based Display Code ---- FAQ
Frequently Asked Question How do I know that my camera has a proper lens? Answer: If you can see exa ...
- 长连接锁服务优化实践 C10K问题 nodejs的内部构造 limits.conf文件修改 sysctl.conf文件修改
小结: 1. 当文件句柄数目超过 10 之后,epoll 性能将优于 select 和 poll:当文件句柄数目达到 10K 的时候,epoll 已经超过 select 和 poll 两个数量级. 2 ...