FileDocCategorySizeDatePackage
MediaPlayerBeanInfo.javaAPI DocJMF 2.1.1e5794Mon May 12 12:20:42 BST 2003javax.media.bean.playerbean

MediaPlayerBeanInfo

public class MediaPlayerBeanInfo extends SimpleBeanInfo
Provides explicit bean information for the MediaPlayer. It provides descriptions of each property and indicates which MediaPlayer properties are bound. Invoked by JavaBeansTM application builders.

Fields Summary
private static final Class
beanClass
Constructors Summary
Methods Summary
public java.beans.BeanDescriptorgetBeanDescriptor()
Gets the bean descriptor for this bean, which defines information about MediaPlayer such as its displayName.

return
The BeanDescriptor for MediaPlayer.

		BeanDescriptor bd = new BeanDescriptor(MediaPlayer.class);
		bd.setDisplayName(MediaPlayerResource.getString("MEDIA_PLAYER")+
		                  " " + MediaPlayerResource.getString("BEAN"));
		//"MediaPlayer Bean");
		return bd;
  
public intgetDefaultPropertyIndex()
Gets the default property index for this bean. The "mediaLocation" property is the default property for the MediaPlayer.

return
The default property index for the bean.

	  return 1;
  
public java.beans.EventSetDescriptor[]getEventSetDescriptors()
Gets a list of the events fired by this bean.

return
An array of EventSetDescriptor objects that describes the kinds of events fired by this bean.

	  try 
	  {
	    
	    EventSetDescriptor cl = new EventSetDescriptor(beanClass,
							   "controllerUpdate",
							   javax.media.ControllerListener.class,
							   "controllerUpdate");
							   
	    EventSetDescriptor pc = new EventSetDescriptor(beanClass,
							   "propertyChange",
							   java.beans.PropertyChangeListener.class,
							   "propertyChange");
	    cl.setDisplayName("Controller Events");
	    EventSetDescriptor[] rv = {cl, pc};
	    return rv;
	  } 
	  catch (IntrospectionException e) 
	  {
	    throw new Error(e.toString());
	  }
  
public java.awt.ImagegetIcon(int ic)
Gets the icon to be used in the bean tool for this bean.

param
ic Indicates the format for the icon image. The valid format constants are defined in SimpleBeanInfo: ICON_COLOR_16x16, ICON_COLOR_32x32, ICON_MONO_16x16, and ICON_MONO_16x16.
return
The icon to be used as an AWT Image.

	  switch (ic) {
	    case BeanInfo.ICON_COLOR_16x16:
	      return loadImage("MediaPlayerColor16.gif");
	    case BeanInfo.ICON_COLOR_32x32:
	      return loadImage("MediaPlayerColor32.gif");
	    case BeanInfo.ICON_MONO_16x16:
	      return loadImage("MediaPlayerMono16.gif");
	    case BeanInfo.ICON_MONO_32x32:
	      return loadImage("MediaPlayerMono32.gif");
	    default:
	      return null;
	  }
  
public java.beans.PropertyDescriptor[]getPropertyDescriptors()
Gets a list of bean PropertyDescriptor objects, one for each public property in the MediaPlayer.

return
A PropertyDescriptor array that contains all of the bean property descriptors for this MediaPlayer.


                                           
      
  
	  try 
	  {
	    /* general UI properties */
	    PropertyDescriptor background = new
      	PropertyDescriptor("background", beanClass);
	    PropertyDescriptor foreground = new
		    PropertyDescriptor("foreground", beanClass);
	    PropertyDescriptor font = new
		    PropertyDescriptor("font", beanClass);
		
	    /* Behavior & appearance properties for the bean  */
	    
	    PropertyDescriptor Url = 
	              new PropertyDescriptor("mediaLocation", beanClass);
	    Url.setDisplayName(MediaPlayerResource.getString("MEDIA_LOCATION"));
	    Url.setBound(true);
		  Url.setPropertyEditorClass(MediaPlayerMediaLocationEditor.class);
  
	    PropertyDescriptor PanelVisible =
	              new	PropertyDescriptor("controlPanelVisible", beanClass);
	    PanelVisible.setDisplayName(
	              MediaPlayerResource.getString("CONTROL_PANEL_VISIBLE"));
	    PanelVisible.setBound(true);

      PropertyDescriptor CacheVisible =
                new	PropertyDescriptor("cachingControlVisible", beanClass);
	    CacheVisible.setDisplayName(
	              MediaPlayerResource.getString("CACHING_CONTROL_VISIBLE"));
	    CacheVisible.setBound(true);

      PropertyDescriptor FixedAspectRatio =
                new PropertyDescriptor("fixedAspectRatio", beanClass);
	    FixedAspectRatio.setDisplayName(
	              MediaPlayerResource.getString("FIXED_ASPECT_RATIO"));
	    FixedAspectRatio.setBound(true);
      
	    PropertyDescriptor loop = 
	              new PropertyDescriptor("playbackLoop", beanClass);
	    loop.setBound(true);
    	loop.setDisplayName(MediaPlayerResource.getString("LOOP"));
      
      PropertyDescriptor volume =
                new PropertyDescriptor("volumeLevel", beanClass);
	    volume.setBound(true);
		  volume.setDisplayName(MediaPlayerResource.getString("VOLUME"));
		  volume.setPropertyEditorClass(MediaPlayerVolumePropertyEditor.class);
    
	    /* build an array of property descriptors */
	    PropertyDescriptor rv[] = { Url, PanelVisible, CacheVisible, 
			          FixedAspectRatio,loop, volume,
			          background, foreground, font};
	    return rv;
	  } 
	  catch (IntrospectionException e) 
	  {
	    throw new Error(e.toString());
	  }