javafx-2

How do I scroll to a certain component in Java FX?

拜拜、爱过 提交于 2020-04-07 01:23:40
问题 I need to scroll down to a certain label component in Java FX. How do I do that ? I have ids attached to label component. <ScrollPane> <VBox fx:id="menuItemsBox"> <Label text="....."/> <Label text="....."/> <Label text="....."/> .... <Label text="....."/> </VBox> </ScrollPane> 回答1: You can set the scrollPane's vValue to the Node's LayoutY value. Since the setVvlaue() accepts value between 0.0 to 1.0 , you need to have computation to range your input according to it. scrollPane.setVvalue(/

How do I scroll to a certain component in Java FX?

萝らか妹 提交于 2020-04-07 01:20:28
问题 I need to scroll down to a certain label component in Java FX. How do I do that ? I have ids attached to label component. <ScrollPane> <VBox fx:id="menuItemsBox"> <Label text="....."/> <Label text="....."/> <Label text="....."/> .... <Label text="....."/> </VBox> </ScrollPane> 回答1: You can set the scrollPane's vValue to the Node's LayoutY value. Since the setVvlaue() accepts value between 0.0 to 1.0 , you need to have computation to range your input according to it. scrollPane.setVvalue(/

JavaFX Adding a MouseEvent to a bar inside of a BarChart

非 Y 不嫁゛ 提交于 2020-03-26 06:43:11
问题 So i am trying to create an application that has values on a chart, which shows normally. However i am also trying to add a mouse event that is called when i click on a particular bar of the bar graph. More specifically it updates a status bar with some more detail pulled from the database. Group root = new Group(); String[] years = {"Opened", "Closed", "Still Opened"}; CategoryAxis xAxis = new CategoryAxis(); xAxis.setCategories(FXCollections.observableArrayList(years)); NumberAxis yAxis =

javafx resource cannot be loaded when running from jar

陌路散爱 提交于 2020-02-24 09:23:05
问题 The application runs well when I attempt to run with the IntelliJ IDEA build and run button. But after I have build the project into an executable javafx jar artifact and attempted to run from the commandline with java -jar AppName.jar it shows the following error : Exception in Application start method java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at

How to reference android.jar in Gluon Project

丶灬走出姿态 提交于 2020-02-24 05:15:47
问题 Above is my Gluon project to deploy JavaFX on Android. My problem is that I cant reference the android.jar. How to resolve this? build.gradle buildscript { repositories { jcenter() } dependencies { classpath 'org.javafxports:jfxmobile-plugin:1.0.0-b9' } } apply plugin: 'org.javafxports.jfxmobile' repositories { jcenter() } mainClassName = 'com.raes.Main' jfxmobile { android { manifest = 'src/android/AndroidManifest.xml' } ios { infoPList = file('src/ios/Default-Info.plist') } } 回答1: When you

JavaFX integration in Swing

[亡魂溺海] 提交于 2020-02-12 05:24:45
问题 I'm new to using JavaFX and I'm having some issues figuring out how to integrate an fxml file, in my swing application. Reading online I've found a way to load the fxml file,and displaying it on screen following this guide: Integrating JavaFX into Swing Applications what my code is supposed to do is to load the fxml file, that I've started to design with JavaFX Scene Builder, add the JFXPanel to a JPanel, and return it through a method call. this then gets added to a tabbedPanel in the main

How to open a new tab first when open new tab

 ̄綄美尐妖づ 提交于 2020-02-08 06:54:32
问题 I have a JavaFX TabPane in which I add new tabs dynamically when I click on a tree node. tabPane.getTabs().add(tab); tabPane.getSelectionModel().select(tab); Can you tell me how I can open a new tab and place it always first before the other tabs. 回答1: Try: tabPane.getTabs().add(0, tab); http://docs.oracle.com/javase/7/docs/api/java/util/List.html#add%28int,%20E%29 来源: https://stackoverflow.com/questions/17360079/how-to-open-a-new-tab-first-when-open-new-tab

How to open a new tab first when open new tab

天涯浪子 提交于 2020-02-08 06:54:12
问题 I have a JavaFX TabPane in which I add new tabs dynamically when I click on a tree node. tabPane.getTabs().add(tab); tabPane.getSelectionModel().select(tab); Can you tell me how I can open a new tab and place it always first before the other tabs. 回答1: Try: tabPane.getTabs().add(0, tab); http://docs.oracle.com/javase/7/docs/api/java/util/List.html#add%28int,%20E%29 来源: https://stackoverflow.com/questions/17360079/how-to-open-a-new-tab-first-when-open-new-tab

How to get a sharp image of a node

旧时模样 提交于 2020-02-07 03:57:08
问题 I use the following code to generate an image of a node and add it with an ImageView to my Scene: SnapshotParameters snapParams = new SnapshotParameters(); snapParams.setFill(Color.TRANSPARENT); this.dragImage = new ImageView(draggable.snapshot(snapParams, null)); ... frontPane.getChildren().add(this.dragImage); Bounds localBounds = frontPane.sceneToLocal(draggable .localToScene(draggable.getBoundsInLocal())); this.dragImage.relocate(localBounds.getMinX(), localBounds.getMinY());

JavaFX - Set default CSS stylesheet for the whole Application

筅森魡賤 提交于 2020-02-05 07:40:12
问题 I'm pretty new to JavaFX, I'm trying to change my application aspect via CSS. First time it works fine, when I switch to another scene CSS' classes are not applied. Because my project has 10 scenes, I prefer to use a single CSS file to apply my style to all scenes by using this statement: StyleManager.getInstance().addUserAgentStylesheet(this.getClass().getResource("/style.css").toExternalForm()); into start() method. How can I apply to all scenes my CSS file globally? 回答1: You can do it with