home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 27 / IOPROG_27.ISO / SOFT / JFORGE21.ZIP / jforge2j1 / examples / ButtonBeanInfo.java next >
Encoding:
Java Source  |  1998-09-10  |  1.9 KB  |  89 lines

  1. /*
  2.  
  3.   A BeanInfo to allow AWT Buttons to be used in JForge
  4.   Copyright (c)1998, Tek-Tools Inc. & Cameron Newham
  5.  
  6. */
  7.  
  8. import java.awt.Component;
  9. import java.beans.*;
  10. import java.awt.event.*;
  11. import uk.co.demon.sspl.jforge.BuilderAPI;
  12. import pub.java.gui.builders.BuilderHandlerBeanInfo;
  13.  
  14. public class ButtonBeanInfo extends SimpleBeanInfo implements BuilderHandlerBeanInfo,
  15.                                                        MouseListener,
  16.                                                        MouseMotionListener
  17. {
  18.   BeanInfo  buttonBeanInfo = null;
  19.   Component comp;
  20.  
  21.   public ButtonBeanInfo()
  22.   {
  23.     // get the full version
  24.     try
  25.     {
  26.       buttonBeanInfo = Introspector.getBeanInfo(java.awt.Button.class);
  27.     }
  28.     catch (IntrospectionException ie) { }
  29.   }
  30.  
  31.   public BeanDescriptor getBeanDescriptor()
  32.   {
  33.     if (buttonBeanInfo == null)
  34.       return null;
  35.     else
  36.       return buttonBeanInfo.getBeanDescriptor();
  37.   }
  38.  
  39.   public PropertyDescriptor[] getPropertyDescriptors()
  40.   {
  41.     if (buttonBeanInfo == null)
  42.       return null;
  43.     else
  44.       return buttonBeanInfo.getPropertyDescriptors();
  45.   }
  46.  
  47.   public void attachHandlers(Component component)
  48.   {
  49.     component.addMouseListener(this);
  50.     component.addMouseMotionListener(this);
  51.     comp = component;
  52.   }
  53.  
  54.   /* call BuilderAPI.mousePressed */
  55.   public void mousePressed(MouseEvent evt)
  56.   {
  57.     BuilderAPI.mousePressed(evt, comp);
  58.   }
  59.  
  60.   /* call BuilderAPI.mouseReleased */
  61.   public void mouseReleased(MouseEvent evt)
  62.   {
  63.     BuilderAPI.mouseReleased(evt);
  64.   }
  65.  
  66.   /* call BuilderAPI.mouseDragged */
  67.   public void mouseDragged(MouseEvent evt)
  68.   {
  69.     BuilderAPI.mouseDragged(evt);
  70.   }
  71.  
  72.   public void mouseClicked(MouseEvent evt)
  73.   {
  74.   }
  75.  
  76.   public void mouseEntered(MouseEvent evt)
  77.   {
  78.   }
  79.  
  80.   public void mouseExited(MouseEvent evt)
  81.   {
  82.   }
  83.  
  84.   public void mouseMoved(MouseEvent evt)
  85.   {
  86.   }
  87.  
  88. }
  89.