fxml

Text on java fx menu bar

独自空忆成欢 提交于 2019-12-24 00:35:17
问题 I'm writing app using JavaFx with fxml file for view. How can I add text on right side of menu (like on attached picture). Scene Builder allows me to add only Menu, but then the text is on the left (where the white box is) and I must disable this menu (because it is not menu). I also wanted to change the style of this menu, but it is not working. It is possible for only one menu?. My fxml: <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.control.Menu?> <?import javafx.scene

Text on java fx menu bar

六眼飞鱼酱① 提交于 2019-12-24 00:18:51
问题 I'm writing app using JavaFx with fxml file for view. How can I add text on right side of menu (like on attached picture). Scene Builder allows me to add only Menu, but then the text is on the left (where the white box is) and I must disable this menu (because it is not menu). I also wanted to change the style of this menu, but it is not working. It is possible for only one menu?. My fxml: <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.control.Menu?> <?import javafx.scene

FXML, script tag and initialize method

限于喜欢 提交于 2019-12-23 22:59:47
问题 I am testing and discovering JavaFX. In JavaFX FXML documentation about controllers, it is said that if the controller has a public void initialize() method, it is called once the FXML graph is loaded. Is it possible to do something similar, but from the FXML file in a script way? I tried something like that, but initialize() is not called at all. <?xml version="1.0" encoding="UTF-8"?> <?language javascript?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.AnchorPane?>

javafx jar builds fine but doesn't open

南楼画角 提交于 2019-12-23 21:14:16
问题 So i created a javafx project, it has 3 packages, application, controller, and an images package that holds all the images im using. The program runs fine if i just compile and run, no errors. However, when i create a jar from it, by selecting the build.fxbuild, everything goes smoothly and it tells me it is successful but when i try to double click the jar file nothing opens but java starts running in the background until i force close it. Im running OSX yosemite, and im on java 1.8 if that

Scene builder removes imports in fxml file

爷,独闯天下 提交于 2019-12-23 18:03:52
问题 I use scene builder (Gluon Scene Builder - JavaFX Scene Builder 8.1.1) to create the UI of my application and develop JavaFX with Eclipse. Now... every time I save something in scene builder it removes the imports of my own classes from the fxml file. Is there a way to tell scene builder that those classes belong to the project to avoid this behavior? 回答1: In order for SceneBuilder to deal with custom controls, you need to add the jar with your classes, so it can be loaded in its classpath.

Is it possible to use arithmetic expression in FXML?

最后都变了- 提交于 2019-12-23 16:27:19
问题 I hoped for a feature that would allow me to work with numbers inside the FXML. For example, tried to define the height of one element to be equal to a constant and the height of the second element to be equal to the same constant*2. Is it possible to do it in FXML at all or do I need to do this part of view build-up inside the controler (which I would like to avoid)? 回答1: Yes, it is possible: <?import java.lang.Double?> ... <fx:define> <Double fx:id="xHeight" fx:value="100" /> </fx:define> .

Javafx button sending arguments to ActionEvent function

可紊 提交于 2019-12-23 12:42:59
问题 I'm learning how to use javafx, along with scenebuilder by creating a very basic calculator but I've come across a problem where it's hard for me to find a way to not have a seperate function for each button. I need to know if there's a way for a button to change a variable or give arguments to the action event method that the button is linked to so I don't need seperate methods for each button to call another function. This is an example of what I'm working with. @FXML private Button one;

Setting TableView generic type from FXML?

℡╲_俬逩灬. 提交于 2019-12-23 09:59:44
问题 The TableView class of JavaFX 2.2 has a generic type S , I am wondering how one can set this from FXML? 回答1: The same happens to a ListView or ComboBox. But I think that in the FXML file you are defining the controls and you are defining a generic ListView or a ComboBox or TableView or whatever. No matter what they are going to show. So to me it makes more sense to set the generic type in the JavaFX controller class, instead of in the FXML file. Hope it helps. 回答2: FXML is dynamically loaded

javafx & fxml: how do I apply a border to a pane or label in my gui?

纵然是瞬间 提交于 2019-12-23 09:15:56
问题 I'm just getting into using fxml and it seems like a really cool idea, except for the fact that I'm having a tough time getting it to work. Supposedly I'm able to lay out my GUI using a nice markup language, and I can style the elements via CSS. So I have a label on my GUI, and I would like there to be a solid black border around it, with width=1. Seems like this should be straightforward -- adapting examples I see here and there in tutorials, etc., I do the following: <Label text="sample

Java FX change Label text in a previous stage scene

别等时光非礼了梦想. 提交于 2019-12-23 05:17:06
问题 I have a Main class starting my application which has its MainController class specified in fxml. When clicking on Connect button another windows with different scene and controller is opened. Based on action I would like to change Label text value through my MainController , but it does not work as expected. See details below. Basically I would like to update text on connectedLabel in MainController class from ConnectController class and it does not work. Main.java : public class Main