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

Print this page




   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 sun.lwawt;
  27 




  28 import java.awt.Graphics;
  29 import java.awt.Insets;
  30 import java.awt.Point;
  31 import java.awt.Rectangle;
  32 import java.awt.Window;
  33 import java.awt.dnd.DropTarget;
  34 
  35 import sun.awt.CausedFocusEvent;
  36 import sun.awt.LightweightFrame;
  37 
  38 public class LWLightweightFramePeer extends LWWindowPeer {
  39 
  40     public LWLightweightFramePeer(LightweightFrame target,
  41                                   PlatformComponent platformComponent,
  42                                   PlatformWindow platformWindow)
  43     {
  44         super(target, platformComponent, platformWindow, LWWindowPeer.PeerType.LW_FRAME);
  45     }
  46 
  47     private LightweightFrame getLwTarget() {
  48         return (LightweightFrame)getTarget();
  49     }
  50 
  51     @Override
  52     public Graphics getGraphics() {
  53         return getLwTarget().getGraphics();
  54     }
  55 
  56     @Override
  57     protected void setVisibleImpl(final boolean visible) {
  58     }


  74         return true;
  75     }
  76 
  77     @Override
  78     public Point getLocationOnScreen() {
  79         Rectangle bounds = getBounds();
  80         return new Point(bounds.x, bounds.y); // todo
  81     }
  82 
  83     @Override
  84     public Insets getInsets() {
  85         return new Insets(0, 0, 0, 0);
  86     }
  87 
  88     @Override
  89     public void setBounds(int x, int y, int w, int h, int op) {
  90         setBounds(x, y, w, h, op, true, false);
  91     }
  92 
  93     @Override
  94     public void updateCursorImmediately() {
  95         // TODO: tries to switch to the awt/fx toolkit thread and causes a deadlock on macosx
  96     }
  97 
  98     @Override
  99     public void addDropTarget(DropTarget dt) {
 100     }
 101 
 102     @Override
 103     public void removeDropTarget(DropTarget dt) {
 104     }
 105 
 106     @Override
 107     public void grab() {
 108         getLwTarget().grabFocus();
 109     }
 110 
 111     @Override
 112     public void ungrab() {
 113         getLwTarget().ungrabFocus();










 114     }
 115 }


   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 sun.lwawt;
  27 
  28 import sun.awt.CausedFocusEvent;
  29 import sun.awt.LightweightFrame;
  30 import sun.awt.LightweightFramePeer;
  31 
  32 import java.awt.Graphics;
  33 import java.awt.Insets;
  34 import java.awt.Point;
  35 import java.awt.Rectangle;
  36 import java.awt.Window;
  37 import java.awt.dnd.DropTarget;
  38 


  39 
  40 public class LWLightweightFramePeer extends LWWindowPeer implements LightweightFramePeer {
  41 
  42     public LWLightweightFramePeer(LightweightFrame target,
  43                                   PlatformComponent platformComponent,
  44                                   PlatformWindow platformWindow)
  45     {
  46         super(target, platformComponent, platformWindow, LWWindowPeer.PeerType.LW_FRAME);
  47     }
  48 
  49     private LightweightFrame getLwTarget() {
  50         return (LightweightFrame)getTarget();
  51     }
  52 
  53     @Override
  54     public Graphics getGraphics() {
  55         return getLwTarget().getGraphics();
  56     }
  57 
  58     @Override
  59     protected void setVisibleImpl(final boolean visible) {
  60     }


  76         return true;
  77     }
  78 
  79     @Override
  80     public Point getLocationOnScreen() {
  81         Rectangle bounds = getBounds();
  82         return new Point(bounds.x, bounds.y); // todo
  83     }
  84 
  85     @Override
  86     public Insets getInsets() {
  87         return new Insets(0, 0, 0, 0);
  88     }
  89 
  90     @Override
  91     public void setBounds(int x, int y, int w, int h, int op) {
  92         setBounds(x, y, w, h, op, true, false);
  93     }
  94 
  95     @Override





  96     public void addDropTarget(DropTarget dt) {
  97     }
  98 
  99     @Override
 100     public void removeDropTarget(DropTarget dt) {
 101     }
 102 
 103     @Override
 104     public void grab() {
 105         getLwTarget().grabFocus();
 106     }
 107 
 108     @Override
 109     public void ungrab() {
 110         getLwTarget().ungrabFocus();
 111     }
 112 
 113     @Override
 114     public void setLightweightFrameUnderMouse() {
 115         setLastCommonMouseEventPeer(this);
 116     }
 117 
 118     @Override
 119     public boolean cleanLightweightFrameUnderMouse() {
 120         return cleanLastCommonMouseEventPeer(this);
 121     }
 122 }