Fwd: TableView - listening to events on table headers (original) (raw)
steve.x.northover at oracle.com steve.x.northover at oracle.com
Wed Oct 24 07:56:31 PDT 2012
- Previous message: Fwd: TableView - listening to events on table headers
- Next message: Fwd: TableView - listening to events on table headers
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Pedro,
You can always use a filter to see every click that happens in a control:
tableView.addEventFilter(MouseEvent.MOUSE_PRESSED, new
EventHandler() { public void handle(Event event) { System.out.println("Press " + event.getSource() + " " + event.getTarget());
}
});
However, you then need to determine that the target was a table header node and that seems like reaching into the implementation. I would suggest that you stick with setGraphic() if this is working for you and enter a JIRA feature request for mouse and other event handlers for table column headers.
Steve
On 23/10/2012 8:03 PM, Pedro Duque Vieira wrote:
Somehow my email below didn't get any response so I'm sending it again.. ---------- Forwarded message ---------- From: Pedro Duque Vieira<pedro.duquevieira at gmail.com> Date: Tue, Oct 23, 2012 at 12:42 AM Subject: TableView - listening to events on table headers To: OpenJFX Mailing List<openjfx-dev at openjdk.java.net>
Hi, In my app I have to listen to mouse events on table headers, I've tried to come up with a good solution to this but haven't found any. Posting in the JavaFX OTN forums also did not bring any better solution. As it is the only solution I see is replacing the headers via setGraphic method of TableColumn and attaching listeners to what I pass in to the setGraphic, even though I will end up replacing the TableColumn header with the same type of node as was previously present, so I end up calling setGraphic only for the sake of being able to attach listeners. This looks ugly. Is there any better solution for this? My use case is: 1- user mouse clicks the a table header to select a column 2- column gets selected. 3- Selected column is visually highlighted. Thanks,
- Previous message: Fwd: TableView - listening to events on table headers
- Next message: Fwd: TableView - listening to events on table headers
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]