Fwd: TableView - listening to events on table headers

Pedro Duque Vieira pedro.duquevieira at gmail.com
Tue Oct 23 17:03:46 PDT 2012

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>


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

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.


Pedro Duque Vieira

Pedro Duque Vieira

More information about the openjfx-dev mailing list