1 19 20 package org.netbeans.modules.project.ui.actions; 21 22 import javax.swing.AbstractAction ; 23 import javax.swing.Icon ; 24 import javax.swing.ImageIcon ; 25 import org.openide.util.Utilities; 26 27 32 abstract class BasicAction extends AbstractAction { 33 34 protected BasicAction() {} 35 36 protected BasicAction( String displayName, Icon icon ) { 37 if ( displayName != null ) { 38 setDisplayName( displayName ); 39 } 40 if ( icon != null ) { 41 setSmallIcon( icon ); 42 } 43 } 44 45 protected final void setDisplayName( String name ) { 46 putValue( NAME, name ); 47 } 48 49 protected final void setSmallIcon( Icon icon ) { 50 if ( icon != null ) { 51 putValue( SMALL_ICON, icon ); 52 } 53 } 54 55 protected final void setSmallIcon( String iconResource ) { 56 if ( iconResource != null ) { 57 putValue( SMALL_ICON, new ImageIcon ( Utilities.loadImage( iconResource ) ) ); 58 } 59 } 60 61 } | Popular Tags |