javafx-8

How to take snapshot From node which is not on the scene

ぐ巨炮叔叔 提交于 2019-11-30 19:48:37
This is the case: I have a Mesh and PointLight added to the pane and I want to take snapshot from pane and show the result in the image view. But it only works when I add the pane to the scene. Is there any way to take snapshot from a node which has been not added to the scene? Accoring to documentation of Node.snapshot NOTE: In order for CSS and layout to function correctly, the node must be part of a Scene (the Scene may be attached to a Stage, but need not be). You can create new Scene without attaching it to Stage and even without displaying it: WritableImage writableImage = new

Set border size

只愿长相守 提交于 2019-11-30 19:46:02
问题 I want to make the border of a borderpane more round and bold. I tested this code: bpi.setStyle("-fx-background-color: linear-gradient(to bottom, #f2f2f2, #d4d4d4);" + " -fx-border: 12px solid; -fx-border-color: white; -fx-background-radius: 15.0;" + " -fx-border-radius: 15.0"); I get this result: How I can fix this? 回答1: Why your current approach doesn't work Don't use -fx-border (it doesn't even currently exist in JavaFX CSS). Though there are other fx-border-* attributes such as -fx-border

Javafx8 Popup Transparency issue

感情迁移 提交于 2019-11-30 17:31:23
问题 I am trying to port my javafx2 application over to javafx8 but have noticed some issues on Linux with popup controls. The screenshot shows how the popup have a white box around it, which normally should be transparent and drop shadow effect. This only happens on my Slackware14 Linux, I have test on the Windows VM that runs on the same machine and it renders fine. I think the issue is related to these issues https://javafx-jira.kenai.com/browse/RT-33709 https://javafx-jira.kenai.com/browse/RT

Set two root nodes for TreeView

让人想犯罪 __ 提交于 2019-11-30 17:29:24
Is there a way to set two root nodes for one TreeView? I found many example if simple TreeView but there is no useful example for my case. No: a tree only has one root node. To get the effect you want, create a dummy root node and add your two nodes to it. Create the TreeView with the dummy root node and call tree.setShowRoot(false) , so the dummy node does not appear. final TreeItem<String> root1 = new TreeItem<>("root 1"); final TreeItem<String> root2 = new TreeItem<>("root 2"); final TreeView<String> tree = createTreeView(root1, root2); // ... private TreeView<String> createTreeView

controlsfx Dialogs deprecated for what?

女生的网名这么多〃 提交于 2019-11-30 17:07:50
ControlsFX class Dialogs is marked as deprecated. What to use instead? Boomah This blog post explains it all: http://fxexperience.com/2014/09/announcing-controlsfx-8-20-7/ This release has been brewing since 8.0.6 was released on May 29th – so basically four months. This is not typical for us (we normally have much quicker releases), but Eugene and I were both distracted on a major undertaking – elevating the ControlsFX dialogs API and implementation into the next release of JavaFX itself (it’ll be appearing in JavaFX 8u40, although the API is vastly different than what you see in ControlsFX 8

Java FX8 TreeView in a table cell

半城伤御伤魂 提交于 2019-11-30 17:07:39
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>() { @Override public void startEdit() { setGraphic(testtree); } @Override public void cancelEdit() {

Callback and extractors for JavaFX ObservableList

妖精的绣舞 提交于 2019-11-30 16:57:07
问题 Here is the code: package sample; import javafx.beans.Observable; import javafx.beans.property.IntegerProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.collections.FXCollections; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; import javafx.util.Callback; import java.util.List; /** * Created by IDEA on 28/07/15. */ public class ListUpdateTest { public static void main(String[] args) { Callback<IntegerProperty, Observable[]>

Display additional values in Pie chart

◇◆丶佛笑我妖孽 提交于 2019-11-30 16:06:05
I have this example of Pie chart data: import javafx.application.Application; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.concurrent.Task; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.chart.PieChart; import javafx.scene.chart.PieChart.Data; import javafx.scene.control.ContextMenu; import javafx.scene.control.Label; import javafx.scene.control.MenuItem; import javafx.scene.effect.Glow; import javafx.scene.input.MouseButton

How to save a high DPI snapshot of a JavaFX Canvas

痴心易碎 提交于 2019-11-30 15:39:48
I have created an image on a Canvas which is scaled down for display using a transformation. It is also in a ScrollPane which means only a part of the image is visible. I need to take a snapshot of the entire canvas and save this as a high-resolution image. When I use Canvas.snapshot I get a Writable image of the visible part of the image after scaling down. This results in a low-res partial image being saved. So how do I go about creating a snapshot which includes the entire canvas (not only the viewport of the scrollpane) and with the resolution before the transformation downwards? I am not

Get key combination code

自闭症网瘾萝莉.ら 提交于 2019-11-30 15:24:32
问题 I want to ask you can I get key code combination of multiple keys. For example I can get the key code from this example: public void handle(KeyEvent event) { if (event.getCode() == KeyCode.TAB) { } But how I can get the key code of this example: textField.setText(""); // Process only desired key types if (event.getCode().isLetterKey() || event.getCode().isDigitKey() || event.getCode().isFunctionKey()) { String shortcut = event.getCode().getName(); if (event.isAltDown()) { shortcut = "Alt + "