src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
Print this page
@@ -42,11 +42,11 @@
import com.apple.laf.*;
import com.apple.laf.ClientPropertyApplicator.Property;
import com.sun.awt.AWTUtilities;
-public final class CPlatformWindow extends CFRetainedResource implements PlatformWindow {
+public class CPlatformWindow extends CFRetainedResource implements PlatformWindow {
private native long nativeCreateNSWindow(long nsViewPtr, long styleBits, double x, double y, double w, double h);
private static native void nativeSetNSWindowStyleBits(long nsWindowPtr, int mask, int data);
private static native void nativeSetNSWindowMenuBar(long nsWindowPtr, long menuBarPtr);
private static native Insets nativeGetNSWindowInsets(long nsWindowPtr);
private static native void nativeSetNSWindowBounds(long nsWindowPtr, double x, double y, double w, double h);
@@ -216,24 +216,19 @@
* Delegate initialization (create native window and all the
* related resources).
*/
@Override // PlatformWindow
public void initialize(Window _target, LWWindowPeer _peer, PlatformWindow _owner) {
- this.peer = _peer;
- this.target = _target;
- if (_owner instanceof CPlatformWindow) {
- this.owner = (CPlatformWindow)_owner;
- }
+ initializeBase(_target, _peer, _owner, new CPlatformView());
final int styleBits = getInitialStyleBits();
// TODO: handle these misc properties
final long parentNSWindowPtr = (owner != null ? owner.getNSWindowPtr() : 0);
String warningString = target.getWarningString();
responder = new CPlatformResponder(peer, false);
- contentView = new CPlatformView();
contentView.initialize(peer, responder);
final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(), styleBits, 0, 0, 0, 0);
setPtr(nativeWindowPtr);
@@ -251,10 +246,19 @@
}
validateSurface();
}
+ protected void initializeBase(Window target, LWWindowPeer peer, PlatformWindow owner, CPlatformView view) {
+ this.peer = peer;
+ this.target = target;
+ if (owner instanceof CPlatformWindow) {
+ this.owner = (CPlatformWindow)owner;
+ }
+ this.contentView = view;
+ }
+
private int getInitialStyleBits() {
// defaults style bits
int styleBits = DECORATED | HAS_SHADOW | CLOSEABLE | MINIMIZABLE | ZOOMABLE | RESIZABLE;
if (isNativelyFocusableWindow()) {