1 /* |
1 /* |
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2011, 2012, 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 |
24 */ |
24 */ |
25 |
25 |
26 |
26 |
27 package sun.lwawt; |
27 package sun.lwawt; |
28 |
28 |
|
29 import java.awt.AWTException; |
29 import java.awt.BufferCapabilities; |
30 import java.awt.BufferCapabilities; |
30 import java.awt.Canvas; |
|
31 import java.awt.Component; |
31 import java.awt.Component; |
|
32 import java.awt.Dimension; |
32 import java.awt.GraphicsConfiguration; |
33 import java.awt.GraphicsConfiguration; |
33 import java.awt.Image; |
34 import java.awt.Image; |
34 import java.awt.peer.CanvasPeer; |
35 import java.awt.peer.CanvasPeer; |
35 |
36 |
36 import javax.swing.JComponent; |
37 import javax.swing.JComponent; |
37 |
38 |
38 final class LWCanvasPeer extends LWComponentPeer<Component, JComponent> |
39 class LWCanvasPeer<T extends Component, D extends JComponent> |
39 implements CanvasPeer { |
40 extends LWComponentPeer<T, D> implements CanvasPeer { |
40 |
41 |
41 LWCanvasPeer(final Canvas target, PlatformComponent platformComponent) { |
42 LWCanvasPeer(final T target, final PlatformComponent platformComponent) { |
42 super(target, platformComponent); |
43 super(target, platformComponent); |
43 } |
44 } |
44 |
|
45 // ---- PEER METHODS ---- // |
45 // ---- PEER METHODS ---- // |
46 |
46 |
47 @Override |
47 @Override |
48 public void createBuffers(int numBuffers, BufferCapabilities caps) { |
48 public void createBuffers(int numBuffers, BufferCapabilities caps) |
|
49 throws AWTException { |
49 // TODO |
50 // TODO |
50 } |
51 } |
51 |
52 |
52 @Override |
53 @Override |
53 public Image getBackBuffer() { |
54 public Image getBackBuffer() { |
65 public void destroyBuffers() { |
66 public void destroyBuffers() { |
66 // TODO |
67 // TODO |
67 } |
68 } |
68 |
69 |
69 @Override |
70 @Override |
70 public GraphicsConfiguration getAppropriateGraphicsConfiguration( |
71 public final GraphicsConfiguration getAppropriateGraphicsConfiguration( |
71 GraphicsConfiguration gc) |
72 GraphicsConfiguration gc) |
72 { |
73 { |
73 // TODO |
74 // TODO |
74 return gc; |
75 return gc; |
75 } |
76 } |
|
77 |
|
78 @Override |
|
79 public final Dimension getPreferredSize() { |
|
80 return getMinimumSize(); |
|
81 } |
|
82 |
|
83 @Override |
|
84 public final Dimension getMinimumSize() { |
|
85 return getBounds().getSize(); |
|
86 } |
76 } |
87 } |