1 /* |
1 /* |
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
31 |
31 |
32 import javax.swing.RootPaneContainer; |
32 import javax.swing.RootPaneContainer; |
33 |
33 |
34 import com.apple.eawt.AppEvent.FullScreenEvent; |
34 import com.apple.eawt.AppEvent.FullScreenEvent; |
35 |
35 |
36 import javax.tools.annotation.GenerateNativeHeader; |
36 import java.lang.annotation.Native; |
37 |
37 |
38 /* No native methods here, but the constants are needed in the supporting JNI code */ |
|
39 @GenerateNativeHeader |
|
40 final class FullScreenHandler { |
38 final class FullScreenHandler { |
41 private static final String CLIENT_PROPERTY = "com.apple.eawt.event.internalFullScreenHandler"; |
39 private static final String CLIENT_PROPERTY = "com.apple.eawt.event.internalFullScreenHandler"; |
42 |
40 |
43 static final int FULLSCREEN_WILL_ENTER = 1; |
41 @Native static final int FULLSCREEN_WILL_ENTER = 1; |
44 static final int FULLSCREEN_DID_ENTER = 2; |
42 @Native static final int FULLSCREEN_DID_ENTER = 2; |
45 static final int FULLSCREEN_WILL_EXIT = 3; |
43 @Native static final int FULLSCREEN_WILL_EXIT = 3; |
46 static final int FULLSCREEN_DID_EXIT = 4; |
44 @Native static final int FULLSCREEN_DID_EXIT = 4; |
47 |
45 |
48 // installs a private instance of the handler, if necessary |
46 // installs a private instance of the handler, if necessary |
49 static void addFullScreenListenerTo(final RootPaneContainer window, final FullScreenListener listener) { |
47 static void addFullScreenListenerTo(final RootPaneContainer window, final FullScreenListener listener) { |
50 final Object value = window.getRootPane().getClientProperty(CLIENT_PROPERTY); |
48 final Object value = window.getRootPane().getClientProperty(CLIENT_PROPERTY); |
51 if (value instanceof FullScreenHandler) { |
49 if (value instanceof FullScreenHandler) { |