tablecolumn

Populate tableview in javafx

放肆的年华 提交于 2019-12-11 11:57:43
问题 I want to populate a TableView in JavaFX. My class is Manual and it has another object like attribute ( User ). How can I populate a table column with the username from the User object. columnVanzator.setCellFactory(new Callback<TableColumn<Manual, User>, TableCell<Manual, User>>() { @Override public TableCell<Manual, User> call(TableColumn<Manual, User> arg0) { final TableCell<Manual, User> cell = new TableCell<Manual, User>() { @Override public void updateItem(final User item, boolean empty

Automatically adjust Jtable Column to fit content

我是研究僧i 提交于 2019-12-09 17:01:23
问题 I am trying to match the JTable column width depending on the data inside. My Code: for(int column = 0; column < gui.testsuiteInfoTable.getColumnCount(); column ++){ int width =0; for (int row = 0; row < gui.testsuiteInfoTable.getRowCount(); row++) { TableCellRenderer renderer = gui.testsuiteInfoTable.getCellRenderer(row, column); Component comp = gui.testsuiteInfoTable.prepareRenderer(renderer, row, column); width = Math.max (comp.getPreferredSize().width, width); System.out.println(width);

Is it possible to disable editable table columns on a row basis in JavaFX8?

笑着哭i 提交于 2019-12-08 06:17:17
问题 I have a use case which I would assume is pretty standard, however I haven't been able to find an example on exactly how to do this, or if it's possible. Let's assume I have the following TableView First Name Last Name Street NewRecord Tom Smith Main St. Yes Mike Smith First St. No In this case, the grid should have the first three cells editable since the record is new, however when the record is not new then the Last Name cell should be disabled. I tried this in the CellFactory and

Get data from database Android

独自空忆成欢 提交于 2019-12-08 00:57:35
问题 I have a page which can retrieve user data from database but after whole day of trying, I am only able to get the table column name but not the value inside. this is my code to create database public static final String LASTLOGIN = "lastuser"; public static final String USER_ID = "suser_id"; public static final String USER_NAME = "suser_name"; public static final String USER_PASSWORD = "spassword"; public static final String PRIME_ID = "id"; private static final String TABLE_USER = "create

javafx.scene.control.TableColumn cannot be cast to javafx.scene.control.TableColumn$CellDataFeatures

强颜欢笑 提交于 2019-12-06 10:51:00
问题 I have a problem when it comes to filling a javafx tableview. I am currently working on a GUI based event management tool (for university) and I am stuck trying to fill a Tableview list, that should be in the center of a border pane layout. This is my code (its pretty long thought, its the main window function): import java.sql.Date; import java.sql.SQLException; import java.util.List; //--main imports--// import javafx.application.Application; import javafx.beans.property

JTable - Toggle Columns with PopupMenu (like Windows Explorer)

跟風遠走 提交于 2019-12-06 10:04:10
问题 How would I go about creating a JTable in Swing that allows the user to toggle columns with a simple dropdown meun, like in Windows Explorer folders? My table has 12 columns, and the screen cannot fit all the information on the screen at once. Since the user may not need to see many of these columns, this seems like the best option. I assume it would use a JPopupMenu that appears when the user right-clicks the table header, with a JCheckBoxMenuItem for each column. Here's a screenshot of

Get data from database Android

大憨熊 提交于 2019-12-06 08:05:43
I have a page which can retrieve user data from database but after whole day of trying, I am only able to get the table column name but not the value inside. this is my code to create database public static final String LASTLOGIN = "lastuser"; public static final String USER_ID = "suser_id"; public static final String USER_NAME = "suser_name"; public static final String USER_PASSWORD = "spassword"; public static final String PRIME_ID = "id"; private static final String TABLE_USER = "create table "+ LASTLOGIN+" (" +PRIME_ID+" integer primary key autoincrement, " + USER_ID + " text, " + USER

Create a framework type column header for select all in JavaFX 8

社会主义新天地 提交于 2019-12-06 07:33:17
问题 I am looking to create a custom TableColumn which is a CheckBox control which represents if the row is selected or not. We don't want to use the standard SHIFT or CONTROL + CLICK to handle this as users tend to click inadvertantly and lose their selection. What I would like to do is the following: In this case the column should not be part of the underlying data model, and simply represent what is selected or not. It shouldn't be dependent on the data model in any way. If the user selects the

JTable - Toggle Columns with PopupMenu (like Windows Explorer)

十年热恋 提交于 2019-12-04 17:29:54
How would I go about creating a JTable in Swing that allows the user to toggle columns with a simple dropdown meun, like in Windows Explorer folders? My table has 12 columns, and the screen cannot fit all the information on the screen at once. Since the user may not need to see many of these columns, this seems like the best option. I assume it would use a JPopupMenu that appears when the user right-clicks the table header, with a JCheckBoxMenuItem for each column. Here's a screenshot of Window's column toggler that I'm trying to replicate: How would I go about creating a JTable in Swing that

Create a framework type column header for select all in JavaFX 8

心不动则不痛 提交于 2019-12-04 15:07:42
I am looking to create a custom TableColumn which is a CheckBox control which represents if the row is selected or not. We don't want to use the standard SHIFT or CONTROL + CLICK to handle this as users tend to click inadvertantly and lose their selection. What I would like to do is the following: In this case the column should not be part of the underlying data model, and simply represent what is selected or not. It shouldn't be dependent on the data model in any way. If the user selects the check box in the column header, it should select all the records in the table (not just the visible