1 package org.enhydra.barracuda.testbed.workbench.util.gui; 2 3 4 import java.awt.*; 5 import javax.swing.*; 6 7 8 11 public class Cursors { 12 13 21 public static void setWorking(Container cont, boolean isWorking) { 22 if (cont==null) return; 24 25 Component comps[] = cont.getComponents(); 27 setWorking(comps, isWorking); 28 } 29 30 38 public static void setWorking(Component comps[], boolean isWorking) { 39 setWorking_private(comps, isWorking); 40 } 41 42 48 public static void setWorking_private(Component comps[], boolean isWorking) { 49 50 Cursor defaultCursor = Cursor.getDefaultCursor(); 52 Cursor handCursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); 53 Cursor waitCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); 54 for (int i = 0, max = comps.length; i<max; i++) { 55 Component comp = comps[i]; 56 if (comp==null) continue; 57 if (isWorking) { 58 comp.setCursor(waitCursor); 59 } else { 60 if (comp instanceof AbstractButton) comp.setCursor(handCursor); 61 else if (comp instanceof Button) comp.setCursor(handCursor); 62 else comp.setCursor(defaultCursor); 63 } 64 65 if (comp instanceof Container) setWorking((Container) comp, isWorking); 68 } 69 } 70 71 72 } 73 | Popular Tags |