Changeset 1102 for trunk/src/org/expeditee/items/widgets/RubbishBin.java
- Timestamp:
- 05/10/18 16:04:51 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/widgets/RubbishBin.java
r1005 r1102 4 4 import java.awt.event.ActionListener; 5 5 6 import org.expeditee.g ui.DisplayIO;7 import org.expeditee.gui. FrameMouseActions;6 import org.expeditee.gio.gesture.StandardGestureActions; 7 import org.expeditee.gui.DisplayController; 8 8 import org.expeditee.gui.FreeItems; 9 9 import org.expeditee.items.Item; 10 10 import org.expeditee.items.Text; 11 11 12 //When the Rubbish Bin Widget is clicked by any of the mouse buttons, whatever is currently being picked up by the mouse is destroyed 13 public class RubbishBin extends ButtonWidget{ 14 15 public RubbishBin(Text source, String[] args){ 16 12 /** 13 * When the Rubbish Bin Widget is clicked by any of the mouse buttons, 14 * whatever is currently being picked up by the mouse is destroyed. 15 * 16 * @author cts16 17 */ 18 public class RubbishBin extends ButtonWidget 19 { 20 public RubbishBin(Text source, String[] args) 21 { 17 22 super(80, "org/expeditee/assets/images/bin.svg", source, args); 18 23 19 clicked_.addActionListener(new ActionListener() { 20 public void actionPerformed(ActionEvent e) { 24 clicked_.addActionListener(new ActionListener() 25 { 26 public void actionPerformed(ActionEvent e) 27 { 21 28 22 29 } 23 30 }); 24 31 } 25 public boolean ItemsLeftClickDropped() { 26 32 33 public boolean ItemsLeftClickDropped() 34 { 27 35 //Find what the mouse was holding at the time and delete it 28 36 Item freeItems = FreeItems.getItemAttachedToCursor(); 29 if( freeItems != null){ 30 freeItems.setParent(DisplayIO.getCurrentFrame()); 37 38 if( freeItems != null) { 39 freeItems.setParent(DisplayController.getCurrentFrame()); 31 40 32 try{ 33 34 FrameMouseActions.delete(freeItems); 35 } 36 catch(Exception e){ 37 41 try { 42 StandardGestureActions.delete(freeItems, null, null, false); 43 } catch(Exception e) { 38 44 e.printStackTrace(); 39 45 } 40 46 } 47 41 48 return true; 42 49 } 43 50 44 51 @Override 45 protected String[] getArgs() { 52 protected String[] getArgs() 53 { 46 54 // TODO Auto-generated method stub 47 55 return null; 48 56 } 49 //this should be a generic method for any widget that is clicked while an item is being held 50 public boolean itemHeldWhileClicked(InteractiveWidget iw){ 51 57 58 /** 59 * This should be a generic method for any widget that is clicked while an item is being held. 60 */ 61 public boolean itemHeldWhileClicked(Widget iw) 62 { 52 63 ItemsLeftClickDropped(); 53 return true; 54 55 } 56 public boolean getdropInteractableStatus(){ 64 57 65 return true; 58 66 } 59 67 68 public boolean getdropInteractableStatus() 69 { 70 return true; 71 } 60 72 }
Note:
See TracChangeset
for help on using the changeset viewer.