javafx

Tableview visible rows

流过昼夜 提交于 2020-02-02 06:08:24
问题 I want to implement a custom scroll functionality for a tableview. Therefore access to the visible rows and cells is needed. How to detect the visible cells and rows in a JavaFX tableview? I don't have found anything about that in the API description for tableview. Thanks 回答1: Try this in a TableView to scroll to a wanted row. I've tried with table.scrollTo(index) but it doesn't scroll properly as it sets the wanted row as the first visible. I've written the next code on my controller. Here

ListView styling in JavaFX

烂漫一生 提交于 2020-02-02 03:14:06
问题 I have a listview. I want to change the color of the background and the text fill. I have tried doing the following: playlistView.setStyle("-fx-background-color: blue; -fx-text-fill: black;"); But, this doesn't work. However, the following is working: playlistView.setStyle("-fx-font-size: 24px; -fx-font-family: 'SketchFlow Print';"); Can you please tell me how to get the background and text-fill to work? Thank you. 回答1: You can use the following CSS styles: .list-view .list-cell:even { -fx

JavaFX TableColumn resize to fit cell content

帅比萌擦擦* 提交于 2020-02-01 17:38:45
问题 I'm looking for a way to resize a TableColumn in a TableView so that all of the content is visible in each cell (i.e. no truncation). I noticed that double clicking on the column divider's does auto fit the column to the contents of its cells. Is there a way to trigger this programmatically? 回答1: Digging through the javafx source, I found that the actual method called when you click TableView columns divider is /* * FIXME: Naive implementation ahead * Attempts to resize column based on the

javafx webview not supporting Ajax web features

不羁的心 提交于 2020-02-01 04:58:05
问题 I am trying to open webpage in webview using JavaFx . Its opening the web page properly but its not supporting the Ajax based web features like partial refreshing and new window popup handling I am using the following code final Group group= new Group(); Scene scene= new Scene(group); fxpanel.setScene(scene); WebView webview = new WebView (); group.getChildren().add(webview); eng= webview.getEngine(); eng.setJavaScriptEnabled(true); try{ String url="http://www.abc.com"; eng.load(url); eng

which Point2D should I use

那年仲夏 提交于 2020-01-31 18:02:51
问题 The jdk8 contains 3 different Point2D classes. java.awt.geom.Point2D in the rt.jar javafx.geometry.Point2D in the jfxrt.jar com.sun.javafx.geom.Point2D in the jfxrt.jar Which Point2D class should I use ? Use/application: I want to perform geometric calculations to determine if a point intersects with a line. (e.g. Line2D.contains(Point2D) ) Given the fact that I'm also using other javafx features (i.e. also in the javafx.* package). My first guess, would be to use the javafx.geometry.Point2D

JavaFX update progress bar and wait for threads to complete

早过忘川 提交于 2020-01-30 13:08:08
问题 I'm trying to update a progress bar in Java FX. My first problem was that the window said "not responding" instead of actually updating. It just froze and then after the tasks were done, the progress bar became full. So I found out that I had to use multithreading and implemented it like this. overallList.clear(); progressbar.setprogress(0); for(Object obj : list) { class ThreadProgress implements Runnable { // inner class public void run() { thisList = scrape(obj); overallList.add(thisList);

Missing titlebar on javafx app, with OpenJFX

十年热恋 提交于 2020-01-30 12:03:07
问题 I'm currently building an application with OpenJDK 11 and OpenJFX. It compiles just fine, and starts, but there is no titlebar, and if i click close to the edge of the app, it registers as a click on whatever window is behind it. I am using intelliJ idea, and it took a while to figure out how to even use openjfx with it, anyhow, here's the system details: running elementary OS 5.0 Juno (based off of Ubuntu 18.04, everything is GTK) IntelliJ Idea (Community) 2018 installed as a snap. OpenJFX

Can't load css file in javafx 8

江枫思渺然 提交于 2020-01-30 11:26:06
问题 Scene listenMenu = new Scene(root, 250, 272); listenMenu.getStylesheets().add("styles.css"); This always worked for me to load my css file, but after a small IntelliJ update it gives me this error: Juni 20, 2018 1:16:45 NACHM. com.sun.javafx.css.StyleManagerloadStylesheetUnPrivileged WARNING: Resource "styles.css" not found. I tried to look for a solution on here but but nothing works. Taking the url and the toExternalForm() like this: listenMenu.getStylesheets().add(getClass().getResource(

Exception in Application start method Caused by: java.lang.StackOverflowError

家住魔仙堡 提交于 2020-01-30 11:06:27
问题 I'm trying to make a program that will switch between JavaFX scenes, however I'm getting a StackOverFlow error that's linking back to at Login.<init>(Login.java:45) which is the line root = FXMLLoader.load(this.getClass().getClassLoader().getResource("Login.fxml")); in my Login controller class. MAIN import javafx.application.Application; import javafx.scene.Scene; import javafx.stage.Stage; import java.net.Socket; import java.security.SecureRandom; import java.util.Random; public class Main

Exception in Application start method Caused by: java.lang.StackOverflowError

久未见 提交于 2020-01-30 11:04:34
问题 I'm trying to make a program that will switch between JavaFX scenes, however I'm getting a StackOverFlow error that's linking back to at Login.<init>(Login.java:45) which is the line root = FXMLLoader.load(this.getClass().getClassLoader().getResource("Login.fxml")); in my Login controller class. MAIN import javafx.application.Application; import javafx.scene.Scene; import javafx.stage.Stage; import java.net.Socket; import java.security.SecureRandom; import java.util.Random; public class Main