tableview

How can I right click on a cell in tableview in Javafx (fxml)?

為{幸葍}努か 提交于 2019-12-18 09:01:25
问题 I am programming a table view with JavaFX and fxml. I want to do some actions when a user right clicks on a cell in the table. How can I do that? Is it possible to create a right click menu over a cell? Thanks! 回答1: Implement a cell factory for the table column(s) of interest. Create a cell in the cell factory and register the mouse listener with the cell. Referring to the standard table example you can do something like firstNameCol.setCellFactory(new Callback<TableColumn<Person, String>,

Java FX: TableView - display simple HTML

时光毁灭记忆、已成空白 提交于 2019-12-18 09:00:41
问题 I'd like to know, if it is possible to render simple HTML tags in JavaFX TableView (b, i, subscript, supscript). In my code snippet I used default cellValueFactory, but maybe someone could tell me if exists any cell factory which allow me to display html. From code: class Data{ private String row = "<b> Sample data</b>" public String getRow(){ return row; } TableView<Data> tableView = new TableView(); TableColumn<Data,String> column = new TableColumn("Sample Column"); column

JavaFX TableView: Cannot Override '-fx-text-fill'!

那年仲夏 提交于 2019-12-18 05:12:07
问题 On JavaFX2.2, I created my own style class to represent table cells that contain invalid data. But my style class seems unable to override -fx-text-fill in the hover , selected , and focused states. Here is my style class: .invalid-table-cell { -fx-text-fill: red; } .invalid-table-cell:hover { -fx-background-color: salmon; -fx-text-fill: blue; /* No worky */ } .invalid-table-cell:selected { -fx-background-color: purple; -fx-text-fill: orchid; /* No worky */ } .invalid-table-cell:focused:hover

Setting font color of JavaFX TableView Cells?

ε祈祈猫儿з 提交于 2019-12-18 04:53:10
问题 In my Java Desktop Application I have a JavaFX Table with 3 columns. I want to set the font color of the 3rd column to red. I have not been able to set the font color of the Tableb at all. I looked into CSS and I did not find anything. Is there a way to do it with CSS? I also looked for setFont() with the hope of setting it that way. Nothing there. I could not even figure a way to set something on a certain cell. TableView<TableData> myTable = new TableView<TableData>(); ObservableList

How to make alphabetically section headers in table view with a mutable data source

半世苍凉 提交于 2019-12-18 04:53:06
问题 I store strings of a view controller in a string array. I import this string array as a Data Source in my table view. This all works smoothly. But now I would like to sort the table view and add section headers. The section header should be from the alphabet, the rows of the meaning sections should be all strings from the array, starting with the letter of the section header. I know how I can achieve this with static arrays. But how can I make it that only the sections are shown, which also

How can I bypass the JavaFX's TableView “placeholder”?

允我心安 提交于 2019-12-18 04:45:11
问题 JavaFX's TableView has a placeholder property that is basically a Node that gets displayed in the TableView whenever it is empty. If this property is set to null (its default value), it appears as a Label or some other text based Node that says "There is no content in the table." But if there are any rows of data in the table, then the placeholder Node disappears and the entire vertical space in the TableView gets filled with rows, including empty rows if there isn't enough data to fill the

How to prevent TableView from doing TableColumn re-order in javaFX 8?

心已入冬 提交于 2019-12-18 04:43:06
问题 I read this https://bugs.openjdk.java.net/browse/JDK-8102128 but I haven't found something in the Api of JavaFX 8.There isn't any way of prevent reordering in TableView? 回答1: Spent half of a day trying to solve the problem. Maybe my investigation can be useful for someone else. It's possible to disable column reordering using some hacks. And here're the steps: Get table header. This can be done as described here: https://stackoverflow.com/a/12465155 Add change event listener to

iOS UITableView sections with fetchedResultsController confusion

风流意气都作罢 提交于 2019-12-18 04:10:57
问题 I have an entity being displayed in a table view in just one section. The entity has two attributes, workoutName and trainingLevel . Both are of string type. Training level consists of the 3 types: 1, 2, 3. (trainingLevel = (Integer 16 or String Type? Which would be ideal?) I would like to split the table into three sections, each section containing entries for the corresponding training level. How do I do this? The code I am currently using is below: - (NSInteger)numberOfSectionsInTableView:

Change NSFetchedResultsController on SegmentedControl change

半城伤御伤魂 提交于 2019-12-18 03:01:45
问题 I've got a UITableView which is filled using a Core Data NSFetchedResultsController . I've now added a UISegmentedControl to the view and when you change the current segment, I'd like the contents of the tableview to change. I've read around online that it would be wise to use two different NSFetchedResultsControllers as then I can benefit from the built-in caching. Only problem is I can't seem to find any sample code for doing this and don't know where to begin. Can anyone explain where to

retrieving core data into tableview cells swift

被刻印的时光 ゝ 提交于 2019-12-18 02:50:18
问题 I am trying to simply store and retrieve CoreData (something that I've done successfully before with swift). I was getting a nil for data, but now (not sure what changed) I'm not getting an error, just nothing showing in the tableview. I'm not sure if it's a problem in storing or retrieving the object. I've followed how I did it in another app of mine as closely as possible, but there seems to be some fundamental thing that I'm not getting. Here's what I have. My model: import Foundation