tablecolumn

Java - table - change table format

纵饮孤独 提交于 2020-01-05 07:35:09
问题 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,

JavaFX Tableview make specific cells colored

只愿长相守 提交于 2019-12-25 09:01:07
问题 TableColumn tc = new TableColumn(); tc.getStyleClass.add(".style in css file") i set up the tablecolumn with css file. and i want to make each cell has different backgrounds. is there any way to do it? tableColumn row 1 bakcground color = green, row2 = red, row3 = blue....etc 回答1: You have to use setRowFactory for your TableView and change row style. A little example there: tableView.setRowFactory(new Callback<TableView<Data_type>, TableRow<Data_type>>(){ //There can define some colors. int

JavaFX2.2 not all table columns showing data with PropertyValueFactory?

巧了我就是萌 提交于 2019-12-25 05:32:03
问题 Goodevening everyone, I stumbled on a rather strange problem today and I have no clue what I'm doing wrong. It's about binding table columns with a PropertyValueFactory. I created the table view and table columns in FXML and set the appropriate fx:id's with Scene Builder. Now the problem is that some columns are showing the expected data and other columns are just empty. I add the items to the table view with following code when a user presses a button: ObservableList<User> olUsers = DA_User

JavaFX2.2 not all table columns showing data with PropertyValueFactory?

强颜欢笑 提交于 2019-12-25 05:31:59
问题 Goodevening everyone, I stumbled on a rather strange problem today and I have no clue what I'm doing wrong. It's about binding table columns with a PropertyValueFactory. I created the table view and table columns in FXML and set the appropriate fx:id's with Scene Builder. Now the problem is that some columns are showing the expected data and other columns are just empty. I add the items to the table view with following code when a user presses a button: ObservableList<User> olUsers = DA_User

Get javafx TableColumn from corresponding column-header Node

别说谁变了你拦得住时间么 提交于 2019-12-24 03:30:51
问题 I'm replacing the javafx context menus of a table's columns. The context menu will give the user access to excel like filtering of the table view. Everything is working, but i now wan't to open the context menu on any mouse click event on the column header. Not just the standard right click. The problem hereby is, that you can only get the header node by a lookupAll() inside the parent tableview. Due to the fact, that a lookup is only possible after the table view has been rendered, i call

How to delete row from table column javafx

我是研究僧i 提交于 2019-12-21 02:49:13
问题 These are my table columns Course and Description . If one clicks on a row (the row becomes 'active'/highlighted), and they press the Delete button it should remove that row, how do I do this? The code for my Course column: (and what event listener do I add to my delete button?) @SuppressWarnings("rawtypes") TableColumn courseCol = new TableColumn("Course"); courseCol.setMinWidth(300); courseCol.setCellValueFactory(new PropertyValueFactory<Courses, String>("firstName")); final Button

The table cells are empty in my tableview. JavaFX + Scenebuilder

放肆的年华 提交于 2019-12-17 14:22:27
问题 I am trying to get the table cells to show the string when i create new rows. But all the rows are just empty. Do anyone know what i am doing wrong? Here is the main class: package application; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Cursor; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class Main extends Application { @Override public void start(Stage primaryStage) throws Exception{ Parent root =

JavaFX TableView: Select the whole TableColumn and get the index

為{幸葍}努か 提交于 2019-12-12 22:56:06
问题 Assume that we have a simple Tableview with 3 columns (A, B, C). Each Column contains some data which is not important at the moment. I wondered if it would be possible to make only a whole column selectable (no matter where the user clicks in the column) and retrieve the ID and/or index of that column selected by the user? For example, the user clicks somewhere in the area of column B. In that case the whole column should be marked and index 2 should be returned. Any help would be

Updating a column in one table through a column in another table

痞子三分冷 提交于 2019-12-12 11:50:19
问题 I have 2 tables 'A' and 'B'. Both have a common column 'name' and linked with each other by a column 'id'. The column 'name' in the table A is empty whereas it has data in table B. My task is to fill all the data in that column from table B to table A with corresponding ids. I'm using the following query: UPDATE A SET A.name = (SELECT B.name from B WHERE A.id = B.id) WHERE EXISTS (SELECT B.name from B) As soon as I run the query in SQL developer, it just freezes and i have to force close it.

JavaFX, columns in TableView resize after been moved

人走茶凉 提交于 2019-12-12 03:27:57
问题 I have a TableView with a number of columns that exceeds the screen width. When it's loaded the first time, all columns have the same width but, as soon as I move one of these, all of them are resized to a width equals to the maximum width of data inside the cells of the column. My question is: is it possible to disable this behavior or to make it works till the first load of the TableView? PS: the TableView is loaded empty, then pressing a button it is filled with data, because you have some