javafx-8

JavaFX integration in Swing

[亡魂溺海] 提交于 2020-02-12 05:24:45
问题 I'm new to using JavaFX and I'm having some issues figuring out how to integrate an fxml file, in my swing application. Reading online I've found a way to load the fxml file,and displaying it on screen following this guide: Integrating JavaFX into Swing Applications what my code is supposed to do is to load the fxml file, that I've started to design with JavaFX Scene Builder, add the JFXPanel to a JPanel, and return it through a method call. this then gets added to a tabbedPanel in the main

How to open a new tab first when open new tab

 ̄綄美尐妖づ 提交于 2020-02-08 06:54:32
问题 I have a JavaFX TabPane in which I add new tabs dynamically when I click on a tree node. tabPane.getTabs().add(tab); tabPane.getSelectionModel().select(tab); Can you tell me how I can open a new tab and place it always first before the other tabs. 回答1: Try: tabPane.getTabs().add(0, tab); http://docs.oracle.com/javase/7/docs/api/java/util/List.html#add%28int,%20E%29 来源: https://stackoverflow.com/questions/17360079/how-to-open-a-new-tab-first-when-open-new-tab

How to open a new tab first when open new tab

天涯浪子 提交于 2020-02-08 06:54:12
问题 I have a JavaFX TabPane in which I add new tabs dynamically when I click on a tree node. tabPane.getTabs().add(tab); tabPane.getSelectionModel().select(tab); Can you tell me how I can open a new tab and place it always first before the other tabs. 回答1: Try: tabPane.getTabs().add(0, tab); http://docs.oracle.com/javase/7/docs/api/java/util/List.html#add%28int,%20E%29 来源: https://stackoverflow.com/questions/17360079/how-to-open-a-new-tab-first-when-open-new-tab

JavaFX - Set default CSS stylesheet for the whole Application

筅森魡賤 提交于 2020-02-05 07:40:12
问题 I'm pretty new to JavaFX, I'm trying to change my application aspect via CSS. First time it works fine, when I switch to another scene CSS' classes are not applied. Because my project has 10 scenes, I prefer to use a single CSS file to apply my style to all scenes by using this statement: StyleManager.getInstance().addUserAgentStylesheet(this.getClass().getResource("/style.css").toExternalForm()); into start() method. How can I apply to all scenes my CSS file globally? 回答1: You can do it with

Position labels to different sides in the parent pane

扶醉桌前 提交于 2020-02-05 06:23:26
问题 I have a question about positioning Text into Bar area. I created this example: import javafx.application.Application; import static javafx.application.Application.launch; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.layout.FlowPane; import javafx.scene.layout.HBox; import javafx.stage.Stage; public class MainApp extends Application { @Override public void start(Stage stage) throws Exception { FlowPane flow = new FlowPane(); flow.setPrefSize(900, 30);

Position labels to different sides in the parent pane

谁都会走 提交于 2020-02-05 06:22:30
问题 I have a question about positioning Text into Bar area. I created this example: import javafx.application.Application; import static javafx.application.Application.launch; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.layout.FlowPane; import javafx.scene.layout.HBox; import javafx.stage.Stage; public class MainApp extends Application { @Override public void start(Stage stage) throws Exception { FlowPane flow = new FlowPane(); flow.setPrefSize(900, 30);

JavaFX TableView containing ListView Updates, CellValueFactory

北城以北 提交于 2020-02-04 04:04:07
问题 I do have an engine which contains parts in a list like: UPDATE: i updated the text to provide an example I would like to have a TableView of engines which contains 2 Columns (name, parts). I want the parts Column to be rendered as a ListView within the TableCell, therefore i override the CellFactory of the column. import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; public class Part { private final

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: Disable horizontal scrollbar of TableView

久未见 提交于 2020-01-30 04:47:39
问题 I have the following question: I would like to disable the horizontal scrollbar of my TableView. It may not be visible, but also the TableView may not be scrolled horizontally either. The visibility of the horizontal scrollbar can be set in the CSS: .table-view *.scroll-bar:horizontal *.increment-button, .table-view *.scroll-bar:horizontal *.decrement-button { -fx-background-color: null; -fx-background-radius: 0; -fx-background-insets: 0; -fx-padding: 0; } .table-view *.scroll-bar:horizontal

java - open url in chrome browser only

本秂侑毒 提交于 2020-01-29 13:29:31
问题 I have an url, I am trying to open that url in web view of JavaFX but the content was not compatible with web view. It's only compatible to the chrome and firefox. So I would like to open that Url in chrome browser only instead of opening it in web view. is it possible?(I don't want to open it in default browser.) I tried the below code but we got the error as "Cannot run program "chrome": error=2, No such file or directory". Runtime.getRuntime().exec(new String[] { "Chrome", "http://goo.gl