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 ...
随机推荐
- Ubuntu12.04 LTS 32位 安装ns-2.35
ubuntu12.04lts 32-bit默认采用gcc 4.6和g++4.6,而ns的最新版本ns 2.3.5也采用了相同到版本,所以这方面不会有版本不同到问题 收回上面这句话..../valida ...
- ElasticSearch 6.4.3 启动报错: [Cannot assign requested address: bind]
今天在本地搭建一个测试用的最新版ElasticSearch6.4.3 的环境时,遇到一个报: [Cannot assign requested address: bind]的错误. 错误日志内容如下: ...
- Do-Now—团队冲刺博客四
各个成员今日完成的任务 侯泽洋:完成奖励页面设计,完成奖励从云端拉取到本地:完成奖励从云端拉取到本地 周亚杰:冲刺博客,个人中心设计(未完成) 王志伟:积分页面设计:积分页面设计 仇夏:树苗成长过程设 ...
- css 元素溢出
css元素溢出: 当子元素的尺寸超过父元素的尺寸时,需要设置父元素显示溢出的子元素的方式,设置的方法是通过overflow属性来设置. overflow的设置项: (1)visible 默认值 内容不 ...
- AWS Nginx Started but not Serving AWS上Nginx服务器无法正常工作
After install the Nginx on AWS instance, and visit your public ip address, you might see the followi ...
- Educational Codeforces Round 7
622A - Infinite Sequence 20171123 暴力枚举\(n\)在哪个区间即可,时间复杂度为\(O(\sqrt{n})\) #include<stdlib.h> ...
- 【ASP.NET】Validation 服务器控件
Validation 服务器控件 Validation 服务器控件用于验证输入控件的数据.如果数据未通过验证,则向用户显示错误消息. 创建 Validation 服务器控件的语法是: <asp: ...
- ASP.NET Core 从 gitlab-ci 环境变量读取配置
最近在加强持续集成,遇到一个场景需要通过 gitlab-ci 环境变量(Settings -> Settings -> CI/CD -> Variables )在持续集成时向 ASP ...
- CentOS7安装MySQL并允许远程登录
下载 mysql 源安装包 $ curl -LO http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm 安装 mys ...
- UIPullRefreshFlash模块demo示例
UIPullRefreshFlash 模块概述:UIPullRefreshFlash模块对引擎新推出的下拉刷新接口进行了一层封装,app可以通过此模块来实现带炫酷动画效果的下拉刷新功能.使用此模块,在 ...