当前位置: 首页 > news >正文

网站建设开始学什么策划一个网站策划书

网站建设开始学什么,策划一个网站策划书,跨境电商平台有哪些公司,网站开发工具jsjava-javafx在普通类里如何弹出javafx的弹窗或者窗口 背景代码运行报错解决方法总结参考 背景 想要在一个普通类里弹出一个弹窗 代码 package sample.main;import javafx.application.Application; import javafx.application.Platform; import javafx.embed.swing.JFXPanel… java-javafx在普通类里如何弹出javafx的弹窗或者窗口 背景代码运行报错解决方法总结参考 背景 想要在一个普通类里弹出一个弹窗 代码 package sample.main;import javafx.application.Application; import javafx.application.Platform; import javafx.embed.swing.JFXPanel; import javafx.event.EventHandler; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.input.KeyCode; import javafx.scene.input.KeyEvent; import javafx.stage.Modality; import javafx.stage.Stage; import javafx.stage.StageStyle;import java.io.IOException;public class showAlertMain{public static void main(String[] args) {showWindowAlert(c);}public static void showWindowAlert(String message) {Platform.runLater(new Runnable() {Overridepublic void run() {Stage primaryStage new Stage();Parent root null;FXMLLoader loader new FXMLLoader();try {loader.setLocation(getClass().getResource(/dialog.fxml));root loader.load();Label cc (Label) root.lookup(#mes);cc.setText(message);cc.setStyle(-fx-text-fill:red);Scene scene null;scene new Scene(root);scene.addEventHandler(KeyEvent.KEY_PRESSED, new EventHandlerKeyEvent() {Overridepublic void handle(KeyEvent t) {if (t.getCode() KeyCode.ESCAPE) {Stage sb (Stage) primaryStage.getScene().getWindow();//use any one objectsb.close();}}});primaryStage.initModality(Modality.WINDOW_MODAL);primaryStage.setScene(scene);primaryStage.setFullScreen(true);primaryStage.setFullScreenExitHint();primaryStage.setAlwaysOnTop(true);primaryStage.initStyle(StageStyle.TRANSPARENT);primaryStage.setResizable(false);primaryStage.show();} catch (IOException e) {e.printStackTrace();}}});} } 运行报错 Exception in thread “main” java.lang.IllegalStateException: Toolkit not initialized at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:273) at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:268) at javafx.application.Platform.runLater(Platform.java:86) at sample.main.showAlertMain.showWindowAlert(showAlertMain.java:27) at sample.main.showAlertMain.main(showAlertMain.java:22) 解决方法 在main方法或者初始化方法中调用 new JFXPanel(); package sample.main;import javafx.application.Application; import javafx.application.Platform; import javafx.embed.swing.JFXPanel; import javafx.event.EventHandler; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.input.KeyCode; import javafx.scene.input.KeyEvent; import javafx.stage.Modality; import javafx.stage.Stage; import javafx.stage.StageStyle;import java.io.IOException;public class showAlertMain{public static void main(String[] args) {new JFXPanel();showWindowAlert(c);}public static void showWindowAlert(String message) {Platform.runLater(new Runnable() {Overridepublic void run() {Stage primaryStage new Stage();Parent root null;FXMLLoader loader new FXMLLoader();try {loader.setLocation(getClass().getResource(/dialog.fxml));root loader.load();Label cc (Label) root.lookup(#mes);cc.setText(message);cc.setStyle(-fx-text-fill:red);Scene scene null;scene new Scene(root);scene.addEventHandler(KeyEvent.KEY_PRESSED, new EventHandlerKeyEvent() {Overridepublic void handle(KeyEvent t) {if (t.getCode() KeyCode.ESCAPE) {Stage sb (Stage) primaryStage.getScene().getWindow();//use any one objectsb.close();}}});primaryStage.initModality(Modality.WINDOW_MODAL);primaryStage.setScene(scene);primaryStage.setFullScreen(true);primaryStage.setFullScreenExitHint();primaryStage.setAlwaysOnTop(true);primaryStage.initStyle(StageStyle.TRANSPARENT);primaryStage.setResizable(false);primaryStage.show();} catch (IOException e) {e.printStackTrace();}}});} }总结 方法一、执行前加new JFXPanel()此时不需要继承Application 方法二、继承Application 参考 https://staticfinal.blog/2015/04/04/javafx-toolkit-not-initialized-solved/
http://www.pierceye.com/news/953026/

相关文章:

  • access数据库网站广州建网站哪儿济南兴田德润简介
  • 上海网站建设seo抖音短剧推广怎么做
  • 京东网站建设策划书网站建设常用编程语言
  • 济南教育论坛网站建设page n wordpress
  • 网站域名在山东备案却在苏州产教融合信息门户网站建设方案
  • 南京网站网站建设传奇网页
  • 网站后台更新怎么做详情页怎么设计
  • 网站怎么做导航wordpress付费破解
  • 宁津网站建设国内免费设计素材网站
  • 泰安有口碑的企业建站公司二手汽车手机网站模板
  • 网站百度快照怎么做网站调用谷歌地图
  • 扫描二维码进入公司网站怎样做代做关键词收录排名
  • flash美食网站论文架设一个网站需要多少钱
  • 做教育视频网站用什么平台好wordpress文章 代码块
  • 网站 部署 域名深圳网站建设yuntianxia
  • 做调查的网站推荐移动端网站开发教程
  • 上海品牌网站建设公司排名女生学网络营销这个专业好吗
  • 优质的邵阳网站建设企业邮箱免费登录入口
  • 网站做seo多少钱wordpress点击分类目录空白
  • 黄埔网站建设 信科网络中国企业商铺网
  • 济南快速网站排名网站开发模板系统
  • 厦门市app开发网站建设公司亚马逊雨林在地图上的位置
  • qq空间个人网站网页设计作业个人简历代码怎么写
  • 宁波网站建设团队微信网页制作的软件
  • 社区网站推广方案百度直播推广
  • 上海网站seo诊断吉林网站优化
  • 玉田网站建设做重视频网站
  • 发放淘宝优惠券的网站怎么做网站建设理论依据
  • 信用渭南网站建设做网站实例
  • 南通做百度网站的公司哪家好公司网站建站流程