javafx-8

Change chart colors for different values [duplicate]

帅比萌擦擦* 提交于 2019-12-13 16:37:05
问题 This question already has an answer here : How to change color of a single bar java fx (1 answer) Closed 5 years ago . I want to create temperature chart where I can monitor in real time temperature. import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.chart.NumberAxis; import javafx.scene.chart.StackedAreaChart; import javafx.scene.chart.XYChart; import javafx.stage.Stage; public class MainApp extends Application { final NumberAxis xAxis = new NumberAxis(1,

How to test method of JavaFX controller?

£可爱£侵袭症+ 提交于 2019-12-13 15:17:44
问题 I was trying to use TestFX to test my application. I would like to run the test for the method of my controller. Main.java: public class Main extends Application { try{ new Flow(ManageCtrl.class).startInStage(primaryStage); } catch (Exception ex) { LOGGER.log(Level.SEVERE, null, ex); } } ManageCtrl.java: @ViewController("/FPManage.fxml") public class ManageCtrl extends AnchorPane { @FXML // fx:id="email" private TextField email; // Value injected by FXMLLoader public void setEmail(String

Open External Application From JavaFX

这一生的挚爱 提交于 2019-12-13 14:08:15
问题 I found a way to open a link on default browser using HostServices. getHostServices().showDocument("http://www.google.com"); Is there any way to open a media in default media player? Is there any way to launch a specific File or Application ? 回答1: If you want to either open a URL which has an http: scheme in the browser, or open a file using the default application for that file type, the HostServices.showDocument(...) method you referenced provides a "pure JavaFX" way to do this. Note that

Javafx Text area disable scroll bar

送分小仙女□ 提交于 2019-12-13 13:42:14
问题 At the moment, I'm making a lw interpreter for a programming language. http://www.muppetlabs.com/~breadbox/bf/ Anyways, I'm trying to implement a text area, but I want the scroll bars to be hidden. I've looked at multiple tutorials to do this, but none of them seemed to work. Here is the code for my fxml window <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.shape.*?> <?import javafx.scene.text.*?> <?import java.lang.*?> <?import javafx.scene.control.*?> <?import javafx.scene

JavaFX: two bound properties for Task

二次信任 提交于 2019-12-13 12:28:44
问题 I have a JavaFX 8 application and want to allow a Task to modify two different UI elements. As I understand it, if I had a single Label to modify, I could bind to the Label with mylabel.textProperty().bind(mytask.messageProperty()) and use updateMessage() in the Task. How can I do this with two different arbitrary types? I've looked at the examples in the concurrency and JavaFX docs but to me they do not explain this well. I understand a Task inherently has Message(String), Progress(double

JavaFX Homework [duplicate]

白昼怎懂夜的黑 提交于 2019-12-13 10:13:38
问题 This question already has an answer here : JavaFX Making Copies of Same Animation (1 answer) Closed 2 years ago . Looking to finish out this homework. I have a program that will show up to 5 "FanPanes" that will have a fan spinning. You can use a slider to control the speed of the fans, and use buttons to stop, play, and reverse the directions of the fans. I am having issues with figuring out how make my slider ("slider2" is what I want to use for it from the class FanPane) update the number

Change the size of the caret in a TextField (JavaFX 8)

邮差的信 提交于 2019-12-13 09:35:37
问题 I'm trying to resize the caret in a TextField without modifying the font size, but I can not do it. Does anyone know how to do that? Thanks! 回答1: I have no idea why you would want to do this. And this probably won't give you exactly what you want, but it does change the size of the caret. Note that the big caret will still be clipped to be within the bounds of the containing TextField. The small line between the m and the a is the small caret. Image transfer into stackoverflow reduced clarity

How to create an array of TextFields in JavaFX

六月ゝ 毕业季﹏ 提交于 2019-12-13 08:46:23
问题 I am converting an app written using Swing to JavaFX. I need an array of TextField s that I can manipulate collectively and as individual array members addressed by the array index. The following code works in Swing but I cannot find the equivalent in JavaFX, using TextField instead of JTextField . How can I achieve this in JavaFX? private ArrayList<JTextField> fieldList= new ArrayList<JTextField>(); fieldList.add(fldCompletion); fieldList.add(fldHrsToDate); fieldList.add(fldHrsToComplete);

Timer in Java FX [duplicate]

本小妞迷上赌 提交于 2019-12-13 08:35:31
问题 This question already has answers here : How to avoid Not on FX application thread; currentThread = JavaFX Application Thread error? (7 answers) Closed 2 years ago . I have exeption in Timer whith use JavaFX. timer imported of java.util code of timer: @FXML private Label q1lt; private final Timer t1=new Timer(); TimerTask t2=new TimerTask(){ int i = 300000; public void run() { if(i==0){ file(prim+" "+b+"Балів","D://Результат.txt"); t1.cancel(); return; } i--; int h,m,s; h=i/360000; m=i/6000

JavaFX Dynamic TableView from URL json

[亡魂溺海] 提交于 2019-12-13 08:26:19
问题 I want to create a dynamic tableview that gets its data from a json provided by a webpage. The thing is that whenever the data from the json is out of range (for example the range should be 0.8 - 0.9, but it reads 1.1), the table automatically updates the observablelist with a "RED SQUARE" image. If the data is within range, it shows a "BLUE SQUARE" image. It's like a status indicator so that the user knows if the data is correct or not. I have this code: public ObservableList<PumpSites> list