javafx

How to avoid collision with the border or with each other by changing the heading i.e. rotate the object

拈花ヽ惹草 提交于 2020-12-21 03:02:39
问题 The task is actually, two cars moving, the cars must be able to avoid collision with the border or with each other by changing the heading for example: rotate the object. ** I got an error for this getRadius() import java.io.FileInputStream; import java.io.FileNotFoundException; import javafx.animation.KeyFrame; import javafx.animation.Timeline; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Bounds; import

JavaFX Dialog对话框

百般思念 提交于 2020-12-20 19:08:37
1. 标准对话框 消息对话框 Alert alert = new Alert(AlertType.INFORMATION); alert.setTitle( "Information Dialog" ); alert.setHeaderText( "Look, an Information Dialog" ); alert.setContentText( "I have a great message for you!" ); alert.showAndWait(); 没有标题的消息对话框 Alert alert = new Alert(AlertType.INFORMATION); alert.setTitle( "Information Dialog" ); alert.setHeaderText( null ); alert.setContentText( "I have a great message for you!" ); alert.showAndWait(); 2. 警告对话框 Alert alert = new Alert(AlertType.WARNING); alert.setTitle( "Warning Dialog" ); alert.setHeaderText( "Look, a Warning Dialog" ); alert

javafx设置控件背景颜色,字体等

依然范特西╮ 提交于 2020-12-16 02:23:01
package fx.com; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.*; import javafx.scene.paint.Paint; import javafx.scene.text.Font; import javafx.stage.Stage; public class Main extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) throws Exception { Button b1 = new Button(); b1.setText("这是按钮"); b1.setLayoutX(100); b1

In javafx how do i change the color of a button, wait 1 second than change it back do default?

≡放荡痞女 提交于 2020-12-15 05:04:21
问题 So i want to change the color of a button to light green, wait 1 second than change it back to default. How can i do this? I tried it this way: button1.setStyle("-fx-background-color: lightgreen"); try { Thread.sleep(1000); } catch(InterruptedException e) {} button1.setStyle(""); But i have 2 problems: the color never sets to light green, only to default. if i want to change it only to light green, it only changes after the 1 second of waiting and not before it. Edit: So i got to the part to

In javafx how do i change the color of a button, wait 1 second than change it back do default?

冷暖自知 提交于 2020-12-15 05:03:07
问题 So i want to change the color of a button to light green, wait 1 second than change it back to default. How can i do this? I tried it this way: button1.setStyle("-fx-background-color: lightgreen"); try { Thread.sleep(1000); } catch(InterruptedException e) {} button1.setStyle(""); But i have 2 problems: the color never sets to light green, only to default. if i want to change it only to light green, it only changes after the 1 second of waiting and not before it. Edit: So i got to the part to

lost in 3D space - tilt values (euler?) from rotation matrix (javafx affine) only works partially

纵然是瞬间 提交于 2020-12-15 04:56:13
问题 it is a while ago that I asked this question: javafx - How to apply yaw, pitch and roll deltas (not euler) to a node in respect to the nodes rotation axes instead of the scene rotation axes? Today I want to ask, how I can get the tilt (fore-back and sideways) relative to the body (not to the room) from the rotation matrix. To make the problem understandable, I took the final code from the fantastic answer of José Pereda and basicly added a method "getEulersFromRotationMatrix". This is working

Internal graphics not initialized yet in JUunit test case

蹲街弑〆低调 提交于 2020-12-14 05:01:10
问题 I'm making a light weight painting application with JavaFx. I've been having some issues with my LayerController class and it's methods addLayer etc. So I thought that writing some JUunit test cases would be a good idea to check the correctness of my methods. To make the story short, I'm painting on a Canvas using its GraphicsContext in a selfmade class which I call PaintGraphics . This class does all the painting. The LayerController needs a PaintGraphics to do its work on the layers. But it

Canvas: hover over text output

给你一囗甜甜゛ 提交于 2020-12-13 04:59:04
问题 I want to hover over a shape I created in Canvas (JavaFx) and when hovering over with the mouse I want a text output pop-up to display. Is there a built in function for this? I can't find how to do it anywhere... 回答1: Unlike with the scene graph, a Canvas has no notion of what it contains. It's nothing but a two-dimensional array of pixels and provides no further distinctions than that. If you want to know if and when the mouse hovers over a "shape" in the Canvas you'll have to keep track of

Canvas: hover over text output

别来无恙 提交于 2020-12-13 04:59:04
问题 I want to hover over a shape I created in Canvas (JavaFx) and when hovering over with the mouse I want a text output pop-up to display. Is there a built in function for this? I can't find how to do it anywhere... 回答1: Unlike with the scene graph, a Canvas has no notion of what it contains. It's nothing but a two-dimensional array of pixels and provides no further distinctions than that. If you want to know if and when the mouse hovers over a "shape" in the Canvas you'll have to keep track of

Java网络编程:实现QQ邮件发送客户端

半腔热情 提交于 2020-12-11 17:46:36
目录 一、目标介绍 1、认识SMTP(邮件传输协议) 2、POP3(邮件接收协议) 二、基于Base64编码邮箱及授权码 1、开通QQ邮箱SMTP/POP3服务 2、Java编写BASE64编码程序 三、telnet命令发送邮件 四、Java图形界面进行SMTP交互发邮件 1、编写客户端类 2、创建QQ邮件发送图形界面 五、总结及下篇预告 一、目标介绍 这篇博文记录学习使用Java实现类似QQ发送邮件的客户端,打算分为上下两篇完成,上篇从零开始学习,认识计算机网络邮件传输协议(SMTP、POP3),并开通QQ邮箱的smtp/pop3服务,为之后程序设计做准备,自行实现简单的Java GUI,通过命令方式发送邮件;下篇基于前面的基础,实现基本完整功能的,类似我们平时QQ邮件发送的客户端,图形化界面简便了发送操作,另外增加了接收服务器反馈信息的功能,以后就可以使用自己写的邮件发送程序给其他人发邮件啦,更快更方便๑乛◡乛๑ 1、认识SMTP( 邮件传输协议 ) SMTP(简单邮件传输协议,RFC821) 是一种提供可靠且有效的 电子邮件传输协议 。SMTP是建立在FTP文件传输服务上的一种邮件服务,主要 用于系统之间的邮件信息传递,并提供有关来信的通知 。 2、POP3(邮件接收协议) POP3,全名为Post Office Protocol - Version 3,即邮局协议版本3