javafx

How to access UI components from SceneBuilder in JavaFX

不羁岁月 提交于 2020-03-01 01:46:28
问题 (DUPLICATE & SOLVED - see answer below) I'm doing my first steps in JavaFX and it seems quite hard to use the "SceneBuilder". I'm used to Android and the QtCreator. It looks to me that there is accessing the UI components much easier. Something like findViewById(R.id.btnPushMe); <- Android Code Actually I got an solution but it is quite uncomfortable to use. This looks as this: FXMLLoader loader = new FXMLLoader(MainApp.class.getResource("../fmxl/main.fxml")); AnchorPane pane = loader.load();

JavaFX Drag and drop to GridPane?

…衆ロ難τιáo~ 提交于 2020-02-28 15:58:27
问题 I have implemented a drag-and-drop function to my game, but so far I can only "drop" to hard-coded locations. As shown here: What I would like is for either: When the ships is dropped its x,y values (in relation to the GridPane) are saved, or The cell that the ship is dropped to is saved. My setOnDragDropped event is handled here: //Drag dropped draws the image to the receiving node target.setOnDragDropped(new EventHandler<DragEvent>() { public void handle(DragEvent event) { //Data dropped /

JavaFX Drag and drop to GridPane?

十年热恋 提交于 2020-02-28 15:52:00
问题 I have implemented a drag-and-drop function to my game, but so far I can only "drop" to hard-coded locations. As shown here: What I would like is for either: When the ships is dropped its x,y values (in relation to the GridPane) are saved, or The cell that the ship is dropped to is saved. My setOnDragDropped event is handled here: //Drag dropped draws the image to the receiving node target.setOnDragDropped(new EventHandler<DragEvent>() { public void handle(DragEvent event) { //Data dropped /

JavaFX 教程 (中文)

帅比萌擦擦* 提交于 2020-02-27 18:19:44
https://code.makery.ch/zh-cn/library/javafx-tutorial/part3/ JavaFX 8 教程 系列:部署 https://www.yiibai.com/javafx/ JavaFX 8 教程 (中文) code.makery 教程 http://code.makery.ch/library... JavaFX 8 教程 (中文) https://blog.csdn.net/caolaos... JavaFX的扩展控件库ControlsFX介绍 https://blog.csdn.net/qq_2305... 来源: oschina 链接: https://my.oschina.net/u/2963604/blog/3162321

Make a dark mode with JavaFx

岁酱吖の 提交于 2020-02-27 09:13:56
问题 I was wondering if there is an easy way to make a dark mode using JavaFx and CSS. I have a MenuBar with a CheckMenuItem called 'Dark mode' and when I click it I want the scene to become dark and the text to become white. 回答1: Here's mine. (Update) The previous one was too opaque. .root { -fx-accent: #1e74c6; -fx-focus-color: -fx-accent; -fx-base: #373e43; -fx-control-inner-background: derive(-fx-base, 35%); -fx-control-inner-background-alt: -fx-control-inner-background ; } .label{ -fx-text

Make a dark mode with JavaFx

℡╲_俬逩灬. 提交于 2020-02-27 09:12:20
问题 I was wondering if there is an easy way to make a dark mode using JavaFx and CSS. I have a MenuBar with a CheckMenuItem called 'Dark mode' and when I click it I want the scene to become dark and the text to become white. 回答1: Here's mine. (Update) The previous one was too opaque. .root { -fx-accent: #1e74c6; -fx-focus-color: -fx-accent; -fx-base: #373e43; -fx-control-inner-background: derive(-fx-base, 35%); -fx-control-inner-background-alt: -fx-control-inner-background ; } .label{ -fx-text

javaFX项目中成功启动了AOP

痞子三分冷 提交于 2020-02-27 02:34:47
在我的 帖子 中说了javafx项目不能在按钮的事件上启用AOP,今天终于解决了这个问题: 1)项目目录截图: 2)pom.xml主要内容: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId> </dependency> <dependency> <groupId>de.roskenet</groupId> <artifactId>springboot-javafx-support</artifactId> <version>2.1.6</version> </dependency> 3)其它各aspect切面类,controller和View及fxml内容分别如下: @FXMLController public class HelloController { Logger logger = LoggerFactory. getLogger (HelloController. class ) ; public void btnclickOnAction () { logger .info( "HelloworldView ===btnclickOnAction" ) ; System. out .println(

github上springboot与javafx整合

自闭症网瘾萝莉.ら 提交于 2020-02-26 17:13:24
https://github.com/roskenet/springboot-javafx-support springboot-javafx-support Attention: The current master is for Spring Boot 2 and Spring Framework 5. The latest production ready releases: For Spring Boot 1.5.x is 1.4.5. (End of life!) For Spring Boot 2.x is 2.1.6. Spring Boot and JavaFx - A perfect match! You will need at least JDK1.8 patch level 40. !!! Currently not available... Server crashed! Find a step-by-step example here: https://www.felixroske.de/page/programmierung/index.html !!! And a bunch of examples here: https://github.com/roskenet/spring-javafx-examples/ 中文相关帖子:#

javaFX在一个按钮的事件中显示另一个窗体

懵懂的女人 提交于 2020-02-26 11:44:15
第一个窗体的按钮事件: @FXML protected void show2Action() throws IOException { Stage stage = new Stage(); AnchorPane pane = FXMLLoader.load(getClass().getResource("javafxcontroller2.fxml")); Scene scene = new Scene(pane,300,400); stage.setScene(scene); stage.show(); } 代码很简单,第二个窗体的fxml文件: <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.control.Button?> <?import javafx.scene.control.Label?> <?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.ColumnConstraints?> <?import javafx.scene.layout.GridPane?> <?import javafx.scene.layout.RowConstraints?> <AnchorPane fx:id=

Java class文件分析工具 -- Classpy

心不动则不痛 提交于 2020-02-26 08:25:04
《自己动手写Java虚拟机》的作者的文章 博客如下 https://blog.csdn.net/zxhoo/article/details/38709965 Classpy Classpy是一个图形化的class文件分析工具,功能和javap类似,界面主要参考了Java Class Viewer: 为什么要重新创造轮子? 写这个工具花了将近一周的时间,那么为什么要浪费时间重新发明一个轮子呢?主要是因为下面几点原因: 通过自己写一个class解析器,可以彻底理解class文件格式和字节码 尝鲜Java8和JavaFX8 Java Class Viewer比较老,不支持新的class文件格式 可以结合javap和Java Class Viewer的优点,取长补短,开发出一个自己心目中的class文件分析工具 体验一下阅读JVM规范的痛苦 功能和特点 Classpy的主要功能和特点是: 可以分析最新的JVM8规范规定的class文件格式 分别用树形控件和HEX字符串来展示class结构 当点击树的节点时,高亮相应的HEX字符串 下载和运行Classpy 可以克隆Gradle项目自己编译,也可以下载可执行jar双击运行。但是注意,需要Java8环境! 广告 :) 如果对class文件和Java虚拟机感兴趣,可以关注这本书。 ———————————————— 版权声明:本文为CSDN博主