E
elrod
I have a JTree with a TreeSelectionListener to load a form when the
node selection changes. I want to be able to perform a slightly
different action when the selection changes while the CTRL key is
pressed, but the TreeSelectionEvent does not provide access to the
modifier key state.
I am only necessarily interested in the modifier state if the selection
changes by a mouse click, so I could use a MouseListener for this case
if I could figure out a way to keep the TreeSelectionListener from also
loading the form for this case (I have to keep the
TreeSelectionListener method of switching forms for non-mouse-triggered
changes), since both listeners will fire for a mouse selection change.
So, in short, the ideal solution I seek is a way to know if the CTRL
key is pressed from within the TreeSelectionListener, and if that is
too impractical, then a way to keep the TreeSelectionListener from
performing a form load if the MouseListener is going to handle it.
node selection changes. I want to be able to perform a slightly
different action when the selection changes while the CTRL key is
pressed, but the TreeSelectionEvent does not provide access to the
modifier key state.
I am only necessarily interested in the modifier state if the selection
changes by a mouse click, so I could use a MouseListener for this case
if I could figure out a way to keep the TreeSelectionListener from also
loading the form for this case (I have to keep the
TreeSelectionListener method of switching forms for non-mouse-triggered
changes), since both listeners will fire for a mouse selection change.
So, in short, the ideal solution I seek is a way to know if the CTRL
key is pressed from within the TreeSelectionListener, and if that is
too impractical, then a way to keep the TreeSelectionListener from
performing a form load if the MouseListener is going to handle it.