Timing in JTable

Is it possible to add a DateTimePicker to a JTable Cell. In a specific column, you need to update the date and time. You can add such a component to JTable

+3
source share
6 answers

Try using the FLib-JCalendar component as a CellEditor element in JTable.
(and post a working example here if you earned it)

+2
source

, TableCellRenderer, TableCellEditor. @Jens Schauder, tutorial . tutorial example JCheckBox.

+2

LGoodDatePicker TableEditor. DatePicker, TimePicker DateTimePicker Swing JTable ( SwingX JXTable).

: .

.

, DateTimePicker JTable:

// Create a table.
JTable table = new JTable(new DemoTableModel());

// Add the DateTimeTableEditor as the default editor and renderer for
// the LocalDateTime data type.
table.setDefaultEditor(LocalDateTime.class, new DateTimeTableEditor());
table.setDefaultRenderer(LocalDateTime.class, new DateTimeTableEditor());

// Explicitly set the default editor and renderer for column index 0.
TableColumn column = table.getColumnModel().getColumn(0);
column.setCellEditor(table.getDefaultEditor(LocalDateTime.class));
column.setCellRenderer(table.getDefaultRenderer(LocalDateTime.class));

, . : . : "LGoodDatePicker/Project/src/main/java/com/github/lgooddatepicker/demo/TableEditorsDemo.java".

​​ Java .

Github:
https://github.com/LGoodDatePicker/LGoodDatePicker.

. Table Editors with Demo Screenshot

Screenshots of Date and Time

Full demo screenshot

+2

, DatePicker 0:

    TableColumn dateColumn = YOURTABLE.getColumnModel().getColumn(0);
    dateColumn.setCellEditor(new DatePickerCellEditor());
+2

Using the Jens link premise and applying this logic with the link below, you can add a date picker to JTable, just be careful when combining JCheckbox, JCombobox and a time collector in JTable to get a little messy, but I think it can be solved with listener focus, it will take some time t.

I am working on such a rendering table, and I will publish it online when I do this.

Link: select date and time in JAVA

0
source

Source: https://habr.com/ru/post/1761444/


All Articles