javafx

JavaFX Adding Rows to TableView on Different Page

半腔热情 提交于 2019-12-25 06:08:06
问题 Okay, I've been working through some issues with this program and I think I've finally gotten it to a point where I understand what is wrong. I'm trying to follow this tutorial a bit: http://docs.oracle.com/javafx/2/fxml_get_started/fxml_tutorial_intermediate.htm But my program has the add a row on a different FXML page than the Table View is on. I think the program is having trouble connecting the two. I've looked in to trying to find ways to make them talk to each other (put everything in

Calling `setOnAction` from another class

青春壹個敷衍的年華 提交于 2019-12-25 06:07:39
问题 When adding a JavaFX button by code, how can I call the .setOnAction method of the button from another class. For instance, if I was to handle the button press within the same class: public class SomeClass{ Button continueButton = new Button("Continue"); continueButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { someMethod(); } }); } However if I wish to utilise a controller for this, how can 'link' the actionEvent to a method within the

JavaFX dynamic TableView is not showing data from the database

ε祈祈猫儿з 提交于 2019-12-25 06:07:25
问题 I've created a TableView using Scene Builder as follows- Here is the FXML code- <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.control.*?> <?import java.lang.*?> <?import javafx.scene.layout.*?> <Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="508.0" prefWidth="483.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="imran.jfx.application.Controller"> <children> <TableView fx:id=

A javafx stage with a transparent background and decorations

你。 提交于 2019-12-25 05:55:08
问题 I'd like to create a simple protactor in javafx. To that aim, I need to create a stage with a transparent backgrount but WITH decorations. I mean : I still want to be able to move my window or close it when finished. I tried to use those properties : stage.initStyle(StageStyle.TRANSPARENT); But all the window disappear : the background AND the decoration. I also tried to use : stage.setOpacity(0.9); In that case, all the window, background and decoration is partially translucent and that's

How to add css to a JavaFx element

好久不见. 提交于 2019-12-25 05:47:08
问题 I'm trying to add a an external .css file to a Java FX scene graph as follows: File f = new File("../theming/css/test.css"); scene.getStylesheets().clear(); scene.getStylesheets().add("file:///" + f.getAbsolutePath().replace("\\", "/")); test.css .custom-background { -fx-background-color: #1d1d1d; -fx-background-color: red; -fx-padding: 15; -fx-spacing: 10; } .label { -fx-font-size: 11pt; -fx-font-family: "Segoe UI Semibold"; -fx-text-fill: white; -fx-opacity: 0.6; } The style classes get

JavaFX: Add an image to the GridPane

你。 提交于 2019-12-25 05:14:24
问题 I want to put an Image into a GridPane. The URI ist existant, I imported javafx.scene.image, I declared everything. Why does it not work? It just gives me a blank window. Even with a local picture its not working. And when I for example write something like "file:sdhasidf.png" (Not existant btw.), its just a blank window, too. I'm just getting a UnknownProtocol Exception if I mess up the protocol, so it gets loaded. Image img = new Image("https://cdn.discordapp.com/attachments

JavaFX: Add an image to the GridPane

痴心易碎 提交于 2019-12-25 05:14:03
问题 I want to put an Image into a GridPane. The URI ist existant, I imported javafx.scene.image, I declared everything. Why does it not work? It just gives me a blank window. Even with a local picture its not working. And when I for example write something like "file:sdhasidf.png" (Not existant btw.), its just a blank window, too. I'm just getting a UnknownProtocol Exception if I mess up the protocol, so it gets loaded. Image img = new Image("https://cdn.discordapp.com/attachments

JavaFX - Can't add the Scene Builder to Intellij idea 2016

[亡魂溺海] 提交于 2019-12-25 05:09:53
问题 I'm trying to add Scene Builder to Intellij idea 2016 by following this answer but I just see this: my current solution is by opening it in standalone Scene Builder. 回答1: IntelliJ built-in Scene Builder uses the standalone Scene Builder you have installed in your machine by scanning its Java folder, looking for the dist.jar . It is recommended having the latest version of Scene Builder installed. I've just tried IntelliJ 2016.1.1 with Gluon's Scene Builder 8.1.1 and it works normally, given

JavaFX: Adding a new tab from a tab controller

筅森魡賤 提交于 2019-12-25 05:05:36
问题 I am trying to make it such that I can create a new tab for my TabPane from within another tab but I am having some difficulty. Currently I have the TabPane set up in the "main-window.fxml" with the corresponding MainWindowController. I have a tab within this TabPane which, via fx:include, displays "mainTab.fxml" to the scene graph, controlled by MainTabController. Now from within the "mainTab" I want a button to be able to add an additional tab to the TabPane, but since this is requires a

Java FX change label in previous stage

巧了我就是萌 提交于 2019-12-25 05:01:49
问题 I have pretty simple application (i just want to understand controller switching mechanism). First window shows label and button. When you click the button, another window with button will show. Now when you click this second button, Label in first window should change. I have read some posts here, also tried this one Java FX change Label text in a previous stage scene, however, with no success. If you could explain it to me on this simple example, maybe i will be able to better understand