javafx-8

Running JavaFX application with JDK 11+

安稳与你 提交于 2019-12-17 16:16:36
问题 If I understand Oracle's announcments JavaFX won't be included to the JDK beginning with JDK 11 and will be only available as OpenJFX. What steps do I have to make as an software developer to allow my JavaFX application to be run with JDK 11+? Is there any good adivce? Will be OpenJDK available via Gradle? 回答1: JavaFX 11 will be available from Maven Central, so you will be able to include it in your project as any other regular dependency, using Maven: <dependencies> <dependency> <groupId

Javafx Not on fx application thread when using timer

拟墨画扇 提交于 2019-12-17 15:58:28
问题 I'm using this import java.util.Random; import java.util.Timer; import java.util.TimerTask; import javafx.application.Application; import javafx.application.Platform; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.scene.shape.Circle; import javafx.stage.Stage; public class Main extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { Group root = new Group(); Scene

How to set JavaFX default skin

﹥>﹥吖頭↗ 提交于 2019-12-17 13:03:27
问题 I noticed that when I run JavaFX application on JVM 7 and JVM 8 I get different default skins. How I can set the default skin to be same on every JVM? 回答1: You can set the default skin: @Override public void start(Stage stage) throws Exception { .... setUserAgentStylesheet(STYLESHEET_CASPIAN); .... } http://fxexperience.com/2013/01/modena-new-theme-for-javafx-8/ 回答2: The default stylesheet for JavaFX 2 is caspian.css. You can find it in jfxrt.jar under com.sun.javafx.scene.control.skin

Transparent background of a textarea in JavaFX 8

混江龙づ霸主 提交于 2019-12-17 11:43:10
问题 Since I am using JavaFX 8, all my textarea s do not apply the transparency that has been defined in the corresponding css. It works fine in Java 7, but for the release candidate of JavaFX 8, I can't get it to behave like before. EDIT: This question is about JavaFX TextArea, not a JTextArea. -fx-background-color: rgba(53,89,119,0.2); does not have any effect on the textarea anymore, although it should have an alpha value of 0.2, but it is opague... Is that a known issue? 回答1: The TextArea

Javafx: TableView change row color based on column value

旧时模样 提交于 2019-12-17 11:08:51
问题 I have the following piece of code to update both the color of a column cell and its corresponding row: calltypel.setCellFactory(column -> { return new TableCell<CallLogs, String>() { @Override protected void updateItem(String item, boolean empty) { super.updateItem(item, empty); setText(empty ? "" : getItem().toString()); setGraphic(null); TableRow currentRow = getTableRow(); //This doesn't work if(item.equals("a")){ item.setTextFill(Color.RED); currentRow.setTextFill(Color.PINK); } else{

How to style menu button and menu items

最后都变了- 提交于 2019-12-17 10:53:57
问题 I tried to change styles in menu button. I could change menu button style but not its menu item. No matter what i try menu item inside menu-button remains unchanged. .menu-button { -fx-background-color:black; } .menu-button .label { -fx-background-color:black; } Now how can i change color that is left out?? 回答1: MenuButton uses Menu internally and has a similar API. In such way that MenuButton contains MenuItem s list just like Menu . So I think you need to try to play with .menu , .menu

How do I make a mouse click event be acknowledged by a TreeItem in a TreeView?

人走茶凉 提交于 2019-12-17 10:14:06
问题 The fxml file is as follows (headers omitted): <BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:id="pane" fx:controller="com.github.parboiled1.grappa.debugger.mainwindow.MainWindowUi"> <top> <MenuBar BorderPane.alignment="CENTER"> <Menu mnemonicParsing="false" text="File"> <MenuItem fx:id="loadInput" mnemonicParsing="false" text="Load

How to create custom 3d model in JavaFX 8?

霸气de小男生 提交于 2019-12-17 07:26:32
问题 I tried to make a plane in JavaFX application using official tutorial and has the next code: Image diifuseMap = new Image(getClass().getResource("t.jpg").toExternalForm()); TriangleMesh planeMesh = new TriangleMesh(); float[] points = { -5, 5, 0, -5, -5, 0, 5, 5, 0, 5, -5, 0 }; float[] texCoords = { 0, 0, 0, 1, 1, 0, 1, 1 }; int[] faces = { 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 1, 1 }; planeMesh.getPoints().addAll(points); planeMesh.getTexCoords().addAll(texCoords); planeMesh.getFaces().addAll(faces)

Displaying changing values in JavaFx Label

狂风中的少年 提交于 2019-12-17 07:25:13
问题 In JavaFX, how can I display values which continuously change with time using "label" ? 回答1: There are numerous ways to achieve that, the most convenient would be to use JavaFX's DataBinding mechanism: // assuming you have defined a StringProperty called "valueProperty" Label myLabel = new Label("Start"); myLabel.textProperty().bind(valueProperty); This way, every time your valueProperty gets changed by calling it's set method, the label's text is updated. 回答2: How about using

AutoComplete ComboBox in JavaFX

泪湿孤枕 提交于 2019-12-17 02:41:08
问题 I'm looking for a way to add autocomplete to a JavaFX ComboBox . After searching a lot it's time to ask here. This AutoFillBox is known but not what I'm searching. What I want is a editable combobox and while typing the list should filtered. But I want also to open the list without typing and seeing the whole items. Any idea? 回答1: First, you'll have to create this class in your project: import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event