1749 }
1750
1751 /**
1752 * Creates the peer for a DragSourceContext.
1753 * Always throws InvalidDndOperationException if
1754 * GraphicsEnvironment.isHeadless() returns true.
1755 *
1756 * @param dge the {@code DragGestureEvent}
1757 * @return the peer created
1758 * @see java.awt.GraphicsEnvironment#isHeadless
1759 */
1760 public abstract DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException;
1761
1762 /**
1763 * Creates a concrete, platform dependent, subclass of the abstract
1764 * DragGestureRecognizer class requested, and associates it with the
1765 * DragSource, Component and DragGestureListener specified.
1766 *
1767 * subclasses should override this to provide their own implementation
1768 *
1769 * @param abstractRecognizerClass The abstract class of the required recognizer
1770 * @param ds The DragSource
1771 * @param c The Component target for the DragGestureRecognizer
1772 * @param srcActions The actions permitted for the gesture
1773 * @param dgl The DragGestureListener
1774 *
1775 * @return the new object or null. Always returns null if
1776 * GraphicsEnvironment.isHeadless() returns true.
1777 * @see java.awt.GraphicsEnvironment#isHeadless
1778 */
1779 public <T extends DragGestureRecognizer> T
1780 createDragGestureRecognizer(Class<T> abstractRecognizerClass,
1781 DragSource ds, Component c, int srcActions,
1782 DragGestureListener dgl)
1783 {
1784 return null;
1785 }
1786
1787 /**
1788 * Obtains a value for the specified desktop property.
1850 if (this instanceof HeadlessToolkit) {
1851 ((HeadlessToolkit)this).getUnderlyingToolkit()
1852 .setDesktopProperty(name, newValue);
1853 return;
1854 }
1855 Object oldValue;
1856
1857 synchronized (this) {
1858 oldValue = desktopProperties.get(name);
1859 desktopProperties.put(name, newValue);
1860 }
1861
1862 // Don't fire change event if old and new values are null.
1863 // It helps to avoid recursive resending of WM_THEMECHANGED
1864 if (oldValue != null || newValue != null) {
1865 desktopPropsSupport.firePropertyChange(name, oldValue, newValue);
1866 }
1867 }
1868
1869 /**
1870 * an opportunity to lazily evaluate desktop property values.
1871 */
1872 protected Object lazilyLoadDesktopProperty(String name) {
1873 return null;
1874 }
1875
1876 /**
1877 * initializeDesktopProperties
1878 */
1879 protected void initializeDesktopProperties() {
1880 }
1881
1882 /**
1883 * Adds the specified property change listener for the named desktop
1884 * property. When a {@link java.beans.PropertyChangeListenerProxy} object is added,
1885 * its property name is ignored, and the wrapped listener is added.
1886 * If {@code name} is {@code null} or {@code pcl} is {@code null},
1887 * no exception is thrown and no action is performed.
1888 *
1889 * @param name The name of the property to listen for
1890 * @param pcl The property change listener
1930 public PropertyChangeListener[] getPropertyChangeListeners() {
1931 return desktopPropsSupport.getPropertyChangeListeners();
1932 }
1933
1934 /**
1935 * Returns an array of all property change listeners
1936 * associated with the specified name of a desktop property.
1937 *
1938 * @param propertyName the named property
1939 * @return all of the {@code PropertyChangeListener} objects
1940 * associated with the specified name of a desktop property
1941 * or an empty array if no such listeners are added
1942 *
1943 * @see PropertyChangeSupport#getPropertyChangeListeners(String)
1944 * @since 1.4
1945 */
1946 public PropertyChangeListener[] getPropertyChangeListeners(String propertyName) {
1947 return desktopPropsSupport.getPropertyChangeListeners(propertyName);
1948 }
1949
1950 protected final Map<String,Object> desktopProperties =
1951 new HashMap<String,Object>();
1952 protected final PropertyChangeSupport desktopPropsSupport =
1953 Toolkit.createPropertyChangeSupport(this);
1954
1955 /**
1956 * Returns whether the always-on-top mode is supported by this toolkit.
1957 * To detect whether the always-on-top mode is supported for a
1958 * particular Window, use {@link Window#isAlwaysOnTopSupported}.
1959 * @return <code>true</code>, if current toolkit supports the always-on-top mode,
1960 * otherwise returns <code>false</code>
1961 * @see Window#isAlwaysOnTopSupported
1962 * @see Window#setAlwaysOnTop(boolean)
1963 * @since 1.6
1964 */
1965 public boolean isAlwaysOnTopSupported() {
1966 return true;
1967 }
1968
1969 /**
1970 * Returns whether the given modality type is supported by this toolkit. If
1971 * a dialog with unsupported modality type is created, then
|
1749 }
1750
1751 /**
1752 * Creates the peer for a DragSourceContext.
1753 * Always throws InvalidDndOperationException if
1754 * GraphicsEnvironment.isHeadless() returns true.
1755 *
1756 * @param dge the {@code DragGestureEvent}
1757 * @return the peer created
1758 * @see java.awt.GraphicsEnvironment#isHeadless
1759 */
1760 public abstract DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException;
1761
1762 /**
1763 * Creates a concrete, platform dependent, subclass of the abstract
1764 * DragGestureRecognizer class requested, and associates it with the
1765 * DragSource, Component and DragGestureListener specified.
1766 *
1767 * subclasses should override this to provide their own implementation
1768 *
1769 * @param <T> the type of DragGestureRecognizer to create
1770 * @param abstractRecognizerClass The abstract class of the required recognizer
1771 * @param ds The DragSource
1772 * @param c The Component target for the DragGestureRecognizer
1773 * @param srcActions The actions permitted for the gesture
1774 * @param dgl The DragGestureListener
1775 *
1776 * @return the new object or null. Always returns null if
1777 * GraphicsEnvironment.isHeadless() returns true.
1778 * @see java.awt.GraphicsEnvironment#isHeadless
1779 */
1780 public <T extends DragGestureRecognizer> T
1781 createDragGestureRecognizer(Class<T> abstractRecognizerClass,
1782 DragSource ds, Component c, int srcActions,
1783 DragGestureListener dgl)
1784 {
1785 return null;
1786 }
1787
1788 /**
1789 * Obtains a value for the specified desktop property.
1851 if (this instanceof HeadlessToolkit) {
1852 ((HeadlessToolkit)this).getUnderlyingToolkit()
1853 .setDesktopProperty(name, newValue);
1854 return;
1855 }
1856 Object oldValue;
1857
1858 synchronized (this) {
1859 oldValue = desktopProperties.get(name);
1860 desktopProperties.put(name, newValue);
1861 }
1862
1863 // Don't fire change event if old and new values are null.
1864 // It helps to avoid recursive resending of WM_THEMECHANGED
1865 if (oldValue != null || newValue != null) {
1866 desktopPropsSupport.firePropertyChange(name, oldValue, newValue);
1867 }
1868 }
1869
1870 /**
1871 * An opportunity to lazily evaluate desktop property values.
1872 * @return the desktop property or null
1873 * @param name the name
1874 */
1875 protected Object lazilyLoadDesktopProperty(String name) {
1876 return null;
1877 }
1878
1879 /**
1880 * initializeDesktopProperties
1881 */
1882 protected void initializeDesktopProperties() {
1883 }
1884
1885 /**
1886 * Adds the specified property change listener for the named desktop
1887 * property. When a {@link java.beans.PropertyChangeListenerProxy} object is added,
1888 * its property name is ignored, and the wrapped listener is added.
1889 * If {@code name} is {@code null} or {@code pcl} is {@code null},
1890 * no exception is thrown and no action is performed.
1891 *
1892 * @param name The name of the property to listen for
1893 * @param pcl The property change listener
1933 public PropertyChangeListener[] getPropertyChangeListeners() {
1934 return desktopPropsSupport.getPropertyChangeListeners();
1935 }
1936
1937 /**
1938 * Returns an array of all property change listeners
1939 * associated with the specified name of a desktop property.
1940 *
1941 * @param propertyName the named property
1942 * @return all of the {@code PropertyChangeListener} objects
1943 * associated with the specified name of a desktop property
1944 * or an empty array if no such listeners are added
1945 *
1946 * @see PropertyChangeSupport#getPropertyChangeListeners(String)
1947 * @since 1.4
1948 */
1949 public PropertyChangeListener[] getPropertyChangeListeners(String propertyName) {
1950 return desktopPropsSupport.getPropertyChangeListeners(propertyName);
1951 }
1952
1953 /**
1954 * The desktop properties.
1955 */
1956 protected final Map<String,Object> desktopProperties =
1957 new HashMap<String,Object>();
1958 /**
1959 * The desktop properties change support.
1960 */
1961 protected final PropertyChangeSupport desktopPropsSupport =
1962 Toolkit.createPropertyChangeSupport(this);
1963
1964 /**
1965 * Returns whether the always-on-top mode is supported by this toolkit.
1966 * To detect whether the always-on-top mode is supported for a
1967 * particular Window, use {@link Window#isAlwaysOnTopSupported}.
1968 * @return <code>true</code>, if current toolkit supports the always-on-top mode,
1969 * otherwise returns <code>false</code>
1970 * @see Window#isAlwaysOnTopSupported
1971 * @see Window#setAlwaysOnTop(boolean)
1972 * @since 1.6
1973 */
1974 public boolean isAlwaysOnTopSupported() {
1975 return true;
1976 }
1977
1978 /**
1979 * Returns whether the given modality type is supported by this toolkit. If
1980 * a dialog with unsupported modality type is created, then
|