javafx

Get a list of all TreeCell objects that currently exist in a TreeView

我的未来我决定 提交于 2019-12-24 14:46:42
问题 I know that TreeCell objects are generated dynamically by the TreeView using a cell factory. Is there a way to get a list of all TreeCell objects that currently exist? I suppose I could keep track of them by modifying the cell factory. As in, whenever I create a new cell add it to some list. But then I'm not sure how to remove cells from my list once the TreeView disposes them (because they went out of view). 回答1: My solution to this is to use weak references: [A] weak reference is a

JavaFX FXML table; why won't my data display

我的未来我决定 提交于 2019-12-24 14:42:49
问题 I'm trying to create a simple table using FXML. The table displays fine, but it's not displaying my data. Here's my main program. public final class TableTest extends Application { @Override public void start(final Stage primaryStage) { URL fxml = ClassLoader.getSystemClassLoader().getResource("Table.fxml"); FXMLLoader fxmlLoader = new FXMLLoader(fxml); TableController tableController = new TableController(); fxmlLoader.setController(tableController); try { Pane rootPane = (Pane) fxmlLoader

Javafx Gluon save XML File

不羁岁月 提交于 2019-12-24 14:34:26
问题 I Want to save a xml File on Android before I asked a questions how to Get a File now I'm stuck ;( I use Gluon(Netbeans plugin and did already everything what He said: JavaFXPorts(Gluon Plugin) Saving Files on Android Can you help me I want to save a XML File on Android, this is my Code yet: public static void loadConfig() throws JAXBException { if (ConfigFile.length() != 0) { JAXBContext jaxbContext = JAXBContext.newInstance(Info.class); Unmarshaller jaxbUnmarshaller = jaxbContext

JavaFX - Playing loop video

白昼怎懂夜的黑 提交于 2019-12-24 14:19:13
问题 How should I loop a video in JavaFX? I'm trying to just play a video one time after another, so I was looking for some sample code in many places and I could'nt make it work! This is what doesn't work for me: public MyMediaPlayer (){ media = new Media(getVideo()); mediaPlayer = new MediaPlayer(media); mediaView = new MediaView(mediaPlayer); startMediaPlayer(); } private String getVideo() { return getClass().getResource("videos/limbo.mp4").toString(); } public final void startMediaPlayer() {

Performance of StageStyle.TRANSPARENT

妖精的绣舞 提交于 2019-12-24 13:55:58
问题 I was thinking of glorifying my undecorated JavaFX stage with a drop shadow. I know how to do this with StageStyle.TRANSPARENT, but I noticed that as soon as I pass this flag to the Stage, the performance of my app drops approximately by 10x. Anyone have ideas what might cause this enormous performance drop? Is there any other way to add a drop shadow to an undecorated Stage? Perhaps hacking away with two stages would yield better performance? EDIT: OK, I'm trying this with two stages.. the

TextArea setScrollTop

喜你入骨 提交于 2019-12-24 13:52:08
问题 I created this simple example of TextArea import javafx.application.Application; import static javafx.application.Application.launch; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.TextArea; import javafx.scene.layout.HBox; import javafx.stage.Stage; public class MainApp extends Application { @Override public void start(Stage stage) throws Exception { HBox hbox = new HBox(); // Text Area TextArea dataPane = new TextArea();

Getting the Scrollbar/Scrollpane positions from JavaFX TextArea

我是研究僧i 提交于 2019-12-24 13:50:29
问题 Sooo, I have been gooling and looking through Oracle docs, but could not find any hint on how to gain access to the Scrollbar/Scrollpane inside my TextArea. As the text inside my TextArea exceeds the given bound, horizontal and vertical scrollbars appear... I would like to get the current position of the vertical scrollbar. I hope that someone can help. EDIT: This question referes to JavaFX, sorry for not properly pointing this out. 回答1: According to the Javadocs for TextArea, TextArea

Why isn't my background image being displayed in FXML

百般思念 提交于 2019-12-24 13:31:29
问题 I decided that I wanted to start learning FXML and the first thing that I wanted to do is create a background Image. I've added background images in javafx before and I thought that the process of adding background images in FXML would what somewhat similar to what you would do in javafx. What am I missing? Here is my FXML File <?xml version="1.0" encoding="UTF-8"?> <?import java.lang.*?> <?import java.util.*?> <?import javafx.scene.image.*?> <?import javafx.scene.*?> <?import javafx.scene

Running a function the background Javafx

喜夏-厌秋 提交于 2019-12-24 13:26:28
问题 I'm still pretty new to java and I am stuck for why this happens, when I click a button I have created the program crashes until the action is complete (SendPost();), the problem with this is that the function sends a post request and parses the response which takes around 10 seconds so the GUI crashes is unusable until the SendPost() has finished. I need it to run in the background somehow so it doesn't keep crashing when I add a timer. here is my code for the button EventHandler<ActionEvent

How does the optimization of Canvas drawImage work?

我们两清 提交于 2019-12-24 13:25:28
问题 Problem I tried to create a particle system using a Canvas. Interestingly the method drawImage is very fast. I got to 90.000 particles at 60 fps, even using drawImage. However, that was only with the same image. When I used different images for the particles the performance dropped down considerably. Then I changed the order of the images, so that e. g. first all particles of image1 are drawn, then all of image2, etc and the performance was good again. Question Does anyone know why that is?