src/share/classes/sun/awt/EmbeddedFrame.java
Print this page
*** 178,187 ****
--- 178,188 ----
* Needed to avoid memory leak: we register this EmbeddedFrame as a listener with
* KeyboardFocusManager of applet's AppContext. We don't want the KFM to keep
* reference to our EmbeddedFrame forever if the Frame is no longer in use, so we
* add listeners in show() and remove them in hide().
*/
+ @SuppressWarnings("deprecation")
public void show() {
if (appletKFM != null) {
addTraversingOutListeners(appletKFM);
}
super.show();
*** 191,200 ****
--- 192,202 ----
* Needed to avoid memory leak: we register this EmbeddedFrame as a listener with
* KeyboardFocusManager of applet's AppContext. We don't want the KFM to keep
* reference to our EmbeddedFrame forever if the Frame is no longer in use, so we
* add listeners in show() and remove them in hide().
*/
+ @SuppressWarnings("deprecation")
public void hide() {
if (appletKFM != null) {
removeTraversingOutListeners(appletKFM);
}
super.hide();
*** 210,221 ****
// We can't guarantee that this is called on the same AppContext as EmbeddedFrame
// belongs to. That's why we can't use public methods to find current focus cycle
// root. Instead, we access KFM's private field directly.
if (currentCycleRoot == null) {
! currentCycleRoot = (Field)AccessController.doPrivileged(new PrivilegedAction() {
! public Object run() {
try {
Field unaccessibleRoot = KeyboardFocusManager.class.
getDeclaredField("currentFocusCycleRoot");
if (unaccessibleRoot != null) {
unaccessibleRoot.setAccessible(true);
--- 212,223 ----
// We can't guarantee that this is called on the same AppContext as EmbeddedFrame
// belongs to. That's why we can't use public methods to find current focus cycle
// root. Instead, we access KFM's private field directly.
if (currentCycleRoot == null) {
! currentCycleRoot = AccessController.doPrivileged(new PrivilegedAction<Field>() {
! public Field run() {
try {
Field unaccessibleRoot = KeyboardFocusManager.class.
getDeclaredField("currentFocusCycleRoot");
if (unaccessibleRoot != null) {
unaccessibleRoot.setAccessible(true);
*** 255,265 ****
if (!getFocusTraversalKeysEnabled() || e.isConsumed()) {
return false;
}
AWTKeyStroke stroke = AWTKeyStroke.getAWTKeyStrokeForEvent(e);
! Set toTest;
Component currentFocused = e.getComponent();
toTest = getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
if (toTest.contains(stroke)) {
// 6581899: performance improvement for SortingFocusTraversalPolicy
--- 257,267 ----
if (!getFocusTraversalKeysEnabled() || e.isConsumed()) {
return false;
}
AWTKeyStroke stroke = AWTKeyStroke.getAWTKeyStrokeForEvent(e);
! Set<AWTKeyStroke> toTest;
Component currentFocused = e.getComponent();
toTest = getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
if (toTest.contains(stroke)) {
// 6581899: performance improvement for SortingFocusTraversalPolicy
*** 355,374 ****
--- 357,378 ----
public boolean isResizable() {
return true;
}
+ @SuppressWarnings("deprecation")
public void addNotify() {
synchronized (getTreeLock()) {
if (getPeer() == null) {
setPeer(new NullEmbeddedFramePeer());
}
super.addNotify();
}
}
// These three functions consitute RFE 4100710. Do not remove.
+ @SuppressWarnings("deprecation")
public void setCursorAllowed(boolean isCursorAllowed) {
this.isCursorAllowed = isCursorAllowed;
getPeer().updateCursorImmediately();
}
public boolean isCursorAllowed() {
*** 378,391 ****
return (isCursorAllowed)
? super.getCursor()
: Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
}
protected void setPeer(final ComponentPeer p){
if (fieldPeer == null) {
! fieldPeer = (Field)AccessController.doPrivileged(new PrivilegedAction() {
! public Object run() {
try {
Field lnkPeer = Component.class.getDeclaredField("peer");
if (lnkPeer != null) {
lnkPeer.setAccessible(true);
}
--- 382,396 ----
return (isCursorAllowed)
? super.getCursor()
: Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
}
+ @SuppressWarnings("deprecation")
protected void setPeer(final ComponentPeer p){
if (fieldPeer == null) {
! fieldPeer = AccessController.doPrivileged(new PrivilegedAction<Field>() {
! public Field run() {
try {
Field lnkPeer = Component.class.getDeclaredField("peer");
if (lnkPeer != null) {
lnkPeer.setAccessible(true);
}
*** 398,408 ****
return null;
}//run
});
}
try{
! if (fieldPeer !=null){
fieldPeer.set(EmbeddedFrame.this, p);
}
} catch (IllegalAccessException e) {
assert false;
}
--- 403,413 ----
return null;
}//run
});
}
try{
! if (fieldPeer != null){
fieldPeer.set(EmbeddedFrame.this, p);
}
} catch (IllegalAccessException e) {
assert false;
}
*** 505,514 ****
--- 510,520 ----
* @see #setLocationPrivate
* @see #getLocationPrivate
* @see #getBoundsPrivate
* @since 1.5
*/
+ @SuppressWarnings("deprecation")
protected void setBoundsPrivate(int x, int y, int width, int height) {
final FramePeer peer = (FramePeer)getPeer();
if (peer != null) {
peer.setBoundsPrivate(x, y, width, height);
}
*** 536,545 ****
--- 542,552 ----
* @see #setLocationPrivate
* @see #getLocationPrivate
* @see #setBoundsPrivate
* @since 1.6
*/
+ @SuppressWarnings("deprecation")
protected Rectangle getBoundsPrivate() {
final FramePeer peer = (FramePeer)getPeer();
if (peer != null) {
return peer.getBoundsPrivate();
}