fxml

Context menu only showing for a few TableView rows javafx fxml

☆樱花仙子☆ 提交于 2019-12-23 05:11:30
问题 I have a TableView, in which i need each row to have a context menu. In this context menu there should be an Edit option and a Remove option. I wrote this class: public class ContextMenuRowFactory<T> implements Callback<TableView<T>, TableRow<T>> { private List<MenuItem> menuItems; public List<MenuItem> getMenuItems() { return menuItems; } public void setMenuItems(List<MenuItem> menuItems) { this.menuItems = menuItems; } @Override public TableRow<T> call(TableView<T> view) { final TableRow<T>

Change the color of a single data cell in a TableView

前提是你 提交于 2019-12-23 03:22:02
问题 I have a column in a table view and i want: Green font if i write "OK", red font if i write "KO". The problem is that i try to modify this value in the method "setCellFactory" but it doesn't work because the String have all the same color (red or green) that is the color of the last String... For istance if my last value is "KO" all the String in my column will be red. How can i do? Thank you for the help! reader.getSampleController().xmlMatch.setCellFactory(new Callback<TableColumn,

Change the color of a single data cell in a TableView

五迷三道 提交于 2019-12-23 03:21:38
问题 I have a column in a table view and i want: Green font if i write "OK", red font if i write "KO". The problem is that i try to modify this value in the method "setCellFactory" but it doesn't work because the String have all the same color (red or green) that is the color of the last String... For istance if my last value is "KO" all the String in my column will be red. How can i do? Thank you for the help! reader.getSampleController().xmlMatch.setCellFactory(new Callback<TableColumn,

FXML layout not loaded when run jar outside Eclipse

社会主义新天地 提交于 2019-12-23 02:46:23
问题 I try to load my fxml layout file as follows: FXMLLoader loader = new FXMLLoader(); loader.setLocation(getClass().getResource("view/MainLayout.fxml")); AnchorPane personOverview = (AnchorPane) loader.load(); When I run application in Eclipse all works, but when I deployed application with Ant, I've got an error: After building project my folder structure is: and the same in deployed jar I understand that there might be a problem with difference in resolving path inside jar and in eclipse, but

How to give TableColumns a relative width in FXML?

依然范特西╮ 提交于 2019-12-23 01:15:18
问题 Is it possible to get a resizing TableView in FXML, where each columns resizes itself relatively? I know it's possible in code, but I'm specifically looking for an FXML approach. This is the current approach: <BorderPane xmlns:fx="http://javafx.com/fxml"> <fx:define> <Double fx:id="tableViewWidth" fx:value="600"/> </fx:define> <center> <TableView fx:id="expensesTableView" editable="true" prefWidth="${tableViewWidth}"> <columnResizePolicy> <TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />

JavaFX Text inside Pane Layout is overlapping other Elements when using translateX() and translateY()

好久不见. 提交于 2019-12-22 09:11:08
问题 The image below is the description of what is happening: I have a Pane which contains a Text and i am using the code below to make a marquee like effect of the Text . So when the Pane has not enough space to display the text , an animation is starting and the text has to go back and forth so the user can see it whole. The problem is that i was expecting the text when going to the left using setTranslateX() to disappear and not overlape the other elements.For example here is overlapping the

Restart an Application in JavaFx

主宰稳场 提交于 2019-12-22 06:44:58
问题 I want to close and then restart a already running application (automatically) that I am making, by clicking a button or something like that, I want to do that for the purpose of re-launching the application in an other language, I'm new to JavaFx and Java in general, please can you give me a solution for this problem ? 回答1: This question lacks details. You did mention a JavaFX application but it is important to know how that application is being deployed. Is it running in the web browser, as

Remove arrow on JavaFX menuButton

亡梦爱人 提交于 2019-12-22 05:39:09
问题 Hi JavaFX Stylesheet expert, How do I remove the default arrow on JavaFX menuButton. I have figured how to change the color and make in unvisible with .menu-button { -fx-mark-color: transparent; } or .menu-button .arrow { -fx-background-color: transparent; } but, I don't want the gap because of the unvisible arrow. Thanks for your advice. Best Regards, Ivan 回答1: If we look into the source code of MenuButtonSkinBase , the sub structure of MenuButton seems to be MenuButton |——— label

fxml combobox, get the selected value into javafx

六眼飞鱼酱① 提交于 2019-12-22 02:57:50
问题 how can i catch the selected value of a fxml combobox and implement it into a javafx class? i gave the combobox the fx:id "sample" and created a button with onAction="#test" and tried .getValue and .getPromptText. @FXML private ComboBox<String> Sample; @FXML protected void test( ActionEvent event ) { String output = (String) Sample.getValue(); System.out.println(output); String output = (String) Sample.getPromptText(); System.out.println(output); } If i try to run it i get an error: java.lang

Scala - Get FXML UI-Elements

Deadly 提交于 2019-12-22 00:42:19
问题 I´m working on a Scala/JavaFX project with IntelliJ and a plugin for scala. The typical way in Java to access elements of your fxml-file is to set an id for each element you want to access and then in your controllerclass declare a variable like "@FXML private Label mylabelid;". In Scala it works almost the same way as you can see in my source code. BUT i get a NullPointerException in line 73 (marked with a PROBLEM-comment). This is the only label, which is just set to null. I tried diffrent