Hey there,
I was missing a ColHeaderClick() Event in the JBGrid and was tired of adding a Mouselistener to every Grid I used in my projects (mostly database frontends).
So I added one to the JBGridHeader in the framework!
ColHeaderClick() Event is fired by clicking on a ColumnHeader.
ColHeaderIndex is set accordingly.
-1 for no column -> click on blank headerspace on the right side of the columns
The downside:
I am not quite sure how to indicate this event visually.
You can use this to indicate that interaction with the header is possible
|
Jabaco Source
|
1
2
|
'MousePointer
JBGrid1.Parent.getTableHeader.setCursor(VBMousePointerToJCursor(vbHandCursor))
|
When you add a JTable to a ScrollPane in Java the TableHeader behaves like JButtons do.
Mouseover, Mousepressed, 3D appearance...
In Jabaco the JBHeaderRenderer overrides the DefaultTableHeader and defines the appearance of JLabels.
Now since I am not a Java programmer I don't know of the possible approaches to mimic a ButtonDown Event visually.
So far my ColHeaderClick() Event is triggered in the JBGrid mouseReleased() Event which then sorts out what column the mousepointer is over.
Here the JBHeaderRenderer should be told how to paint that column header while Mouseover, Mousepressed, ...
In JBHeaderRenderer.getTableCellRendererComponent() this could be used to represent the aktion
|
Jabaco Source
|
1
2
3
4
|
'Mouseover
...setBorder or setForeground...
'Mousepressed
Call myHeader.setBorder(getMarginBorder(BorderFactory.createEtchedBorder(0), 1)) '(1), 1)) for normal
|
Also fixed an issue where JBGrid1_AfterCellEdit() was not fired!
Dani