javafx-8

How to make a RadioButton look like regular Button in JavaFX

最后都变了- 提交于 2019-12-18 05:04:40
问题 I'm implementing a toolbox-like pane, so user can only pick one tool at a time, and I switched from Button to RadioButton for its behavior. But I found that RadioButton uses its own skin with a dot, however I still want it to display like a normal Button . I'm a beginner with JavaFX and FXML, so anyone know how can I accomplish this? 回答1: First Create a radio button, remove the radio-button style and then add the toggle-button style like RadioButton radioButton=new RadioButton("Radio");

Insert only numbers in Spinner Control

。_饼干妹妹 提交于 2019-12-18 04:55:12
问题 I tested Spinner control in Java 8u40 import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.Spinner; import javafx.scene.control.SpinnerValueFactory; import javafx.scene.layout.GridPane; import javafx.stage.Stage; public class MainApp extends Application { public static void main(String[] args) { Application.launch(args); } @Override public void start(Stage stage) { final Spinner spinner

How can I bypass the JavaFX's TableView “placeholder”?

允我心安 提交于 2019-12-18 04:45:11
问题 JavaFX's TableView has a placeholder property that is basically a Node that gets displayed in the TableView whenever it is empty. If this property is set to null (its default value), it appears as a Label or some other text based Node that says "There is no content in the table." But if there are any rows of data in the table, then the placeholder Node disappears and the entire vertical space in the TableView gets filled with rows, including empty rows if there isn't enough data to fill the

How to prevent TableView from doing TableColumn re-order in javaFX 8?

心已入冬 提交于 2019-12-18 04:43:06
问题 I read this https://bugs.openjdk.java.net/browse/JDK-8102128 but I haven't found something in the Api of JavaFX 8.There isn't any way of prevent reordering in TableView? 回答1: Spent half of a day trying to solve the problem. Maybe my investigation can be useful for someone else. It's possible to disable column reordering using some hacks. And here're the steps: Get table header. This can be done as described here: https://stackoverflow.com/a/12465155 Add change event listener to

JavaFX WebView can't load certain sites

拥有回忆 提交于 2019-12-18 04:22:05
问题 I'm trying to use JavaFX's WebView to load this site, but all I get is a blank screen. The WebView is working perfectly fine on other sites; it gets 100/100 on ACID3 and loads other HTTPS sites without any problems whatsoever. I can't find anything particularly wrong with the site either. It has a proper, non-expired certificate signed by proper CA, and SSL Labs report a B grade. I tried all the major browsers on it and none report any certificate or SSL related issues; the site renders fine

how to achieve javafx mouse event “push and hold”?

穿精又带淫゛_ 提交于 2019-12-17 21:36:29
问题 I am developing a JavaFX project and I need something similar to a TouchEvent that characterizes a "push and hold" event . But It should be mapped as a MouseEvent because I'm having troubles with touch events on Linux. For instance, in Ubuntu, it won't respond to touch events. Please, let me know if you have any ideas about how to fire a MouseEvent whenever a "push and hold" occurs on Linux? 回答1: Just use a PauseTransition as a timer for the "hold". Start it if the mouse is pressed, stop it

JavaFX8 list bindings similar to xaml

試著忘記壹切 提交于 2019-12-17 21:30:07
问题 I am unable to bind in fxml a collection to a customized template. Here the code how I would do it in xaml: <ListView ItemsSource="{Binding PersonCollection}"> <StackPanel Orientation="Horizontal"> <Label Content="{Binding FirstName}"></Label> <ListView ItemsSource="{Binding MiddleNames}"> <Label Content="{Binding}"></Label> </ListView> <Label Content="{Binding LastName}"></Label> </StackPanel> </ListView> Here the Model: class Person { String FirstName, LastName; String[] MiddleNames; } And

Remove padding/margin from JavaFX Label

喜欢而已 提交于 2019-12-17 20:37:20
问题 Is there a way to remove the default space (padding/margin) that JavaFX label adds? I want to get rid of the space displayed between the black lines on the image below: Source code: public class LabelTest extends Application { @Override public void start(final Stage primaryStage) { final Group root = new Group(); final Scene scene = new Scene(root, 300, 130, Color.WHITE); final GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10); gridpane.setVgap(10);

How to get an ObservableFloatArray from a Stream?

↘锁芯ラ 提交于 2019-12-17 20:24:10
问题 This is nearly the same question as this one, but in the opposite direction. I know there's no FloatStream in Java 8, and there're no many use cases for float[], but I have one: Dealing with TriangleMesh in JavaFX 3D, you have to provide an ObservableFloatArray for the 3D coordinates of the vertices of the whole mesh. As a result of some calculations I'll have all these coordinates in a List , and to add all of them at once to the mesh, I'll call triangleMesh.getPoints().addAll() , using one

Setting Arabic numbering system locale doesn't show Arabic numbers

喜夏-厌秋 提交于 2019-12-17 20:19:10
问题 I read this article: JDK 8 and JRE 8 Supported Locales, it stated that: Numbering systems can be specified by a language tag with a numbering system ID ╔═════════════════════╦══════════════════════╦══════════════════╗ ║ Numbering System ID ║ Numbering System ║ Digit Zero Value ║ ╠═════════════════════╬══════════════════════╬══════════════════╣ ║ arab ║ Arabic-Indic Digits ║ \u0660 ║ ╚═════════════════════╩══════════════════════╩══════════════════╝ Now, to demonstrate this, I wrote the