1 19 20 package org.netbeans.modules.autoupdate; 21 22 import java.awt.Component ; 23 import javax.swing.Icon ; 24 import javax.swing.ImageIcon ; 25 import org.openide.awt.StatusLineElementProvider; 26 import org.openide.util.Utilities; 27 28 32 public final class AvailableUpdateVisualizerProvider implements StatusLineElementProvider { 33 34 public Component getStatusLineElement () { 35 return getUpdatesVisualizer (); 36 } 37 38 private static UpdatesFlasher flasher = null; 39 40 private static Runnable onMouseClick = null; 41 42 50 private static Component getUpdatesVisualizer () { 51 if (null == flasher) { 52 ImageIcon img1 = new ImageIcon (Utilities.loadImage ("org/netbeans/modules/autoupdate/resources/newUpdates.gif", false)); 53 assert img1 != null : "Icon cannot be null."; 54 flasher = new UpdatesFlasher (img1); 55 } 56 return flasher; 57 } 58 59 static UpdatesFlasher getFlasher (Runnable whatRunOnMouseClick) { 60 onMouseClick = whatRunOnMouseClick; 61 return flasher; 62 } 63 64 static class UpdatesFlasher extends FlashingIcon { 65 public UpdatesFlasher (Icon img1) { 66 super (img1); 67 DISAPPEAR_DELAY_MILLIS = -1; 68 STOP_FLASHING_DELAY = 0; 70 } 71 72 75 protected void onMouseClick () { 76 if (onMouseClick != null) { 77 onMouseClick.run (); 78 disappear (); 79 } 80 } 81 82 86 protected void timeout () {} 87 } 88 89 } 90 | Popular Tags |