javafx-8

How to reload an Application in JavaFX?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 23:58:56
I have a small game which has New Game button. There are many variables which need reset when the New Game button is pressed. Is there any method which can easily reload the whole application or any alternative to refresh the scene, stage or variables? I just want to bring the application to it's initial stage when It's first loaded. I went through different topics on internet and read many questions and answers here also, but I there is no easy method to implement it. Most of the answers suggest to reuse the whole code or put the whole code in class and reload it. Questions reviewed: How to

Running JavaFX applications on Redhat 5

余生颓废 提交于 2019-12-05 22:43:25
From my previous question , I know that JavaFX is not supported in RedHat 5.8 meaning, even when I have Java 8 (jdk1.8.0_05) installed on my Linux, a JAR file created in win7 can't be executed via java -jar helloworld.jar . Does that mean there is NO way to run JavaFX jars on this machine? The problem with running JavaFX applications on RHEL5 is the version of glib that comes with that OS is not new enough. The trick, then, is to provide a newer version of that library and all of the other libraries that depend on it to the JRE. The next hurdle is that RHEL5 shared library loader won't load

JavaFX 8 Custom ListView Cells it's Evil

十年热恋 提交于 2019-12-05 21:58:39
问题 I have custom ListView cell i have HBox with two controls: Label with name field It's must generated from context of object For example i set ListView items array of Class Fields, if field type Boolean i create CheckBox, if String i create TextField and etc. Problem is: i get Field object only in method updateItem() - and only there i can create my controls. In JavaFX 7 all works fine, but on Java 8 - i dont see my controls. Is exists correct way to resolve my case? UPDATE 1 Here complete

JavaFX in commercial products [closed]

主宰稳场 提交于 2019-12-05 21:54:08
I want to use JavaFX as a development framework into large commercial product. Can I close the source code of my future product without violation of Oracle's license and sell my product with Oracle JavaFX framework? Are there any license restrictions? Actually, this question, is a dublicate of FAQs questions here : JavaFX 2 FAQ What type of license is JavaFX available under? JavaFX is available under the same license and business model as Java SE. This includes the ability for third party developers to distribute the runtime librairies with their application(s), subject to the terms and

Implementing Undo/Redo in JavaFX

我们两清 提交于 2019-12-05 21:19:33
I'm trying to implement undo/redo in JavaFX - I draw all my shapes using graphicsContext() . I have looked around and found that there's a save method on Graphics Context but it just saves attributes and not the actual shape/state of the canvas. What would be the best way of going about this? This is one of my code snippets when I create a circle, for instance: public CircleDraw(Canvas canvas, Scene scene, BorderPane borderPane) { this.borderPane = borderPane; this.scene = scene; this.graphicsContext = canvas.getGraphicsContext2D(); ellipse = new Ellipse(); ellipse.setStrokeWidth(1.0); ellipse

How do I get buttons to fill a javafx gridpane?

半世苍凉 提交于 2019-12-05 20:58:42
问题 Java Swing has GridLayout , which allows you to specify a size for an array of widgets such as 3X4. The widgets then fill the panel they occupy. How do you get a similar effect in JavaFX? 回答1: I think you are asking how you get a node to fill the space allocated to its cell in a grid pane. There are a couple of ways to do this. You can either use the static GridPane methods to apply GridPane -specific property settings to the nodes: GridPane.setFillWidth(myButton, true); GridPane

How to crop and resize JavaFX Image?

时间秒杀一切 提交于 2019-12-05 20:52:01
I'm trying to display very large images on JavaFX canvas. Resolution of a single image is 11980x8365. Each image has a corresponding world file and I can use it to position images correctly. My canvas size is 800x600. Sometimes I need to write whole image on the canvas, and sometimes just a part of it. Here is what I've done so far: Load full sized image from a file into the Image object. Calculate which part of Image to show and calculate scale parameters to correctly fit it into 800x600 canvas. So basically I wanted to use GraphicsContext.drawImage(...) - Draws the current source rectangle

How load css file in javafx8

家住魔仙堡 提交于 2019-12-05 20:47:15
javafx 8 this code is not working scene.getStylesheets().add("appCssFile.css"); give Exception Mar 25, 2014 12:21:20 PM com.sun.javafx.css.parser.CSSParser reportException WARNING: Please report java.lang.NumberFormatException at: Mar 25, 2014 12:21:20 PM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged WARNING: Resource "appCssFile.css" not found. How can i load css ? You need an URL and call toExternalForm in order to load a css file into your project. Use the ClassLoader for that: scene.getStylesheets().add(getClass().getResource("/style.css").toExternalForm()); For those who can

Triggering an Event by KeyCombination in javaFX

情到浓时终转凉″ 提交于 2019-12-05 20:34:23
I am trying to set a shortcut to save a file. public static final KeyCombination saveShortcut = new KeyCodeCombination(KeyCode.S, KeyCombination.CONTROL_ANY); I trigger an action by: sceneRoot.addEventHandler(KeyEvent.KEY_RELEASED, new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent event) { if (saveShortcut.match(event)) { saveProject.fire(); } } }); However, the event gets fired by just hitting the S key. Any ideas on why so? James_D The default value for all the modifiers in the KeyCodeCombination constructor is RELEASED . So your save shortcut matches the key S with Shift

com.gluonhq.charm.glisten.control.TextField does not exist

£可爱£侵袭症+ 提交于 2019-12-05 20:19:19
I'm using scene builder to create an user interface which uses com.gluonhq.charm.glisten.control.TextField . It works properly in the Scene Builder and it's preview. But in the NetBeans editor I get the class does not exist error. When I try to run the application, I get the following runtime error. Caused by: java.lang.ClassNotFoundException: com.gluonhq.charm.glisten.control.TextField at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader