javafx-8

How to read RTF file and display in JavaFX

左心房为你撑大大i 提交于 2019-12-11 04:03:18
问题 My goal is to read from a rich text formatted file and then display it's contents exactly how they appear with formatting in a JavaFX TextArea. I have already completed this with a plain text file (ANSI encoded). When I try to read from an rtf file it displays all the text as well as the formatting symbols. Is there a function that interprets these formatting symbols as it scans it in? It's been difficult trying to find an answer to this, so any help is greatly appreciated! You can see my

Scrolling XYChart with JavaFX

末鹿安然 提交于 2019-12-11 03:51:21
问题 I'm trying to implement a network usage graph similar to the one in Windows. I'm showing the last 30 seconds worth of data with new values appearing at the right hand side and moving to the left. I've got it all working apart from I cannot get the vertical grid lines to move with the data. Instead the major ticks always stay static and the just the line on the graph moves. i.e. in the image below I'm expecting the major ticks to stay at the tickUnit of 5 and be shown at 55 and 60. The label

Problems with accessing GridPane Node

99封情书 提交于 2019-12-11 03:35:36
问题 i hope you can help me with a little project I want to do. I'm trying to create a video game using JavaFX for the GUI and I'm having some troubles. Here is the code I made for practice and I don't know why this don't work. public class Main extends Application { public GridPane map; private int MAXH = 40; private int MAXV = 40; Random r = new Random(); @Override public void start(Stage primaryStage) throws Exception{ map = new GridPane(); map.setGridLinesVisible(true); map.addEventHandler

Disable caching of JavaFX Chart background image

╄→гoц情女王★ 提交于 2019-12-11 03:25:50
问题 I have a simple LineChart, that opens in a new window on press of a button. This LineChart uses an image stored on harddrive as its background. If I close the window countaining the LineChart, change the image file (or delete it) and reopen the window, the old image is loaded again. I disabled the cache of my LineChart in Scene Builder and in my code, but it doesn't help. Can somebody give me a hint what I'm missing? Here's a simple code-snippet of the LineChart-Controller that I'm using for

TableCell, getting its position in TableView

家住魔仙堡 提交于 2019-12-11 03:15:51
问题 How can I get position of TableCell in class implementation so I can do something like this: ? @Override public void updateItem(Integer item, boolean empty) { super.updateItem(item, empty); int x = thisCellColumnNumber(); int y = thisCellRowNumber(); if((x == 2) && (y == 3)) setStyle("....."); 回答1: You can get the actual TableColumn with this.getTableColumn(); . If you really need the index, you could do TableColumn<...> column = getTableColumn(); int colIndex = getTableView().getColumns()

JavaFX: can controller be an abstract class?

吃可爱长大的小学妹 提交于 2019-12-11 02:59:54
问题 I have been working on this part of code for a day and just can't figure out why it always generates error. I have a controller and FXML. They worked perfectly. Then it came to my mind that I want to reuse this particular controller with a abstract updateSelect() function. Therefore, I change the controller to abstract. The code compiled just fine. Until I try to run this part of code. @FXML private void mnuProjMember_onClick(ActionEvent event) { mainContent.getChildren().clear(); FXMLLoader

ComboBox Crash javafx 8 JDK 51

浪子不回头ぞ 提交于 2019-12-11 02:57:31
问题 So my program that's been using ComboBox has stopped working. Before i updated my jdk from 8u20 to 8u50, now when the same program is run without any changes to it, if the ComboBox is selected without tabbing to it first, it causes the program to freeze up and then crash. I've only seen this in one other spot on the web after searching and the only way to prevent the crash is to press tab until the combobox is selected and use the arrow keys to select. Has anyone else heard of this? Here is

How to change TextArea background color more than once?

一世执手 提交于 2019-12-11 02:34:10
问题 I have a TextArea in my JavaFX program that I want to be able to allow the user to set the background color of. I was able to figure out how to change the background color using an external css file by doing this. .text-area .content { -fx-background-color: blue ; } However, this would only allow me to have a default setting and the user would not be able to select a color from a menu to change it. I also tried doing this in Java code. textArea.setStyle("-fx-background-color: green"); But it

Place MeshVIew in Scene

旧巷老猫 提交于 2019-12-11 02:28:21
问题 I want to display a 3D figures on a MeshView in JavaFX. Since I want to build a simple model viewer I created tabs for clarity. One of them contains a group (meshGroup) where I add a SubScene (with the MeshView in a group) on runtime. I'm not able to place that model in the middle of the AnchorPane in full available size. ( I also tried Pane & HBox ). Image <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.*?> <?import javafx.scene.control.*?> <?import java.lang.*?> <?import javafx

JavaFX 2D shapes in 3D space

随声附和 提交于 2019-12-11 02:19:48
问题 I know that if I rotate an object, which extends javafx.scene.shape.Shape , I can transform it into 3D space, even though it was primarily designed to be in 2D (at least as far as I know). Let's say I have a 3D scene (perspective camera and depth buffer are used), where various MeshView s occur. Some are used for areas, others for lines. In both cases those shapes must be triangulated in order to draw them with a TriangleMesh , which is often nontrivial. Now when I change the drawing of these