Weird behavior of a MouseListener added to a JTable?

Sounds normal to me if you're not checking for event.getSource() == myTable.

Adding mouse listeners to PL&F-heavy components is not a great idea. They often have subcomponents which spoil the party. Mouse events are different from other events in that they bubble up the component hierarchy until they hit a component with a mouse listener (so adding a mouse listener is an intrusive operation).

JTable in particular uses renderer to stamp each cell as well as editor components. (Also subclass compnents such as JTable, or other classes such as Thread, is generally a bad idea. ).

Mouse events can continue to propagate if a mouse listener doesn't consume it. And any specific reasons why you don't recommend extending JTable? I can understand why not Thread, but JTable has much stuff left out (e.g. Search, hierarchy).

You can add many features by extending table model, column model, header, etc. , but I've run into cases where I have to extend JTable itself. – Geoffrey Zheng Sep 28 '10 at 3:47 A listener doesn't have to call consume() to prevent the event bubbling up. Just the presence of a listener will do.

– Tom Hawtin - tackline Sep 28 '10 at 11:22.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions