|
Java example source code file (WindowEvent.java)
The WindowEvent.java Java example source code/* * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package java.awt.event; import java.awt.Window; import java.lang.annotation.Native; import sun.awt.AppContext; import sun.awt.SunToolkit; /** * A low-level event that indicates that a window has changed its status. This * low-level event is generated by a Window object when it is opened, closed, * activated, deactivated, iconified, or deiconified, or when focus is * transfered into or out of the Window. * <P> * The event is passed to every <code>WindowListener * or <code>WindowAdapter object which registered to receive such * events using the window's <code>addWindowListener method. * (<code>WindowAdapter objects implement the * <code>WindowListener interface.) Each such listener object * gets this <code>WindowEvent when the event occurs. * <p> * An unspecified behavior will be caused if the {@code id} parameter * of any particular {@code WindowEvent} instance is not * in the range from {@code WINDOW_FIRST} to {@code WINDOW_LAST}. * * @author Carl Quinn * @author Amy Fowler * * @see WindowAdapter * @see WindowListener * @see <a href="http://docs.oracle.com/javase/tutorial/uiswing/events/windowlistener.html">Tutorial: Writing a Window Listener * * @since JDK1.1 */ public class WindowEvent extends ComponentEvent { /** * The first number in the range of ids used for window events. */ public static final int WINDOW_FIRST = 200; /** * The window opened event. This event is delivered only * the first time a window is made visible. */ @Native public static final int WINDOW_OPENED = WINDOW_FIRST; // 200 /** * The "window is closing" event. This event is delivered when * the user attempts to close the window from the window's system menu. * If the program does not explicitly hide or dispose the window * while processing this event, the window close operation will be * cancelled. */ @Native public static final int WINDOW_CLOSING = 1 + WINDOW_FIRST; //Event.WINDOW_DESTROY /** * The window closed event. This event is delivered after the displayable * window has been closed as the result of a call to dispose. * @see java.awt.Component#isDisplayable * @see Window#dispose */ @Native public static final int WINDOW_CLOSED = 2 + WINDOW_FIRST; /** * The window iconified event. This event is delivered when * the window has been changed from a normal to a minimized state. * For many platforms, a minimized window is displayed as * the icon specified in the window's iconImage property. * @see java.awt.Frame#setIconImage */ @Native public static final int WINDOW_ICONIFIED = 3 + WINDOW_FIRST; //Event.WINDOW_ICONIFY /** * The window deiconified event type. This event is delivered when * the window has been changed from a minimized to a normal state. */ @Native public static final int WINDOW_DEICONIFIED = 4 + WINDOW_FIRST; //Event.WINDOW_DEICONIFY /** * The window-activated event type. This event is delivered when the Window * becomes the active Window. Only a Frame or a Dialog can be the active * Window. The native windowing system may denote the active Window or its * children with special decorations, such as a highlighted title bar. The * active Window is always either the focused Window, or the first Frame or * Dialog that is an owner of the focused Window. */ @Native public static final int WINDOW_ACTIVATED = 5 + WINDOW_FIRST; /** * The window-deactivated event type. This event is delivered when the * Window is no longer the active Window. Only a Frame or a Dialog can be * the active Window. The native windowing system may denote the active * Window or its children with special decorations, such as a highlighted * title bar. The active Window is always either the focused Window, or the * first Frame or Dialog that is an owner of the focused Window. */ @Native public static final int WINDOW_DEACTIVATED = 6 + WINDOW_FIRST; /** * The window-gained-focus event type. This event is delivered when the * Window becomes the focused Window, which means that the Window, or one * of its subcomponents, will receive keyboard events. */ @Native public static final int WINDOW_GAINED_FOCUS = 7 + WINDOW_FIRST; /** * The window-lost-focus event type. This event is delivered when a Window * is no longer the focused Window, which means keyboard events will no * longer be delivered to the Window or any of its subcomponents. */ @Native public static final int WINDOW_LOST_FOCUS = 8 + WINDOW_FIRST; /** * The window-state-changed event type. This event is delivered * when a Window's state is changed by virtue of it being * iconified, maximized etc. * @since 1.4 */ @Native public static final int WINDOW_STATE_CHANGED = 9 + WINDOW_FIRST; /** * The last number in the range of ids used for window events. */ public static final int WINDOW_LAST = WINDOW_STATE_CHANGED; /** * The other Window involved in this focus or activation change. For a * WINDOW_ACTIVATED or WINDOW_GAINED_FOCUS event, this is the Window that * lost activation or focus. For a WINDOW_DEACTIVATED or WINDOW_LOST_FOCUS * event, this is the Window that gained activation or focus. For any other * type of WindowEvent, or if the focus or activation change occurs with a * native application, a Java application in a different VM, or with no * other Window, null is returned. * * @see #getOppositeWindow * @since 1.4 */ transient Window opposite; /** * TBS */ int oldState; int newState; /* * JDK 1.1 serialVersionUID */ private static final long serialVersionUID = -1567959133147912127L; /** * Constructs a <code>WindowEvent object. * <p>This method throws an * <code>IllegalArgumentException if Other Java examples (source code examples)Here is a short list of links related to this Java WindowEvent.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.