javafx-2

Is JavaFX complete replacement of Swing?

倖福魔咒の 提交于 2020-08-01 09:32:05
问题 I had a Java Desktop Application in which graphical user interface had designed in swing. After we came to know that JavaFX replacing Swing We have replaced graphical user interface with JavaFX. "6. Is JavaFX replacing Swing as the new client UI library for Java SE? Yes. However, Swing will remain part of the Java SE specification for the foreseeable future, and is included in the JRE. On one hand, Swing is widely used in existing Java desktop applications, but relies on an old architecture,

How to display only the filename in a JavaFX TreeView?

你说的曾经没有我的故事 提交于 2020-07-30 04:20:16
问题 So i have figured out how to get all the files and directories and add them to the treeview but it shows me the complete file path: C/user/file.txt i just want the file or folder name and not the path. The code to create the list is as follows: private TreeItem<File> buildFileSys(File dir, TreeItem<File> parent){ TreeItem<File> root = new TreeItem<>(dir); root.setExpanded(false); File[] files = dir.listFiles(); for (File file : files) { if (file.isDirectory()) { buildFileSys(file,root); }

button inside column for each row in tableview

回眸只為那壹抹淺笑 提交于 2020-06-28 03:46:37
问题 In my TableView I have column with button for each row for update so I need when click the button to take all the values from the row to a new fxml window This is my contractor class: public class constractor { private String co_id; private String co_name; private String co_address; private String co_create_date; private String co_description; private String co_mobile; private String co_type_compile; private String co_status; private String co_type_model; private Button button; public

Getting selected element from ListView

廉价感情. 提交于 2020-06-22 09:40:05
问题 I modify a ListView with the results from a database search in order to use that selection to make another DB request later on. I want to get the field value of that ListView . What method can I use for that? I just thought I can also add an event to the onclick and keep it on an attribute for the controller. Is that acceptable too? 回答1: Say with list view like this: ListView<String> listView =new ListView<String>(); Getting selected element from ListView: listView.getSelectionModel()

Getting selected element from ListView

╄→尐↘猪︶ㄣ 提交于 2020-06-22 09:39:17
问题 I modify a ListView with the results from a database search in order to use that selection to make another DB request later on. I want to get the field value of that ListView . What method can I use for that? I just thought I can also add an event to the onclick and keep it on an attribute for the controller. Is that acceptable too? 回答1: Say with list view like this: ListView<String> listView =new ListView<String>(); Getting selected element from ListView: listView.getSelectionModel()

Can't populate JavaFX TableView created in SceneBuilder 2

谁说胖子不能爱 提交于 2020-06-10 06:43:06
问题 I am trying to re-create the table view sample using scene builder 2, but my TableView couldn’t be populated. I defined my table in JavaFx SceneBuilder like so: <?xml version="1.0" encoding="UTF-8"?> <?import java.lang.*?> <?import java.util.*?> <?import javafx.scene.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <AnchorPane id="AnchorPane" prefHeight="380.0" prefWidth="462.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8" fx:controller=

javafx NullPointerException with controlsfx Notifications componnets

不打扰是莪最后的温柔 提交于 2020-05-23 15:54:05
问题 I want to develop an application that uses controlsfx Notifications to show some notifications in system tray mode. In normal mode my application works well and notification can be shown successfully.but when I hide stage in system tray , NullPointerException occurs. I don't know how i can fix this problem. import java.awt.AWTException; import java.awt.MenuItem; import java.awt.PopupMenu; import java.awt.SystemTray; import java.awt.Toolkit; import java.awt.TrayIcon; import java.awt.event

How to create tabs with icons in JavaFX

亡梦爱人 提交于 2020-05-09 19:43:18
问题 I want to create tabs panel with icons similar to the Firefox configuration panel with JavaFX: Is there any example which I can use to see how to implement this? 回答1: Tabs, like many other elements in JavaFX, have a method called setGraphic(Node value) , in which you can put any JavaFX node. Example: import javafx.application.Application; import javafx.geometry.Pos; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.Tab; import

How to communicate between the Model and View in a Java FX FXML application?

懵懂的女人 提交于 2020-04-16 07:58:08
问题 Disclaimer: I'm very new to JavaFX and Model-View-Controller design principles. Here's my basic situation: I have a ScreenManager similar to the one outlined in this tutorial. Using the screen manager, I switch between several FXML screens using basic action handling on the screen buttons. The problem is that one of these is a game screen with a map. I'll be drawing a tile-based map onto this game screen, so I went with a TilePane in my FXML file(if there's a better way to draw tiles to an

How to change ListView cell's text color in JavaFX using css

人走茶凉 提交于 2020-04-11 05:39:42
问题 So I have a list which is full of names from my database. Those names represent employees that work or used to work in the firm. I've seen that is possible to change cell's text color but when I apply it, it changes all of them. What I really want is to change color of the clients that are no more working. I've added "not active" in List so I can separate "active" and "not active" clients. Here is the code where I add employees names in the ArrayList: public ArrayList<String> search(String