Thanks for the reply Andrew.
I should have mentioned that I already tried adding a MouseListener to the
JTable, and I don't get any MouseEvents when I click that gray area.
You are right about the 1x1 GridLayout. When I call getHeight() on that
table, it returns 97 (pixels). So it seems that the JTable is taking up that
space but pretending that it doesn't exist.
I thought about subclassing JTable but I'd really rather not if I can avoid
it.
> ..
>> If anybody can tell me how to add a MouseListener to this "gray area", ..
[quoted text clipped - 26 lines]
>
> HTH
> Thanks for the reply Andrew.
You're welcome, in return, please refrain from
top-posting, and trim earlier text no longer
relevant.
> I should have mentioned that I already tried adding a MouseListener to the
> JTable, and I don't get any MouseEvents when I click that gray area.
It seems like a problem in your code.
Note how the code I posted had no problems detecting
mouse events in the area of the table.
Add a 'new JTable( new DefaultTableModel(1,3) )' to that
constructor and you can also see that clicking in any cell
of any/the row, or the unfilled area, registers the click.
> You are right about the 1x1 GridLayout. When I call getHeight() on that
> table, it returns 97 (pixels). So it seems that the JTable is taking up that
> space but pretending that it doesn't exist.
JTable may be a quixotic component, but it does not enerally
rise to the form of pretence of which you 'accuse' it.
> I thought about subclassing JTable but I'd really rather not if I can avoid
> it.
Think about trimmming your code, one line at a time,
if necessary, back to the example I showed - that works.
Logically, at some point your code will start working,
and *that* line you had just removed, that will be the
(crux of the) problem.
Short of seeing your code* that does not work, I cannot
advise further.
* I am not asking to see your 'propietary and confidential'
code, nor examine a Zip archive of 100Kb of code, but a small
code example of the problem. Something I refer to by it's
acronym. An SSCCE. More info. here..
<http://www.physci.org/codes/sscce.jsp>