< prev index next >

src/java.desktop/share/classes/java/awt/Window.java

Print this page




1913      * @since 1.4
1914      */
1915     public synchronized WindowStateListener[] getWindowStateListeners() {
1916         return getListeners(WindowStateListener.class);
1917     }
1918 
1919 
1920     /**
1921      * Returns an array of all the objects currently registered
1922      * as <code><em>Foo</em>Listener</code>s
1923      * upon this {@code Window}.
1924      * <code><em>Foo</em>Listener</code>s are registered using the
1925      * <code>add<em>Foo</em>Listener</code> method.
1926      *
1927      * <p>
1928      *
1929      * You can specify the {@code listenerType} argument
1930      * with a class literal, such as
1931      * <code><em>Foo</em>Listener.class</code>.
1932      * For example, you can query a
1933      * {@code Window} {@code w}
1934      * for its window listeners with the following code:
1935      *
1936      * <pre>WindowListener[] wls = (WindowListener[])(w.getListeners(WindowListener.class));</pre>
1937      *
1938      * If no such listeners exist, this method returns an empty array.
1939      *
1940      * @param listenerType the type of listeners requested; this parameter
1941      *          should specify an interface that descends from
1942      *          {@code java.util.EventListener}
1943      * @return an array of all objects registered as
1944      *          <code><em>Foo</em>Listener</code>s on this window,
1945      *          or an empty array if no such
1946      *          listeners have been added
1947      * @exception ClassCastException if {@code listenerType}
1948      *          doesn't specify a class or interface that implements
1949      *          {@code java.util.EventListener}
1950      * @exception NullPointerException if {@code listenerType} is {@code null}
1951      *
1952      * @see #getWindowListeners
1953      * @since 1.3




1913      * @since 1.4
1914      */
1915     public synchronized WindowStateListener[] getWindowStateListeners() {
1916         return getListeners(WindowStateListener.class);
1917     }
1918 
1919 
1920     /**
1921      * Returns an array of all the objects currently registered
1922      * as <code><em>Foo</em>Listener</code>s
1923      * upon this {@code Window}.
1924      * <code><em>Foo</em>Listener</code>s are registered using the
1925      * <code>add<em>Foo</em>Listener</code> method.
1926      *
1927      * <p>
1928      *
1929      * You can specify the {@code listenerType} argument
1930      * with a class literal, such as
1931      * <code><em>Foo</em>Listener.class</code>.
1932      * For example, you can query a
1933      * {@code Window w}
1934      * for its window listeners with the following code:
1935      *
1936      * <pre>WindowListener[] wls = (WindowListener[])(w.getListeners(WindowListener.class));</pre>
1937      *
1938      * If no such listeners exist, this method returns an empty array.
1939      *
1940      * @param listenerType the type of listeners requested; this parameter
1941      *          should specify an interface that descends from
1942      *          {@code java.util.EventListener}
1943      * @return an array of all objects registered as
1944      *          <code><em>Foo</em>Listener</code>s on this window,
1945      *          or an empty array if no such
1946      *          listeners have been added
1947      * @exception ClassCastException if {@code listenerType}
1948      *          doesn't specify a class or interface that implements
1949      *          {@code java.util.EventListener}
1950      * @exception NullPointerException if {@code listenerType} is {@code null}
1951      *
1952      * @see #getWindowListeners
1953      * @since 1.3


< prev index next >