javafx-8

How to reopen/prevent closing of ControlsFX LoginDialog on failed login?

百般思念 提交于 2019-12-08 07:17:11
问题 In my application, the first I do is request the user to login using the controlsFX LoginDialog. If the login is successful, I display the application, however if it fails the login window will close. I would rather the login window stay open to allow the user to attempt to login again. public void start(Stage stage) throws Exception { LoginDialog ld = new LoginDialog(new Pair<String, String>("", ""), new Callback<Pair<String,String>, Void>() { @Override public Void call(Pair<String, String>

How to use intersect() method of Node Class in JavaFX?

醉酒当歌 提交于 2019-12-08 06:31:49
问题 JavaFX Node class provides two intersect methods: intersects(Bounds localBounds); and intersects(double localX, double localY, double localWidth, double localHeight); When and how can I use these methods? 回答1: as it name tells it is used to determine if a node is intersected with other node or not.. Example : If you're going to develop Zen pong game in javafx ,if ball hits the wall behind paddle then game over. Code : private Circle ball; private Rectangle wall; if(ball.intersects(wall

Is it possible to disable editable table columns on a row basis in JavaFX8?

笑着哭i 提交于 2019-12-08 06:17:17
问题 I have a use case which I would assume is pretty standard, however I haven't been able to find an example on exactly how to do this, or if it's possible. Let's assume I have the following TableView First Name Last Name Street NewRecord Tom Smith Main St. Yes Mike Smith First St. No In this case, the grid should have the first three cells editable since the record is new, however when the record is not new then the Last Name cell should be disabled. I tried this in the CellFactory and

Zooming an Image in ImageView (javafx)

☆樱花仙子☆ 提交于 2019-12-08 05:49:03
问题 I'm trying to zoom with a slider a selected image in ImageView. The only thing that I am able to do is to resize whole ImageView with the image in it. But this is not what i am searching for. I want to zoom only the image with ImageView having the same size. It should be a demonstration of a focal length. I'm using also scene builder.I'm only beginner in all of this, so I would really appreciate your help. Here's what I have. public void openImage(ActionEvent event) { FileChooser fc = new

How to create an inner popup in JavaFX styled with FXML

女生的网名这么多〃 提交于 2019-12-08 05:34:16
问题 I have an FXML file that I'm using to allow user input when requested. Right now I just put it in a new stage and do Stage.show() . I would like to not have it appear in a new window and behave more like a ContextMenu . Looking at ContextMenu class it doesn't appear that I can set the content based off an FXML file. Is there a way to do this either with ContextMenu or Popup or some other class I am unaware of? 回答1: Although that library is quite nice, I wanted something simple that didn't

How to render 3D graphics properly

不问归期 提交于 2019-12-08 05:32:05
问题 I was trying to make a rubiks cube in javafx an ended up with a very bad model as given in this Image. I am giving my source for code for this, where I have used RectangleBuilder class to create rectangles and transformed in 3d. To fix the graphics i had also tried to build the rectangles used TriangleMesh class and after adding materials to them, transformed them in 3d to end up again in the same bad graphics. Why does this occur and how to get rid of it ? import javafx.scene.transform

Updating ProgressBar value within a for loop

笑着哭i 提交于 2019-12-08 05:17:25
问题 I attempted to update a ProgressBar value within a for loop. Its progress should update every 100 miliseconds but unfortunately it didn't work! Here's the code: pb = new ProgressBar(0); Button btn = new Button("Start!"); btn.setOnAction(new EventHandler<ActionEvent>(){ @Override public void handle(ActionEvent event) { for(int i = 0; i <=100; i++){ position = i; Platform.runLater(new Runnable(){ @Override public void run() { pb.setProgress(position); System.out.println("Index: "+position); } }

Breaking recursion from listeners

我只是一个虾纸丫 提交于 2019-12-08 05:13:24
问题 I'm trying to break a special case that makes this code recursive. I have a Javafx game where there are human and computer players each play when it's his turn and there can be many rounds. A computer is supposed to play automatically and move to the next player immediately and show no direct indication to the UI (but it's possible to review what it did afterwards). The problem is in the case where there are only computer players, we will come here the moment the currentBoardPane was loaded,

Remove rectangle from Progress Indicator

你说的曾经没有我的故事 提交于 2019-12-08 04:05:40
问题 I tested Progress Indicator in Java 8u40. I get this visual result when I tried to make simple example. Do you know how I can remove the rectangle borders? 回答1: this works for me with no border or other problems (JDK 1.8.0_20ea): stage.setWidth(100); stage.setHeight(100); BorderPane root = new BorderPane(); ProgressIndicator progress = new ProgressIndicator(); progress.setMaxWidth(50); progress.setMaxHeight(50); root.setCenter(progress); stage.setScene(new Scene(root)); stage.show(); Is this

javafx large image crash

给你一囗甜甜゛ 提交于 2019-12-08 03:39:50
问题 New to JavaFX This example works fine with small images. But a large image crashes ImageView. Is my example code flawed? Is there a problem with large images in JavaFX? Something else? I grab an example from the web: http://www.java2s.com/Code/Java/JavaFX/JavaFXImageZoomExample.htm I download and process a PDF file: http://optics.byu.edu/BYUOpticsBook_2013.pdf gs -sDEVICE=png16m -dNOPAUSE -dBATCH -dSAFER \ -r600 -dFirstPage=1 -dLastPage=1 \ -sOutputFile=001.png BYUOpticsBook_2013.pdf This