View Javadoc
1   /*
2    * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
3    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4    *
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
7    * published by the Free Software Foundation.  Oracle designates this
8    * particular file as subject to the "Classpath" exception as provided
9    * by Oracle in the LICENSE file that accompanied this code.
10   *
11   * This code is distributed in the hope that it will be useful, but WITHOUT
12   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14   * version 2 for more details (a copy is included in the LICENSE file that
15   * accompanied this code).
16   *
17   * You should have received a copy of the GNU General Public License version
18   * 2 along with this work; if not, write to the Free Software Foundation,
19   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20   *
21   * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22   * or visit www.oracle.com if you need additional information or have any
23   * questions.
24   */
25  
26  package java.awt.peer;
27  
28  import java.awt.*;
29  
30  import sun.awt.EmbeddedFrame;
31  
32  /**
33   * The peer interface for {@link Frame}. This adds a couple of frame specific
34   * methods to the {@link WindowPeer} interface.
35   *
36   * The peer interfaces are intended only for use in porting
37   * the AWT. They are not intended for use by application
38   * developers, and developers should not implement peers
39   * nor invoke any of the peer methods directly on the peer
40   * instances.
41   */
42  public interface FramePeer extends WindowPeer {
43  
44      /**
45       * Sets the title on the frame.
46       *
47       * @param title the title to set
48       *
49       * @see Frame#setTitle(String)
50       */
51      void setTitle(String title);
52  
53      /**
54       * Sets the menu bar for the frame.
55       *
56       * @param mb the menu bar to set
57       *
58       * @see Frame#setMenuBar(MenuBar)
59       */
60      void setMenuBar(MenuBar mb);
61  
62      /**
63       * Sets if the frame should be resizable or not.
64       *
65       * @param resizeable {@code true} when the frame should be resizable,
66       *        {@code false} if not
67       *
68       * @see Frame#setResizable(boolean)
69       */
70      void setResizable(boolean resizeable);
71  
72      /**
73       * Changes the state of the frame.
74       *
75       * @param state the new state
76       *
77       * @see Frame#setExtendedState(int)
78       */
79      void setState(int state);
80  
81      /**
82       * Returns the current state of the frame.
83       *
84       * @return the current state of the frame
85       *
86       * @see Frame#getExtendedState()
87       */
88      int getState();
89  
90      /**
91       * Sets the bounds of the frame when it becomes maximized.
92       *
93       * @param bounds the maximized bounds of the frame
94       *
95       * @see Frame#setMaximizedBounds(Rectangle)
96       */
97      void setMaximizedBounds(Rectangle bounds);
98  
99      /**
100      * Sets the size and location for embedded frames. (On embedded frames,
101      * setLocation() and setBounds() always set the frame to (0,0) for
102      * backwards compatibility.
103      *
104      * @param x the X location
105      * @param y the Y location
106      * @param width the width of the frame
107      * @param height the height of the frame
108      *
109      * @see EmbeddedFrame#setBoundsPrivate(int, int, int, int)
110      */
111     // TODO: This is only used in EmbeddedFrame, and should probably be moved
112     // into an EmbeddedFramePeer which would extend FramePeer
113     void setBoundsPrivate(int x, int y, int width, int height);
114 
115     /**
116      * Returns the size and location for embedded frames. (On embedded frames,
117      * setLocation() and setBounds() always set the frame to (0,0) for
118      * backwards compatibility.
119      *
120      * @return the bounds of an embedded frame
121      *
122      * @see EmbeddedFrame#getBoundsPrivate()
123      */
124     // TODO: This is only used in EmbeddedFrame, and should probably be moved
125     // into an EmbeddedFramePeer which would extend FramePeer
126     Rectangle getBoundsPrivate();
127 
128     /**
129      * Requests the peer to emulate window activation.
130      *
131      * @param activate activate or deactivate the window
132      */
133     void emulateActivation(boolean activate);
134 }