javafx-8

Save JavaFX ScrollPane content to PDF file

这一生的挚爱 提交于 2019-12-25 04:53:24
问题 I'm using the below code to save the content of a ScrollPane in my JavaFx Application to a PDF file. button.setOnMouseClicked(new EventHandler<MouseEvent>() { public void handle(MouseEvent event) { File pdfFile = fileChooser.showSaveDialog(primaryStage); try { BufferedImage bufImage = SwingFXUtils.fromFXImage(scrollPane.snapshot(new SnapshotParameters(), null), null); FileOutputStream out = new FileOutputStream(new File("../temp.jpg")); javax.imageio.ImageIO.write(bufImage, "jpg", out); out

How to deactivate a TextField and a Label by Combobox selection in javafx

假如想象 提交于 2019-12-25 04:43:13
问题 I would like to deactivate a TextField and its Label by a specific selection pre defined in my combobox in my JavaFX application. i have already tried the below code but its not working.. public class Controller extends Application { @FXML private ComboBox<String>cmb1; @FXML private ComboBox<String>cmb2; @FXML private Button btn1,btn2; @FXML private TextField tf1,tf2,tf3,tf4,tf5,tf6; @FXML String v1,v2,v3,v4,v5,v6,cm1,cm2; @FXML private Label l6,l7; @Override public void start(Stage

How to deactivate a TextField and a Label by Combobox selection in javafx

让人想犯罪 __ 提交于 2019-12-25 04:43:05
问题 I would like to deactivate a TextField and its Label by a specific selection pre defined in my combobox in my JavaFX application. i have already tried the below code but its not working.. public class Controller extends Application { @FXML private ComboBox<String>cmb1; @FXML private ComboBox<String>cmb2; @FXML private Button btn1,btn2; @FXML private TextField tf1,tf2,tf3,tf4,tf5,tf6; @FXML String v1,v2,v3,v4,v5,v6,cm1,cm2; @FXML private Label l6,l7; @Override public void start(Stage

JavaFX borderpane.setCenter replaces entire scene

↘锁芯ラ 提交于 2019-12-25 03:39:53
问题 I'm trying to load a FXML into a FXML. The main FXML has a borderpane, and the second contains a VBox. I load both of these with the FXMLLoader. When I try to set the center of the boarderpane, the entire screen gets replaced with the second FXML. Here is the code BorderPane riskAnalysis = new BorderPane((BorderPane) FXMLLoader.load(getClass().getResource("./proposaldevelopment/riskAnalysis.fxml"))); VBox center = new VBox((VBox) FXMLLoader.load(getClass().getResource("./proposaldevelopment

Set and use variables outside timeline in javafx 8

感情迁移 提交于 2019-12-25 02:26:25
问题 I am trying to writing a javafx app to watch the system clipboard: package sample; import javafx.event.ActionEvent; import javafx.animation.KeyFrame; import javafx.animation.Timeline; import javafx.application.Application; import javafx.event.EventHandler; import javafx.util.Duration; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; import javafx.scene.control.Button; import javafx.scene.layout.StackPane; import javafx.scene

Display ToolTip on PieChart

笑着哭i 提交于 2019-12-25 01:59:46
问题 I want to display Tooltip when I move mouse pointer on PieChart. I tested this code: private ObservableList<Data> pieChartdData = FXCollections.observableArrayList(); private PieChart chart = new PieChart(pieChartdData); public void pieChart(List<FSPartitions> obj) { for (FSPartitions obj1 : obj) { String fsName = obj1.getFSName(); double usedSize = obj1.getUsedSize(); for (Data d : pieChartdData) { if (d.getName().equals(fsName)) { d.setPieValue(usedSize); return; } } } for (FSPartitions

How do you specify that you want your elements in a ToolBar to be centered?

点点圈 提交于 2019-12-25 01:55:54
问题 For some reason, JavaFX's ToolBar only proposes two options for items alignment: LEFT_TO_RIGHT and RIGHT_TO_LEFT . And funnily enough, if this is RIGHT_TO_LEFT you have to specify your items in reverse order so that they show up naturally... However I don't see any option for aligning elements in the center . How do you achieve that? Or must I use something else than a toolbar? edit: here is the current code... Unfortunately this doesn't work :( FXML: <BorderPane xmlns="http://javafx.com

How to run RFID tag listener method in javafx project?

一世执手 提交于 2019-12-25 01:46:47
问题 I am working on a project involves RFID technology, what i am trying to do at the moment, once the RFIDTagListener method runs, I basically pass a tag to a reader which its serial number will be sent to a server to get some relevant data back and pop them on a GUI screen. what I have done so far is getting the data upon sending reader's data manually without passing a tag becasue I don't know how to do it otherwise and here is the problem. where I am working on a javafx project and when I

Resize or Rotate images on JavaFX canvas

最后都变了- 提交于 2019-12-25 00:33:40
问题 I'm struggling find a way to select and then rotate or resize geometric figures drawn on a canvas (using the GraphicsContext function), this funciont should be part of an application like MS Paint. For drawing shapes I'm using a layered system of Canvas to allow Undo/Redo function. My original idea was to use the snapshot function to accomplish this operation, but I'm not really sure of how implement it and if the best method to do it. UPDATE: I'm currently working on this code public class

Context menu insight JavaFX Task

拥有回忆 提交于 2019-12-24 20:36:57
问题 I have a problem with Context menu. Following this topic I found that there is a limitation when I try to load Context menu insight JavaFX Task. I tested to implement Platform.RunLater() but without any success. static ContextMenu contextMenuPanel; public static BorderPane stageContextMenu(BorderPane bp) { Platform.runLater(new Runnable() { @Override public void run() { contextMenuPanel = new ContextMenu(); } }); MenuItem item1 = new MenuItem("About"); item1.setOnAction(new EventHandler