javafx

Open and close JavaFx apps in scala console

二次信任 提交于 2019-12-31 04:41:08
问题 Here is an example: /* * Copyright 2013 ScalaFX Project * All right reserved. */ package scalafx.ensemble.example.charts import scalafx.application.JFXApp import scalafx.scene.Scene import scalafx.collections.ObservableBuffer import scalafx.scene.chart.LineChart import scalafx.scene.chart.NumberAxis import scalafx.scene.chart.XYChart /** A chart in which lines connect a series of data points. Useful for viewing * data trends over time. * * @see scalafx.scene.chart.LineChart * @see scalafx

JavaFX: Handle ComboBox selection event which is inside the TableView Column

此生再无相见时 提交于 2019-12-31 04:39:09
问题 I have a javafx TableView and I want custom controls inside the columns. Say I want a TextField in column1 and ComboBox in column2 and DatePicker in column3 . I know that I should create a class that extends TableCell and override the updateItem() method.... But I read that specifically for this purpose we have default classes like ComboBoxTableCell , TextFieldTableCell etc in the cell package and it is recommended to use them. So I'm able to achieve this with the below code.

JavaFX TreeView is empty

二次信任 提交于 2019-12-31 04:27:47
问题 I am new to working with JavaFX , and I am trying to create a TreeView to add to a Tab . When I add the TreeView to the Tab , however, it is empty. Below is the code that creates, populates, and adds the TreeView to the Tab . public ResultView(List<WebPage> results, int resultNum) { this.pagesWithResults = results; urls = new ArrayList<String>(); outputs = new ArrayList<>(); resultsTab = new Tab("Result" + resultNum); resultTree = new TreeView<>(); branches = new ArrayList<>(); for(WebPage

Linear gradient's bounds computation takes parent's bounds in account, not the node on which it is applied on

。_饼干妹妹 提交于 2019-12-31 04:23:05
问题 I want to put a linear gradient on a line(width wise ie across it's stroke width). This line is a child of a Group node. When I apply linear gradient on line, the color stops are calculated using Group's bounds not the lines bounds. In my code below, linear gradient will show up properly when added length-wise ie "to bottom", but not when added width wise, ie "to right". Can anyone tell me what can be work around for this? Here is the SSCCE import javafx.application.Application; import javafx

Switching Apps on Mac with AWT Robot only sometimes works

匆匆过客 提交于 2019-12-31 04:22:28
问题 I'm trying to use Robot in order to switch apps, and then enter some text. To do this (on my mac), I'm pressing Meta, Tab, and then releasing Tab, Meta in this order: Robot robot = new Robot(); robot.keyPress(KeyEvent.VK_META); robot.keyPress(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_META); This works, but only occasionally (about every 5 or six presses). I've tried calling Thread.wait() inbetween press and release, but this has no effect. Neither does

JavaFX (8) Alert: different button sizes

旧街凉风 提交于 2019-12-31 04:17:13
问题 Consider a JavaFX (8) Alert dialog with two buttons: Alert alert = new Alert(AlertType.CONFIRMATION); ButtonType bttYes = new ButtonType("Yes"); ButtonType bttNo = new ButtonType("No, continue without restart"); alert.getButtonTypes().clear(); alert.getButtonTypes().addAll(bttYes, bttNo); alert.showAndWait(); The resulting dialog has two buttons, both same width which looks quite silly. Is there a way to adjust both buttons to the actual text length? 回答1: An Alert , which extends Dialog ,

How can I remove my javafx program from the taskbar

纵然是瞬间 提交于 2019-12-31 03:56:49
问题 I need remove my javafx app from the taskbar. I tried StageStyle.UTILITY . This is works but I need both UNDECORATED and UTILITY stage styles or another solvings. Thank you for your replies. 回答1: Sorry you've been waiting so long for some sort of an answer on this, the following is mainly for people who come to this in the future hoping to discover a way of achieving this. Let me start of by saying I wouldn't consider the following a solution but more of a workaround. Assigning more than one

Handle event on disabled Node

。_饼干妹妹 提交于 2019-12-31 03:54:13
问题 Is there any way to handle, mouse click, for example on disabled element? My task is to have disabled list and make it enabled after double click on it. 回答1: A disabled Node does not receive mouse or key events. See the official documentation. You could wrap the node into another node and handle the mouse events there in case the child node is disabled. 来源: https://stackoverflow.com/questions/30341840/handle-event-on-disabled-node

Alert in JAVA FX

醉酒当歌 提交于 2019-12-31 03:44:08
问题 I want to display an alert when a file already exists when trying to create the file with same name . I have not completed the code fully. I want to retrieve the button value Yes/No from the UI . Code: This is how the controller is coded. package application; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.net.URL; import java.util.Map; import java.util.ResourceBundle; import java.util.Set; import java.util.TreeMap; import org.apache.poi.ss

JavaFX applications built to target Java 8 - How to keep running with Java 11?

早过忘川 提交于 2019-12-31 03:36:09
问题 I recently learned about JavaFX not being included in Java 11, and have a question about how this will work. Right now, I maintain an application that targets Java 8, uses mostly Swing but some JavaFX, and has a non-developer user base. Some of those users are on older operating systems, so I'd like to continue targeting Java 8. However, Java 11 comes out next month, and I'm concerned that some of the users on newer operating systems will upgrade to Java 11, and the JavaFX components of the