javafx-8

JavaFX ComboBox not responding on Windows 10

走远了吗. 提交于 2019-11-29 20:41:43
I recently upgraded to Windows 10 and JavaFX code which worked in Windows 8.1 appears to freeze up in 10. I've tracked the issue down to opening a ComboBox within a dialog. This appears to freeze any JavaFX program. Does anyone else have the same issue? (Windows 10 computers are still few and far between so would be good to confirm bug is indeed JavaFX issue) I have attached example code below. The ComboBox in the main stage is fine but when I open a dialog and try and use the ComboBox there, the whole thing freezes. I'm using Java 8u51 in Eclipse 4.4.0 package javafxExamples; import java.util

Task vs Service for database operations

别说谁变了你拦得住时间么 提交于 2019-11-29 20:27:26
What is the difference between JavaFX 8 Task and Service and in which case is it better to use one over the other? What is better to use in database operations? jewelsea Main Difference between Task and Service - One Time versus Repeated Execution A Task is a one off thing - you can only use a Task once. If you want to perform the same Task again, you need to construct a new Task instance. A Service has a reusable interface so that you can start and restart a single service instance multiple times. Behind the scenes, it just takes a Task definition as input and creates new tasks as needed.

Javafx resize components when fullscreen

…衆ロ難τιáo~ 提交于 2019-11-29 20:05:32
问题 Original size screenshot Fullscreen screenshot When i resize how can i nicely arrange the components. im using FXML for the GUI FXML CODE <AnchorPane id="AnchorPane" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="style.LoginController"> <children> <Button fx:id="login" layoutX="250.0" layoutY="242.0" mnemonicParsing="false" onAction="#login" prefHeight="32.0" prefWidth="101.0" text="Login" /> <ImageView fx:id="img2"

Choose which monitor does a JavaFX window open in

泪湿孤枕 提交于 2019-11-29 18:30:58
问题 I have two monitors. I have Eclipse open on the second monitor but when I run my JavaFX code, the JavaFX window always opens up in the first monitor and every time I have to drag it to the second monitor to use it. I have to do this because when it opens on the first monitor, none of the components inside the scene are loaded. It gets loaded only if I drag it to the second monitor. But when I disconnect the second monitor, it loads properly. Can someone please help me out? How do I, by

How to change or override the tooltip in JavaFX ColorPicker

跟風遠走 提交于 2019-11-29 17:55:37
I am using JavaFX ColorPicker in my application. As per my requirements, I have mapped the default colors on the color picker to a number. I want this number to be displayed as tooltip on hover over the color instead of hex value of the color. How can I achieve this? //Part of Code public void handleNodes(Circle circularNode) { final Delta offset = new Delta(); circularNode.setOnMouseEntered(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { ((Circle)(event.getSource())).setCursor(Cursor.HAND); } }); circularNode.setOnMousePressed(new EventHandler<MouseEvent>() {

JavaFX line fill color

非 Y 不嫁゛ 提交于 2019-11-29 17:42:19
I'm trying to create a line with a different fill and stroke color, something like this: I have tried the following: Line line = new Line(0,0,100,100); line.setFill(Color.RED); line.setStroke(Color.BLACK); line.setStrokeWidth(10); but this gives me just a black line. Is what I'm trying to do possible with a simple Line or do I have to use another Shape ? (I would prefer using a line because I have to frequently call the setStartX , setStartY , ... methods) José Pereda If you check this question , you'll see that you can only use setStroke . Also, a possible approach to generate the same

Display Combobox values from numbers

落花浮王杯 提交于 2019-11-29 17:29:32
I have a int value which I want to use for configuration. It can have 2 values - 0 for active and 1 for Blocked. I want to display this into friendly combo box: import javafx.application.Application; import static javafx.application.Application.launch; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.Scene; import javafx.scene.control.ComboBox; import javafx.scene.layout.BorderPane; import javafx.stage.Stage; public class MainApp extends Application { @Override public void start(Stage stage) throws Exception { int state = 0; ObservableList

TableCell: how to use a StackedBarChart (or is it impossible)?

喜你入骨 提交于 2019-11-29 16:56:31
The trigger for my experiment was a recent question - one cell in a row should visualize the relative proportion of values in several cell values in the same row. In fx, such a visualization is supported in StackedBarChart (degenerate to a single category and with yAxis being the category axis). Unfortunately, using such a chart as cell graphics has weird effects when updating the item, depending on how we do the update: scenario A: initialize the chart with the series and update the data in the series. The bars appear fine only on the very first showing, scrolling back and forth leaves random

How to localize JavaFX FileChooser dialog?

怎甘沉沦 提交于 2019-11-29 16:44:20
Is there an option to localize JavaFX FileChooser dialog? In Swing JFileChooser localization was pretty simple (over UIManager ). But i can't find similar functionality in JavaFX. I don't think you can. From the FileChooser Javadocs : Provides support for standard platform file dialogs. These dialogs have look and feel of the platform UI components which is independent of JavaFX. Since these are native File Chooser dialogs, the text displayed in them will be controlled by the locale of the platform (i.e. the regional settings chosen on the user's machine at the OS level). Note that this is

ComboBox SAME item selected action listener

杀马特。学长 韩版系。学妹 提交于 2019-11-29 16:34:41
A combo box will fire an event if a DIFFERENT value is selected. I want to be also be able to listen to the SAME item being selected (that is, valueProperty has no change). There seems to be no way to do this. I tried extending the ComboBox and finding a way to listen for the little popup menu being closed, but I don't even have access to that! What can I do? Here is what I was trying: class ResponsiveComboBox<E> extends ComboBox<E> { public ResponsiveComboBox() { super(); assert getContextMenu() != null; //Asssertion failed! this.getContextMenu().setOnHiding((WindowEvent event) -> { fireEvent