home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / jfc.bin / JSeparator.java < prev    next >
Text File  |  1998-02-26  |  4KB  |  137 lines

  1. /*
  2.  * @(#)JSeparator.java    1.18 98/02/12
  3.  * 
  4.  * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  */
  20.  
  21. package com.sun.java.swing;
  22. import com.sun.java.swing.plaf.*;
  23. import com.sun.java.accessibility.*;
  24.  
  25. /**
  26.  * An implementation of a Menu Separator -- a divider between menu items
  27.  * that breaks them up into logical groupings.
  28.  * <p>
  29.  * Warning: serialized objects of this class will not be compatible with
  30.  * future swing releases.  The current serialization support is appropriate
  31.  * for short term storage or RMI between Swing1.0 applications.  It will
  32.  * not be possible to load serialized Swing1.0 objects with future releases
  33.  * of Swing.  The JDK1.2 release of Swing will be the compatibility
  34.  * baseline for the serialized form of Swing objects.
  35.  *
  36.  * @beaninfo
  37.  *      attribute: isContainer false
  38.  * @version 1.18 02/12/98
  39.  * @author Georges Saab
  40.  * @author David Karlton
  41.  */
  42. public class JSeparator extends JComponent implements Accessible
  43. {
  44.     /** Create a new separator */
  45.     public JSeparator() {
  46.         updateUI();
  47.     }
  48.  
  49.     /**
  50.     /**
  51.      * Returns the L&F object that renders this component.
  52.      *
  53.      * @return the SeparatorUI object that renders this component
  54.      */
  55.     public SeparatorUI getUI() {
  56.         return (SeparatorUI)ui;
  57.     }
  58.     
  59.     /**
  60.      * Sets the L&F object that renders this component.
  61.      *
  62.      * @param ui  the SeparatorUI L&F object
  63.      * @see UIDefaults#getUI
  64.      * @beaninfo
  65.      * description: The menu item's UI delegate
  66.      *       bound: true
  67.      *      expert: true
  68.      *      hidden: true
  69.      */
  70.     public void setUI(SeparatorUI ui) {
  71.         super.setUI(ui);
  72.     }
  73.     
  74.     /**
  75.      * Notification from the UIFactory that the L&F has changed. 
  76.      * Called to replace the UI with the latest version from the 
  77.      * UIFactory.
  78.      *
  79.      * @see JComponent#updateUI
  80.      */
  81.     public void updateUI() {
  82.         setUI((SeparatorUI)UIManager.getUI(this));
  83.     }
  84.     
  85.  
  86.     /**
  87.      * Returns the name of the L&F class that renders this component.
  88.      *
  89.      * @return "SeparatorUI"
  90.      * @see JComponent#getUIClassID
  91.      * @see UIDefaults#getUI
  92.      */
  93.     public String getUIClassID() {
  94.         return "SeparatorUI";
  95.     }
  96.  
  97.  
  98. /////////////////
  99. // Accessibility support
  100. ////////////////
  101.  
  102.     /**
  103.      * Get the AccessibleContext associated with this JComponent
  104.      *
  105.      * @return the AccessibleContext of this JComponent
  106.      */
  107.     public AccessibleContext getAccessibleContext() {
  108.         if (accessibleContext == null) {
  109.             accessibleContext = new AccessibleJSeparator();
  110.         }
  111.         return accessibleContext;
  112.     }
  113.  
  114.     /**
  115.      * The class used to obtain the accessible role for this object.
  116.      * <p>
  117.      * Warning: serialized objects of this class will not be compatible with
  118.      * future swing releases.  The current serialization support is appropriate
  119.      * for short term storage or RMI between Swing1.0 applications.  It will
  120.      * not be possible to load serialized Swing1.0 objects with future releases
  121.      * of Swing.  The JDK1.2 release of Swing will be the compatibility
  122.      * baseline for the serialized form of Swing objects.
  123.      */
  124.     protected class AccessibleJSeparator extends AccessibleJComponent {
  125.  
  126.         /**
  127.          * Get the role of this object.
  128.          *
  129.          * @return an instance of AccessibleRole describing the role of the 
  130.          * object
  131.          */
  132.         public AccessibleRole getAccessibleRole() {
  133.             return AccessibleRole.SEPARATOR;
  134.         }
  135.     }
  136. }
  137.