javafx-8

scene.lookup() returns null if i search my VBox

て烟熏妆下的殇ゞ 提交于 2019-12-24 04:32:04
问题 Basically, i need to retrieve a VBox from an fxml file and i'm using scene.lookup. But if i search for it, it just crashes with a NullPointerException. So i tried to print what scene.lookup() finds, and it just finds null (duh), but i can't understand why. This is my Main class: public class Main extends Application { @Override public void start(Stage stage) throws Exception{ FXMLLoader loader = new FXMLLoader(getClass().getResource("MainWindow.fxml")); Parent root = loader.load(); Scene

scene.lookup() returns null if i search my VBox

本小妞迷上赌 提交于 2019-12-24 04:31:24
问题 Basically, i need to retrieve a VBox from an fxml file and i'm using scene.lookup. But if i search for it, it just crashes with a NullPointerException. So i tried to print what scene.lookup() finds, and it just finds null (duh), but i can't understand why. This is my Main class: public class Main extends Application { @Override public void start(Stage stage) throws Exception{ FXMLLoader loader = new FXMLLoader(getClass().getResource("MainWindow.fxml")); Parent root = loader.load(); Scene

How does bound in local and bound in parent works in AnchorPane and StackPane?

北城以北 提交于 2019-12-24 04:19:32
问题 This question is an extension of the below question: How to implement collision detection on nodes which are in StackPane (in JavaFX)?. After implementing the answer given in the above question it seems bound in local and bound in parent are same in AnchorPane but they are different in StackPane. Please let me know the actual behaviour of the bounds of a node with respect to AnchorPane and StackPane. 来源: https://stackoverflow.com/questions/21430787/how-does-bound-in-local-and-bound-in-parent

WebEngine is not loading files linked in HTML (javafx)

╄→尐↘猪︶ㄣ 提交于 2019-12-24 03:54:10
问题 Here is the <head> tag of content.html : <head> <title>TODO supply a title</title> <meta charset="UTF-8"> <script type="text/javascript" src="codemirror.js"></script> <link rel="stylesheet" href="codemirror.css"> <script type="text/javascript" src="matchbrackets.js"></script> <script type="text/javascript" src="closebrackets.js"></script> <script type="text/javascript" src="expression.js"></script> <style> .right { text-align: right; } </style> </head> File is loaded via: view.getEngine()

JavaFX TableView click sorters not working?

别等时光非礼了梦想. 提交于 2019-12-24 03:26:03
问题 Why is my TableColumn.setSortable() showing the sort graphic on the table header when I double-click on it, but it is not actually doing any sort at all? I would imagine it naturally knows how to sort Numbers? Do I have to set an explicit comparator even for types that have a natural sort behavior? public class PenaltyDashboardManager { private final TableView<Penalty> penaltyTable = new TableView<Penalty>(); /* ... */ private void initializeTable() { penaltyTable.setItems(Penalty

FXMLLoader get controller returns null

给你一囗甜甜゛ 提交于 2019-12-24 02:25:10
问题 I have a recursive case of FXML loading needed here. If I choose to View an Objective, it takes me to another instance of the screen that loads a list of Strategy objects. If I choose to view a Strategy, it takes me to another instance of the screen that loads a list of Tactic objects. If I view a Tactic, it takes me to another instance of the screen that loads a list of Task objects. Naturally, I decided to use a base controller class, ViewChildItemController to handle inheritance. Then I

How can i pass value from one page to another in Java FX

亡梦爱人 提交于 2019-12-24 02:24:08
问题 Can someone suggest ,how can we pass the value from one controller to another controller . My scenario is below I need to get the username on my home page after login. please share the piece of code. Thanks in Advance!!! 回答1: As I understood from your question, you need a login screen and then other screens in a row for navigation. First user has to sign in and after validating then the user information will go to the Home screen. Below is the codes which may help you - Main.java package

JavaFX 8 scroll bar css

六月ゝ 毕业季﹏ 提交于 2019-12-24 02:17:18
问题 I am using the following css to customize my scrollbars /* The main scrollbar **track** CSS class */ .workspace-grid .scroll-bar:horizontal .track, .workspace-grid .scroll-bar:vertical .track{ -fx-background-color:transparent; -fx-border-color:transparent; -fx-background-radius: 0em; -fx-border-radius:2em; } /* The increment and decrement button CSS class of scrollbar */ .workspace-grid .scroll-bar:horizontal .increment-button , .workspace-grid .scroll-bar:horizontal .decrement-button { -fx

Select and Move Canvas image with MouseEvent and MouseClicked in JavaFX

冷暖自知 提交于 2019-12-24 01:06:40
问题 I have this example of an application that draws pictures with GraphicsContext and works as shown in the pictures below. And the question is to select and move only the blue circle horizontally with Canvas MouseEvent and MouseClicked public class JavaFXTest extends Application { @Override public void start(Stage primaryStage) { Group root = new Group(); Canvas canvas = new Canvas(300,100); GraphicsContext gc = canvas.getGraphicsContext2D(); Stop[] stops; LinearGradient gradient; // outer

JavaFX development with just JavaScript (Nashorn)

戏子无情 提交于 2019-12-24 00:59:12
问题 Is there a way to write a JavaFX app with just JavaScript files now that Nashorn is available in Java 8? Where can I find more info or videos on this? How would you compile it? Or is there a minimal set of bootstrapping files required? 回答1: Yes, you can develop JavaFX programs with just JavaScript (Nashorn). How to access JavaFX from JavaScript Use the jjs -fx yourscript.js command line switch. The -fx flag on jjs will bootstrap scripts using a javafx.application.Application. There is no