JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java™ (public API).
WindowEvent.java
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
3 * Copyright (c) 2010 JogAmp Community. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * - Redistribution of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * - Redistribution in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * Neither the name of Sun Microsystems, Inc. or the names of
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * This software is provided "AS IS," without a warranty of any kind. ALL
21 * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
22 * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
23 * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
24 * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
25 * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
26 * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
27 * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
28 * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
29 * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
30 * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
31 * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
32 *
33 */
34
35package com.jogamp.newt.event;
36
37/**
38 * NEWT Window events are provided for notification purposes ONLY.<br>
39 * NEWT will automatically handle component moves and resizes internally, regardless of whether a program is receiving these events or not. <br>
40 * The actual event semantic, here move and resize, is processed before the event is send.<br>
41 */
42@SuppressWarnings("serial")
43public class WindowEvent extends NEWTEvent {
44 public static final short EVENT_WINDOW_RESIZED = 100;
45 public static final short EVENT_WINDOW_MOVED = 101;
46 public static final short EVENT_WINDOW_DESTROY_NOTIFY = 102;
47 public static final short EVENT_WINDOW_GAINED_FOCUS = 103;
48 public static final short EVENT_WINDOW_LOST_FOCUS = 104;
49 public static final short EVENT_WINDOW_REPAINT = 105;
50 public static final short EVENT_WINDOW_DESTROYED = 106;
51
52 public WindowEvent(final short eventType, final Object source, final long when) {
53 super(eventType, source, when);
54 }
55
56 public static String getEventTypeString(final short type) {
57 switch(type) {
58 case EVENT_WINDOW_RESIZED: return "RESIZED";
59 case EVENT_WINDOW_MOVED: return "MOVED";
60 case EVENT_WINDOW_DESTROY_NOTIFY: return "DESTROY_NOTIFY";
61 case EVENT_WINDOW_GAINED_FOCUS: return "GAINED_FOCUS";
62 case EVENT_WINDOW_LOST_FOCUS: return "LOST_FOCUS";
63 case EVENT_WINDOW_REPAINT: return "REPAINT";
64 case EVENT_WINDOW_DESTROYED: return "DESTROYED";
65 default: return "unknown (" + type + ")";
66 }
67 }
68
69 @Override
70 public String toString() {
71 return toString(null).toString();
72 }
73
74 @Override
75 public StringBuilder toString(StringBuilder sb) {
76 if(null == sb) {
77 sb = new StringBuilder();
78 }
79 sb.append("WindowEvent[").append(getEventTypeString(getEventType())).append(", ");
80 return super.toString(sb).append("]");
81 }
82}
NEWT events are provided for notification purposes ONLY; The NEWT will automatically handle the even...
Definition: NEWTEvent.java:52
NEWT Window events are provided for notification purposes ONLY.
static String getEventTypeString(final short type)
WindowEvent(final short eventType, final Object source, final long when)
StringBuilder toString(StringBuilder sb)