Changeset 1176 for trunk


Ignore:
Timestamp:
09/28/18 10:28:21 (6 years ago)
Author:
bln4
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/items/widgets/RubbishBin.java

    r1102 r1176  
    1111
    1212/**
    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.
     13* When the Rubbish Bin Widget is clicked by any of the mouse buttons, whatever
     14 * is currently being picked up by the mouse is destroyed.
    1515 *
    1616 * @author cts16
    1717 */
    18 public class RubbishBin extends ButtonWidget
    19 {       
    20         public RubbishBin(Text source, String[] args)
    21         {
     18public class RubbishBin extends ButtonWidget {
     19        public RubbishBin(Text source, String[] args) {
    2220                super(80, "org/expeditee/assets/images/bin.svg", source, args);
    2321
    24                 clicked_.addActionListener(new ActionListener()
    25                 {
    26                 public void actionPerformed(ActionEvent e)
    27                 {       
    28                        
    29                 }         
    30                 });             
     22                clicked_.addActionListener(new ActionListener() {
     23                        @Override
     24                        public void actionPerformed(ActionEvent e) {
     25                                System.err.println("Rubbish Bin action performed");
     26                        }
     27                });
    3128        }
    32        
    33         public boolean ItemsLeftClickDropped()
    34         {
    35                 //Find what the mouse was holding at the time and delete it
     29
     30        @Override
     31        public boolean ItemsLeftClickDropped() {
     32                // Find what the mouse was holding at the time and delete it
    3633                Item freeItems = FreeItems.getItemAttachedToCursor();
    37                
    38                 if( freeItems != null) {
     34
     35                if (freeItems != null) {
    3936                        freeItems.setParent(DisplayController.getCurrentFrame());
    40                        
     37
    4138                        try {
    42                                 StandardGestureActions.delete(freeItems, null, null, false);           
    43                         } catch(Exception e) {
     39                                StandardGestureActions.delete(freeItems, null, null, false);
     40                        } catch (Exception e) {
    4441                                e.printStackTrace();
    45                         }                       
     42                        }
    4643                }
    47                
     44
    4845                return true;
    4946        }
    50        
     47
     48
    5149        @Override
    52         protected String[] getArgs()
    53         {
     50        protected String[] getArgs() {
    5451                // TODO Auto-generated method stub
    5552                return null;
    5653        }
    57        
     54
    5855        /**
    59          * This should be a generic method for any widget that is clicked while an item is being held.
     56         * This should be a generic method for any widget that is clicked while an item
     57         * is being held.
    6058         */
    61         public boolean itemHeldWhileClicked(Widget iw)
    62         {
     59        @Override
     60        public boolean itemHeldWhileClicked(Widget iw) {
    6361                ItemsLeftClickDropped();
    64                
     62
    6563                return true;
    6664        }
    67        
    68         public boolean getdropInteractableStatus()
    69         {
     65
     66        @Override
     67        public boolean getdropInteractableStatus() {
    7068                return true;
    7169        }
Note: See TracChangeset for help on using the changeset viewer.