src/macosx/classes/sun/lwawt/LWCanvasPeer.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2012, 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

@@ -24,30 +24,31 @@
  */
 
 
 package sun.lwawt;
 
+import java.awt.AWTException;
 import java.awt.BufferCapabilities;
-import java.awt.Canvas;
 import java.awt.Component;
+import java.awt.Dimension;
 import java.awt.GraphicsConfiguration;
 import java.awt.Image;
 import java.awt.peer.CanvasPeer;
 
 import javax.swing.JComponent;
 
-final class LWCanvasPeer extends LWComponentPeer<Component, JComponent>
-        implements CanvasPeer {
+class LWCanvasPeer<T extends Component, D extends JComponent>
+        extends LWComponentPeer<T, D> implements CanvasPeer {
 
-    LWCanvasPeer(final Canvas target, PlatformComponent platformComponent) {
+    LWCanvasPeer(final T target, final PlatformComponent platformComponent) {
         super(target, platformComponent);
     }
-
     // ---- PEER METHODS ---- //
 
     @Override
-    public void createBuffers(int numBuffers, BufferCapabilities caps) {
+    public void createBuffers(int numBuffers, BufferCapabilities caps)
+            throws AWTException {
         // TODO
     }
 
     @Override
     public Image getBackBuffer() {

@@ -65,12 +66,22 @@
     public void destroyBuffers() {
         // TODO
     }
 
     @Override
-    public GraphicsConfiguration getAppropriateGraphicsConfiguration(
+    public final GraphicsConfiguration getAppropriateGraphicsConfiguration(
             GraphicsConfiguration gc)
     {
         // TODO
         return gc;
     }
+
+    @Override
+    public final Dimension getPreferredSize() {
+        return getMinimumSize();
+    }
+
+    @Override
+    public final Dimension getMinimumSize() {
+        return getBounds().getSize();
+    }
 }