tablecolumn

Accessing nested properties in JavaFx TableView / TableColumn

假装没事ソ 提交于 2021-02-07 13:23:41
问题 I havea TableView, and I access properties of the list's objects as follows. This works just fine. <TableColumn fx:id="dateColumn" editable="false" prefWidth="135.0" text="Date"> <cellValueFactory> <PropertyValueFactory property="date" /> </cellValueFactory> </TableColumn> However, I'd like to access a nested property of the object, for example: <TableColumn prefWidth="100.0" text="Course"> <cellValueFactory> <PropertyValueFactory property="house.bathroom"/> </cellValueFactory> </TableColumn>

display two decimal places of a float in a TableView JavaFx

有些话、适合烂在心里 提交于 2020-03-25 12:32:15
问题 So basically I'm developing this Javafx app following the DAO pattern... and I want the floats to have that .00 end instead of .0 (to represents the balance.. money ) balance records in tableview with .0 here's how I initialized the tableview components idC.setCellValueFactory(cellData -> cellData.getValue().idProperty().asObject()); balanceC.setCellValueFactory(cellData -> cellData.getValue().balanceProperty().asObject()); dateC.setCellValueFactory(cellData -> cellData.getValue()

How to fill TableView with ObservableMap<KeyObject, ObservableList<CustomObject>> in JavaFX

守給你的承諾、 提交于 2020-02-04 22:22:47
问题 My Java programm produces a lot of data, with wich I construct individual ResultObject. Because only certain ResultsObjects will be of interest, I populate an ObservableHashMap<> with my results. The CustomObject consists of a handful ints + doubles and one JSONObject. With this CustomObject I want to map similar ResultObjects(which have certain properties in common) to that one CustomObject. While mapping and handling those results works as intended, I am pretty much helpless to populate a

How to fill TableView with ObservableMap<KeyObject, ObservableList<CustomObject>> in JavaFX

倾然丶 夕夏残阳落幕 提交于 2020-02-04 22:20:26
问题 My Java programm produces a lot of data, with wich I construct individual ResultObject. Because only certain ResultsObjects will be of interest, I populate an ObservableHashMap<> with my results. The CustomObject consists of a handful ints + doubles and one JSONObject. With this CustomObject I want to map similar ResultObjects(which have certain properties in common) to that one CustomObject. While mapping and handling those results works as intended, I am pretty much helpless to populate a

javafx: Custom TableColumn

陌路散爱 提交于 2020-01-25 21:32:31
问题 I want to make a custom TableColumn that when in editable state it's cells will be auto complete TextField s, here is what I tried: public static <T,S> void setAutoCompleteTableColumn(TableColumn<T,S> column, List items){ column.setCellFactory(param -> { return new TableCell<T, S>(){ final TextField textField = new TextField(); @Override protected void updateItem(S item, boolean empty) { super.updateItem(item, empty); if(item == null){ setGraphic(null); }else { setGraphic(textField);

javafx: Custom TableColumn

为君一笑 提交于 2020-01-25 21:32:07
问题 I want to make a custom TableColumn that when in editable state it's cells will be auto complete TextField s, here is what I tried: public static <T,S> void setAutoCompleteTableColumn(TableColumn<T,S> column, List items){ column.setCellFactory(param -> { return new TableCell<T, S>(){ final TextField textField = new TextField(); @Override protected void updateItem(S item, boolean empty) { super.updateItem(item, empty); if(item == null){ setGraphic(null); }else { setGraphic(textField);

How to show a list on table column, with few fields of list items

Deadly 提交于 2020-01-22 02:46:06
问题 UPDATE : This qustion moved to TableColumn should only show one specific value of a complex data type because it's more specific I want to populate a table with a complex data type Person containing name , id and a List<Person> . At the moment I get a table with the correct name , id and a third column with the whole information of other Person s but it should only show the name of the Persons s. Is there any way that my third column shows only the Person.getName() values? Keywords, solutions

The JTable Edit/UnEdit Code Not Working For Re Arranged JTable Columns

喜你入骨 提交于 2020-01-11 12:52:00
问题 I am using the following code for Edit/UnEdit for my JTable Columns, but when the user re-arranged the columns the following code is not working SSCCE of the code is following: import javax.swing.JTable; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; public class Main { public static void main(String[] argv) throws Exception { TableModel model = new DefaultTableModel() { public boolean isCellEditable(int rowIndex, int mColIndex) { boolean flag = false; if

How to show a list on table column, with few fields of list items

早过忘川 提交于 2020-01-07 03:34:53
问题 UPDATE : This qustion moved to TableColumn should only show one specific value of a complex data type because it's more specific I want to populate a table with a complex data type Person containing name , id and a List<Person> . At the moment I get a table with the correct name , id and a third column with the whole information of other Person s but it should only show the name of the Persons s. Is there any way that my third column shows only the Person.getName() values? Keywords, solutions

Java - table - change table format

◇◆丶佛笑我妖孽 提交于 2020-01-05 07:36:11
问题 how can I change table format in java? Now, I have left table, but I want my table looks like right table. import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.table.TableCellRenderer; public class Farby extends JTable { public Farby(String[][] data, String[] fields) { super(data, fields); } @Override public Component prepareRenderer(TableCellRenderer renderer,