Mercurial Hosting > junotu
changeset 78:f3fe8eebdcfd
TabEdit: Ability to remove tags by middle-clicking them
author | Fox |
---|---|
date | Sat, 07 Jan 2023 02:12:43 +0100 |
parents | f9b9c7b473b9 |
children | 2a6795772ed4 |
files | src/junotu/TabEdit.java |
diffstat | 1 files changed, 18 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
diff -r f9b9c7b473b9 -r f3fe8eebdcfd src/junotu/TabEdit.java --- a/src/junotu/TabEdit.java Sat Jan 07 02:00:34 2023 +0100 +++ b/src/junotu/TabEdit.java Sat Jan 07 02:12:43 2023 +0100 @@ -293,6 +293,16 @@ tags.repaint(); System.out.print( "Opened new tag for editing.\n" ); } + + private void tagRemove( TagWidget tagWidget ) + { + System.out.print( "Removed tag '"+tagWidget.tag+"' with value '"+tagWidget.value+"'.\n" ); + card.tagValueRemove( tagWidget.tag, tagWidget.value ); + tags.remove( tagWidget ); + + tags.validate(); + tags.repaint(); + } private void tagEdit( TagWidget tagWidget ) { @@ -557,10 +567,17 @@ } } - public void mouseClicked( MouseEvent e ) {} public void mouseEntered( MouseEvent e ) {} public void mouseExited( MouseEvent e ) {} + public void mouseClicked( MouseEvent e ) + { + Object source = e.getSource(); + if( e.getButton() == MouseEvent.BUTTON2 && source instanceof TagWidget ) { + tagRemove( (TagWidget)source ); + } + } + public void mousePressed( MouseEvent e ) { if( possiblyShowTagContextMenu(e) ) {