1 16 17 package swingwtx.swing; 18 19 import swingwt.awt.event.ActionEvent; 20 import swingwt.awt.event.ActionListener; 21 import swingwt.awt.event.MouseAdapter; 22 import swingwt.awt.event.MouseEvent; 23 import swingwt.awt.event.MouseMotionListener; 24 25 28 public class ToolTipManager extends MouseAdapter implements MouseMotionListener { 29 30 final static ToolTipManager sharedInstance = new ToolTipManager(); 31 32 ToolTipManager() { 33 } 34 35 boolean enabled; 36 public void setEnabled(boolean flag) { 37 enabled = flag; 38 } 39 public boolean isEnabled() { 40 return enabled; 41 } 42 43 protected boolean lightWeightPopupEnabled; 44 protected boolean heavyWeightPopupEnabled; 45 public void setLightWeightPopupEnabled(boolean enabled){ 46 lightWeightPopupEnabled = enabled; 47 } 48 public boolean isLightWeightPopupEnabled() { 49 return lightWeightPopupEnabled; 50 } 51 52 String toolTipText; 53 54 Timer initialTimer = new Timer(1000,new insideTimerAction()); 55 public void setInitialDelay(int milliseconds) { 56 initialTimer.setInitialDelay(milliseconds); 57 } 58 public int getInitialDelay() { 59 return initialTimer.getInitialDelay(); 60 } 61 62 Timer dismissTimer = new Timer(1000,new outsideTimerAction()); 63 public void setDismissDelay(int milliseconds) { 64 dismissTimer.setInitialDelay(milliseconds); 65 } 66 public int getDismissDelay() { 67 return dismissTimer.getInitialDelay(); 68 } 69 70 Timer reshowTimer = new Timer(3000,new stillInsideTimerAction()); 71 public void setReshowDelay(int milliseconds) { 72 reshowTimer.setInitialDelay(milliseconds); 73 } 74 public int getReshowDelay() { 75 return reshowTimer.getInitialDelay(); 76 } 77 78 public static ToolTipManager sharedInstance() { 79 return sharedInstance; 80 } 81 82 public void registerComponent(JComponent component) { } 83 public void unregisterComponent(JComponent component) { } 84 85 public void mouseEntered(MouseEvent event) { } 86 public void mouseExited(MouseEvent event) { } 87 public void mousePressed(MouseEvent event) { } 88 public void mouseDragged(MouseEvent event) { } 89 public void mouseMoved(MouseEvent event) { } 90 91 protected class insideTimerAction implements ActionListener { 92 public void actionPerformed(ActionEvent e) { } 93 } 94 95 protected class outsideTimerAction implements ActionListener { 96 public void actionPerformed(ActionEvent e) { } 97 } 98 99 protected class stillInsideTimerAction implements ActionListener { 100 public void actionPerformed(ActionEvent e) { } 101 } 102 } 103 | Popular Tags |