javafx-8

How to set -fx-max-width to USE_PREF_SIZE in JavaFX css?

淺唱寂寞╮ 提交于 2019-12-19 19:46:15
问题 Im writing a JavaFX-8 application and was wondering if it's possible to set min- or max-width of (e.g.) a Button to USE_PREF_SIZE by css. The class Region defines USE_PREF_SIZE as Double.NEGATIVE_INFINITY , but how to set negative Infinity in css? The JavaFX Reference Guide defines -fx-min-width, -fx-pref-width, -fx-max-width as <number> and a <number> is defined with the following regex [+|-]? [[0-9]+|[0-9]*"."[0-9]+] So maybe it is impossible? I have tried (for fun) to assign the java way

Remove all children from a group without knowing the containing nodes

大兔子大兔子 提交于 2019-12-19 13:46:18
问题 check this out Group g = new Group(); GridPane grid = new GridPane(); // g.getChildren().addAll(grid); now my question is how do i remove this "grid" from "g" without specifying "grid" like something like this g.getChildren().removeAll(null); //i do not know what to insert here? thanks in advance 回答1: If you want to remove all items from a collection, use the clear() method: g.getChildren().clear(); 来源: https://stackoverflow.com/questions/27066484/remove-all-children-from-a-group-without

Screenshot of the full web page loaded into JavaFX WebView component, not only visible part

时光毁灭记忆、已成空白 提交于 2019-12-19 11:42:52
问题 I'm writing my first lines of code after 2 years of managerial work. No time to read a lot of docs, need to create a proof-of-concept just in minutes. So I have to work with JavaFX and need to provide functionality that allows to take a screenshot of web-page loaded into WebView component. The issue is that I need a screenshot of the full page, not only that piece that fits into current size of application window. Here is a simple code I use: WritableImage image = browser.snapshot(new

JavaFX 8 tooltip removes transparency of stage

╄→尐↘猪︶ㄣ 提交于 2019-12-19 10:25:24
问题 I had a hard time figuring out why my transparent stage refuses to be transparent. Finally I found out, that it was caused by a Tooltip that was installed into an ImageView : ImageView imageViewIcon = new ImageView(); imageViewIcon.setFitWidth(70); imageViewIcon.setFitHeight(70); imageViewIcon.setPreserveRatio(false); imageViewIcon.setImage(new Image("./next.png")); Tooltip tooltip = new Tooltip("Tooltip!"); if (this.config.getShowTooltip("true")) { Tooltip.install(imageViewIcon, tooltip); }

Vertical menu for configuration panel

坚强是说给别人听的谎言 提交于 2019-12-19 10:14:47
问题 I would like to create configuration panel like this example: The problem is that I don't how to create the vertical menu at the left side. Can you give some example of similar menu? 回答1: package verticalmenubar; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Accordion; import javafx.scene.control.Button; import javafx.scene.control.TabPane; import javafx.scene.control.TitledPane;

add listener for javafx textField upto 2 decimal place

别说谁变了你拦得住时间么 提交于 2019-12-19 09:58:35
问题 I want to set javaFX text field upto two decimal places . I found the answer but it is for numeric value . e-g // force the field to be numeric only textField.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { if (!newValue.matches("\\d*")) { textField.setText(newValue.replaceAll("[^\\d]", "")); } } }); In above code, what is replacement for limit value upto two decimal. Or

Javafx adding Image in TableView

℡╲_俬逩灬. 提交于 2019-12-19 09:49:51
问题 I am trying to add image in tableView but I can't add image. I am getting image in byte[] and I can set this image in imageView but is there any way to add it in tableView ? person3 class: public class person3 { private final StringProperty firstName7 = new SimpleStringProperty(""); private final StringProperty firstName8 = new SimpleStringProperty(""); public person3(String firstName4, String firstName5) { setFirstName7(firstName4); setFirstName8(firstName5); } public String getFirstName7()

Changing the language in JavaFX 8 DatePicker

☆樱花仙子☆ 提交于 2019-12-19 09:08:10
问题 When adding a DatePicker to my app I get the following: I assume this is because I use Hebrew on my computer. How can I change the language of the DatePicker to be English? 回答1: You can define the default locale for your instance of the Java Virtual Machine calling: Locale.setDefault(Locale.ENGLISH); Or if you can't find the locale, you need, in the pre made constants, you can look up the country code in the list of officially supported locales and create your "custom" locale like this:

Zoom Bar Chart with mouse wheel

我是研究僧i 提交于 2019-12-19 03:58:27
问题 I found many examples how to zoom in charts but I'm looking for basic example in which the user can scroll with the mouse wheel. import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.chart.BarChart; import javafx.scene.chart.CategoryAxis; import javafx.scene.chart.NumberAxis; import javafx.scene.chart.XYChart; import javafx.stage.Stage; public class BarChartSample extends Application { final static String austria = "Austria"; final static String brazil =

Java FX8 TreeView in a table cell

一曲冷凌霜 提交于 2019-12-18 18:32:23
问题 This is a follow up question based on TreeView in a table cell Java FX 8 I am having a table in which a particular column has to popup a treeview on click. I am defining the table column's cellfactory as follows col4.setCellFactory(new Callback<TableColumn<User,DepartmentTree>, TableCell<User,DepartmentTree>>() { @Override public TableCell<User, DepartmentTree> call( TableColumn<User,DepartmentTree> param) { TableCell<User, DepartmentTree> deptCombo = new TableCell<User,DepartmentTree>() {