javafx

Periodically refresh data

孤街醉人 提交于 2020-01-24 12:03:25
问题 I want to display data periodically but I get error when I try to display the data. Timeline fiveSecondsWonder = new Timeline(new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { GridPane gp = new GridPane(); gp.setPadding(new Insets(10, 10, 10, 10)); gp.setHgap(20); gp.setVgap(10); //gp.setGridLinesVisible(true); gp.add(new Label("Operating System Name"), 0, 0); gp.add(new Label(System.getProperty("os.name")), 1, 0); gp.add(new

Using queries containing pseudo-classes in JavaFX

老子叫甜甜 提交于 2020-01-24 11:28:12
问题 I'm tring to use pseudo classes in programmtic query using Node.lookupAll() however this seems to give unexpected results. I've searched online and can't find anything to suggest Node.lookupAll() wouldn't support psuedo classes... public class Foo extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) throws Exception { PseudoClass pseudoClass = PseudoClass.getPseudoClass("custom"); Label a = new Label(); a.getStyleClass(

Images imported in scene builder is not getting displayed while executed in netbeans

▼魔方 西西 提交于 2020-01-24 06:47:05
问题 All the functionalities are working fine except this image display. But in Scene builder preview its working fine. Can someone help in this?? 回答1: maybe you linked images from outside the projectdirectory, i made a small and simple example, which works quite well. Put your image into the same package, where you placed your fxml file and link it again in Scene Builder to the new location. Here's a little code: App.java package com.example.images; import javafx.application.Application; import

How to hide TableView column header in JavaFX 8?

試著忘記壹切 提交于 2020-01-24 04:44:08
问题 I need to have an observable list of a type that will be displayed in a TableView with one single column, that when selected will display the rest of its information on the right. The TableView is wrapped in a TitledPane, which is wrapped in an Accordion. See image below: As you can see in this scenario I don't want to show the Column Header. I tried following the instruction here, which leads to here: Pane header = (Pane) list.lookup("TableHeaderRow"); header.setMaxHeight(0); header

How To Align Ok Button Of A Dialog Pane In Javafx?

橙三吉。 提交于 2020-01-24 04:23:30
问题 I want to align i.e Position CENTER an OK button of a DialogPane. I have tried the below code but its not working. Dialog dialog = new Dialog(); DialogPane dialogPane = dialog.getDialogPane(); dialogPane.setStyle("-fx-background-color: #fff;"); // Set the button types. ButtonType okButtonType = new ButtonType("Ok", ButtonBar.ButtonData.OK_DONE); ButtonType cancelButtonType = new ButtonType("Cancel", ButtonBar.ButtonData.CANCEL_CLOSE); dialog.getDialogPane().getButtonTypes().addAll

How To Align Ok Button Of A Dialog Pane In Javafx?

巧了我就是萌 提交于 2020-01-24 04:23:26
问题 I want to align i.e Position CENTER an OK button of a DialogPane. I have tried the below code but its not working. Dialog dialog = new Dialog(); DialogPane dialogPane = dialog.getDialogPane(); dialogPane.setStyle("-fx-background-color: #fff;"); // Set the button types. ButtonType okButtonType = new ButtonType("Ok", ButtonBar.ButtonData.OK_DONE); ButtonType cancelButtonType = new ButtonType("Cancel", ButtonBar.ButtonData.CANCEL_CLOSE); dialog.getDialogPane().getButtonTypes().addAll

JavaFx GridPane layout how to set margin for an element in row?

Deadly 提交于 2020-01-24 02:57:06
问题 I'm using GridPane layout for positioning things in my application. I'm wondering how I can set margin for an element in row GridPane.setConstraints(chip5, 1, 1, 1, 1, HPos.RIGHT, VPos.TOP); //I want to set // margin for chip5 from top (for example 5px) Is it possible in GridPane? 回答1: You can set the margin for any particular Node : GridPane.setMargin(chip5, new Insets(5, 0, 0, 0)); 回答2: In FXML, you can do it as follows: <TextField fx:id="txtFirstName" GridPane.rowIndex="0" GridPane

CSS+JavaFX: Could not resolve X while resolving lookups for Y

吃可爱长大的小学妹 提交于 2020-01-24 00:36:08
问题 I'm brand new to CSS, and trying to make a MWE for a chart in JavaFX. I've been able to make it work in some cases, but my problems pop up when I try to define variables in root. What I want to do eventually is update the values of chart0-color and chart1-color in code, but for now I'm trying to just define them as variables in the .css. I ran it through CSSLint and it gave some warnings about adjoining classes, but no errors. If I replace -chart0-color and -chart1-color with any other color

JavaFx Group contents position getting changed upon transformation

删除回忆录丶 提交于 2020-01-23 21:41:12
问题 I'm simulating a compass where I need to display current angular position upon reception of angular data from another source(via network). But somehow the circle group is getting shifted upon applying transformation to Text node based upon angular position. This is a sample code MainApp.java import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.layout.BorderPane; import javafx.scene.paint.Color;

JavaFx Group contents position getting changed upon transformation

自作多情 提交于 2020-01-23 21:41:11
问题 I'm simulating a compass where I need to display current angular position upon reception of angular data from another source(via network). But somehow the circle group is getting shifted upon applying transformation to Text node based upon angular position. This is a sample code MainApp.java import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.layout.BorderPane; import javafx.scene.paint.Color;