javafx-8

How do you set the icon of a Dialog control Java FX/Java 8

不羁的心 提交于 2019-12-03 15:28:12
问题 I might be missing something very obvious, but I can't find out how to set the Icon for a Dialog component (ProgressDialog to be more precise). I know how to do that for a Stage: this.primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("/icon/Logo.png"))); But I don't find anything for the Dialog family. And somehow, setting the Stage Icon does not influence the Dialog Icon. Thanks 回答1: There's an excellent tutorial here by Marco Jakob, where you can find not only how to use

How to show ProgressIndicator in center of Pane in Javafx

邮差的信 提交于 2019-12-03 14:55:10
I have a Pane with some controls and a button. When I click on the button, I want show ProgressIndicator in center of pane without removing any controls. When I am adding a ProgressIndicator to pane during onAction of button, it adds it below the button. I want it to overlay on the pane. The picture below explains what I want. Code package fx; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ProgressIndicator; import

JavaFX: Styling application with CSS Selectors

假如想象 提交于 2019-12-03 14:25:17
I have a couple of questions about styling a JavaFX application with CSS Selectors (such as: .table-view for every TableView ). I have created a main CSS-file, in which I want to define the universal style properties for my application. For example: every TableView gets the same color in every screen. I just import the Main.css in every .css that is associated with a .fxml file. Now I would like to style every HBox in a 'sidebar' the same way. I have tried it like this (as suggested in Oracle's documentation): .sidebar > .hbox { /* Just some styling */ } This is not working to my surprise, but

How does JavaFX 8 start the JavaFX Application thread in a nearly empty Application class?

自作多情 提交于 2019-12-03 12:50:29
Lets say, we have the following class: import javafx.application.Application; import javafx.stage.Stage; public class Test extends Application { public Test() { System.out.println("Constructor"); } @Override public void start(Stage primaryStage) throws Exception { System.out.println("start"); } public static void main(String... args) { System.out.println("main"); } } It's derived from Application but it doesn't use any of its methods. Usually you start a JavaFX application by calling launch(args) in the main. When I start this program the only output is "main", so the constructor and start

How to add a tooltip to a TableView header cell in JavaFX 8

旧巷老猫 提交于 2019-12-03 12:09:40
Does anyone know how to add a tooltip to a column header in a TableView ? There are many places where are explained how to add the tooltip to data cells, but I didn't find a way to add the tooltip to header. Using the tool ScenicView , I can see that the headers are Labels inside a TableColumnHeader object, but It seems that It is not a public object. Any suggestions ? TableColumn<Person, String> firstNameCol = new TableColumn<>(); Label firstNameLabel = new Label("First Name"); firstNameLabel.setTooltip(new Tooltip("This column shows the first name")); firstNameCol.setGraphic(firstNameLabel);

JavaFX LineChart Performance

余生长醉 提交于 2019-12-03 09:16:45
问题 I've been trying to improve the performance of LineChart in JavaFX but without great success. I also have found that this seems to be a common problem that some programmers have found when trying to display big data (big here stands for datasize > 10,000). For instance, this kind of data is pretty common in the science and engineering and it would be great if we could figure out how to speed up the LineChart in JavaFX. Well, I found two posts here in the stackoverflow with a similar question

How to change the tab pane style

馋奶兔 提交于 2019-12-03 08:33:55
I use the default JavaFX tab pane layout I want to display new tabs below the old ones. I don't want to display the default context menu to select which tab to display. Are there any options to change this? try this....change it according your need.this is default css for tab pane and their layout... i used it and work sucessfully .tab-pane { -fx-skin: "com.sun.javafx.scene.control.skin.TabPaneSkin"; /* -fx-tab-min-width: 4.583em; 55 */ /* -fx-tab-max-width: 4.583em; 55 */ -fx-tab-min-height: 2em; /* 24 */ -fx-tab-max-height: 2em; /* 24 */ } .tab .tab-label { -fx-skin: "com.sun.javafx.scene

What is the best way to manage multithreading in JavaFX 8?

北战南征 提交于 2019-12-03 08:05:33
I'm trying to find an efficient way to influence the shape and the content of the JavaFX GUI elements, such as simple Pane , with use of multithreading. Let's say I have a simple Pane , on which I display filled Circle s at the given itervals of time, and I want to have the posibility to answer to them, e.g. by hitting the corresponding key. So far, for this purpose, I tried to use class with the implementation of Runnable interface and creation of classic Thread object in it, in order to add and/or remove elements from the external JavaFX Pane , which was passed to that "thread class" in its

ListView with custom content in JavaFX

丶灬走出姿态 提交于 2019-12-03 07:34:40
How i can make custom ListView with JavaFx for my app. I need HBox with image and 2 Labels for each line listView. You need to provide a custom CellFactory via ListView.setCellFactory(...) Working example public class CustomListView extends Application { private static class CustomThing { private String name; private int price; public String getName() { return name; } public int getPrice() { return price; } public CustomThing(String name, int price) { super(); this.name = name; this.price = price; } } public static void main(String[] args) { launch(args); } @Override public void start(Stage

FXML, JavaFX 8, TableView: Make a delete button in each row and delete the row accordingly

本小妞迷上赌 提交于 2019-12-03 07:28:24
I am working on a TableView (FXML) where I want to have all the rows accompanied with a delete button at the last column. Here's a video that shows what I mean: YouTube Delete Button in TableView Here's what I have in my main controller class: public Button del() { Button del = new Button(); del.setText("X"); del.setPrefWidth(30); del.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent event) { int i = index.get(); if(i > -1) { goals.remove(i); list.getSelectionModel().clearSelection(); } } }); return del; } private SimpleIntegerProperty index = new