javafx

javafx.controls could not be found JavaFX 11 / JDK 11.0.1

核能气质少年 提交于 2019-12-30 06:33:46
问题 I am using InteliJ, I've gone through all other solutions that seem to work for everybody else. I was getting an error: Caused by: java.lang.IllegalAccessError: class com.sun.javafx.fxml.FXMLLoaderHelper (in unnamed module @0x5782d366) cannot access class com.sun.javafx.util.Utils (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.util to unnamed module @0x5782d366 I then added the following to VM options in the run config: --module-path="C:\Users\mresp

How to extend custom JavaFX components that use FXML

牧云@^-^@ 提交于 2019-12-30 06:08:39
问题 How do I properly extend a custom JavaFX component to add or modify its GUI components if it uses FXML for the view? As an example scenario, suppose I use the following approach of creating a custom JavaFX component: SpecializedButton.java (Controller) package test; import java.io.IOException; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.layout.HBox; public class SpecializedButton extends

JavaFX & FXML: how do I set the default selected item in a ChoiceBox in FXML?

試著忘記壹切 提交于 2019-12-30 06:03:09
问题 I have the following FXML: <ChoiceBox> <items> <FXCollections fx:factory="observableArrayList"> <String fx:value="2 minutes" /> <String fx:value="5 minutes" /> <String fx:value="15 minutes" /> </FXCollections> </items> </ChoiceBox> But in the GUI it just shows a ChoiceBox with a default of nothing. I would like the first element in the list to be the default, and for a choice of "null" or nothing to be prohibited. How do I accomplish this? 回答1: I added the value attribute to the ChoiceBox tag

Javafx 8 Tableview selection with checkbox

﹥>﹥吖頭↗ 提交于 2019-12-30 05:23:09
问题 I've set up a multiselection enabled tableview and am trying to attach a listener a checkbox inserted into a column to the selection model of the table. checkBoxTableColumn.setCellValueFactory( cellData -> { CheckBox checkBox = new CheckBox(); ObjectProperty<CheckBox> sop = new SimpleObjectProperty<CheckBox>(); sop.setValue(checkBox); sop.getValue().setText(""); sop.getValue().selectedProperty().addListener( (obsv, oldv, newv) -> { ArrayList<Job> tempSelectionArray = new ArrayList<>(); if

Starting a second JavaFX Application

落花浮王杯 提交于 2019-12-30 05:08:40
问题 I'm trying to launch a JavaFx application from within a JavaFx application, but it looks like Application.launch() can only be called once. Does this mean I have to start a separate JVM... as in exec("java... or is there another way? More background info. I want my JavaFx app to be able to build and run JavaFx apps. Right now it compiles classes in-memory, loads the classes... it would be really unfortunate to have to resort to writing everything to the filesystem so I can get a jar on the

How to get label.getWidth() in javafx

不羁岁月 提交于 2019-12-30 04:59:28
问题 always when i try to get the width of an Array in Java it just returns 0 and i dont know why. Can somebody explain to me how it is done right? Label label = new Label(); label.setFont(Font.font(label.getFont().getFamily(), 8)); label.setText("" + a[i][j].getList().getFirst().getLength() + " mal " + intToColor(a[i][j].getList().getFirst() .getColor())); label.relocate((x1 + x2) / 2 - label.getWidth() / 2, (y1 + y2) / 2); label.idProperty().set("trackName"); label.setTextFill(Color.web("GREEN")

Pros and Cons of JavaFX and Silverlight [closed]

自古美人都是妖i 提交于 2019-12-30 04:37:11
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 years ago . I know there is already a question about the performance of Flex, JavaFX, and Silverlight. My question is a bit more broad: We are evaluating the merits of JavaFX and Silverlight to serve as the GUI technology that controls/configures our back-end service (currently written

how to locate fxml from another package?

瘦欲@ 提交于 2019-12-30 04:29:05
问题 I have created a simple JavaFX application. It has two packages the main class is JFXTest2.java is in good package and the fxml and it's controller are in JFXTest2 package. now the problem is that i can not load the fxml in the main class. I tried loading the fxml like this: Parent root = FXMLLoader.load(getClass().getResource("jfxtest2.Screen.fxml")); and Parent root = FXMLLoader.load(getClass().getResource("jfxtest2/Screen.fxml")); and also Parent root = FXMLLoader.load(new URL("/jfxtest2

How to access the Scrollbars of a ScrollPane

狂风中的少年 提交于 2019-12-30 03:29:04
问题 I'm trying to get some information about the ScrollBar components that are by standard included in a ScrollPane . Especially i'm interested in reading the height of the horizontal Scrollbar . How can i reference it? 回答1: Since the mentioned methods did not work for everybody (including me), I investigated it a bit more and found the source of the problem. In general, both methods work, but only as soon as the ScrollPane's skin property has been set. In my case, skin was still null after

Java 9 JavaFX Preloader

99封情书 提交于 2019-12-30 03:25:27
问题 In Java 8 I can launch a JavaFX application with a preloader using the following method: LauncherImpl.launchApplication(WindowMain.class, WindowMainPreloader.class, new String[]{...}); I prefer to start it from code, like above, instead of using a deploy configuration, because I don't want the graphical interface to start every time I start the application, but only after some code that has computed that the application should run in GUI mode. I was using the class "com.sun.javafx.application