equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1996, 2014, 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 |
27 import java.awt.*; |
27 import java.awt.*; |
28 import java.awt.peer.*; |
28 import java.awt.peer.*; |
29 |
29 |
30 import sun.awt.AWTAccessor; |
30 import sun.awt.AWTAccessor; |
31 |
31 |
32 public class WPopupMenuPeer extends WMenuPeer implements PopupMenuPeer { |
32 final class WPopupMenuPeer extends WMenuPeer implements PopupMenuPeer { |
33 // We can't use target.getParent() for TrayIcon popup |
33 // We can't use target.getParent() for TrayIcon popup |
34 // because this method should return null for the TrayIcon |
34 // because this method should return null for the TrayIcon |
35 // popup regardless of that whether it has parent or not. |
35 // popup regardless of that whether it has parent or not. |
36 |
36 |
37 public WPopupMenuPeer(PopupMenu target) { |
37 WPopupMenuPeer(PopupMenu target) { |
38 this.target = target; |
38 this.target = target; |
39 MenuContainer parent = null; |
39 MenuContainer parent = null; |
40 |
40 |
41 // We can't use target.getParent() for TrayIcon popup |
41 // We can't use target.getParent() for TrayIcon popup |
42 // because this method should return null for the TrayIcon |
42 // because this method should return null for the TrayIcon |
65 throw new IllegalArgumentException( |
65 throw new IllegalArgumentException( |
66 "illegal popup menu container class"); |
66 "illegal popup menu container class"); |
67 } |
67 } |
68 } |
68 } |
69 |
69 |
70 native void createMenu(WComponentPeer parent); |
70 private native void createMenu(WComponentPeer parent); |
71 |
71 |
72 public void show(Event e) { |
72 public void show(Event e) { |
73 Component origin = (Component)e.target; |
73 Component origin = (Component)e.target; |
74 WComponentPeer peer = (WComponentPeer) WToolkit.targetToPeer(origin); |
74 WComponentPeer peer = (WComponentPeer) WToolkit.targetToPeer(origin); |
75 if (peer == null) { |
75 if (peer == null) { |
104 e.x = p.x; |
104 e.x = p.x; |
105 e.y = p.y; |
105 e.y = p.y; |
106 _show(e); |
106 _show(e); |
107 } |
107 } |
108 |
108 |
109 public native void _show(Event e); |
109 private native void _show(Event e); |
110 } |
110 } |