(MouseEvent evt)
| 331 | //right click on the note |
| 332 | text.addMouseListener(new MouseAdapter() { |
| 333 | public void mouseClicked(MouseEvent evt) { |
| 334 | if (evt.isPopupTrigger() || evt.getButton() == MouseEvent.BUTTON3) { //isPopupTrigger does not work on windows. workaround is to listen for BUTTON3 instead (right mouse button) |
| 335 | if (text.getSelectionStart() == text.getSelectionEnd()) { //if there is no text selected, disable cut, copy and delete |
| 336 | cut.setEnabled(false); |
| 337 | copy.setEnabled(false); |
| 338 | delete.setEnabled(false); |
| 339 | } else { //otherwise, enable them |
| 340 | cut.setEnabled(true); |
| 341 | copy.setEnabled(true); |
| 342 | delete.setEnabled(true); |
| 343 | } |
| 344 | paste.setEnabled(getClipboard() != null); //paste is only enabled if there's something in the clipboard |
| 345 | copyPasteMenu.show(evt.getComponent(), evt.getX(), evt.getY()); //show the menu at current mouse location |
| 346 | } |
| 347 | } |
| 348 | }); |
| 349 | |
| 350 | //listener for ctrl+wheel (for zooming in and out) |
nothing calls this directly
no test coverage detected