mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-25 01:30:10 +00:00
8378205: Remove AppContext from Swing MenuComponent
Reviewed-by: kizune, serb
This commit is contained in:
parent
103a08378d
commit
facbcaf06a
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -40,7 +40,6 @@ import javax.accessibility.AccessibleState;
|
||||
import javax.accessibility.AccessibleStateSet;
|
||||
|
||||
import sun.awt.AWTAccessor;
|
||||
import sun.awt.AppContext;
|
||||
import sun.awt.ComponentFactory;
|
||||
|
||||
/**
|
||||
@ -60,12 +59,6 @@ public abstract class MenuComponent implements java.io.Serializable {
|
||||
transient volatile MenuComponentPeer peer;
|
||||
transient volatile MenuContainer parent;
|
||||
|
||||
/**
|
||||
* The {@code AppContext} of the {@code MenuComponent}.
|
||||
* This is set in the constructor and never changes.
|
||||
*/
|
||||
private transient volatile AppContext appContext;
|
||||
|
||||
/**
|
||||
* The menu component's font. This value can be
|
||||
* {@code null} at which point a default will be used.
|
||||
@ -116,15 +109,6 @@ public abstract class MenuComponent implements java.io.Serializable {
|
||||
static {
|
||||
AWTAccessor.setMenuComponentAccessor(
|
||||
new AWTAccessor.MenuComponentAccessor() {
|
||||
@Override
|
||||
public AppContext getAppContext(MenuComponent menuComp) {
|
||||
return menuComp.appContext;
|
||||
}
|
||||
@Override
|
||||
public void setAppContext(MenuComponent menuComp,
|
||||
AppContext appContext) {
|
||||
menuComp.appContext = appContext;
|
||||
}
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends MenuComponentPeer> T getPeer(MenuComponent menuComp) {
|
||||
@ -154,7 +138,6 @@ public abstract class MenuComponent implements java.io.Serializable {
|
||||
*/
|
||||
public MenuComponent() throws HeadlessException {
|
||||
GraphicsEnvironment.checkHeadless();
|
||||
appContext = AppContext.getAppContext();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -428,8 +411,6 @@ public abstract class MenuComponent implements java.io.Serializable {
|
||||
GraphicsEnvironment.checkHeadless();
|
||||
|
||||
s.defaultReadObject();
|
||||
|
||||
appContext = AppContext.getAppContext();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -451,16 +451,6 @@ public final class AWTAccessor {
|
||||
* An accessor for the MenuComponent class.
|
||||
*/
|
||||
public interface MenuComponentAccessor {
|
||||
/**
|
||||
* Returns the appContext of the menu component.
|
||||
*/
|
||||
AppContext getAppContext(MenuComponent menuComp);
|
||||
|
||||
/**
|
||||
* Sets the appContext of the menu component.
|
||||
*/
|
||||
void setAppContext(MenuComponent menuComp, AppContext appContext);
|
||||
|
||||
/**
|
||||
* Returns the peer of the menu component.
|
||||
*/
|
||||
|
||||
@ -333,9 +333,6 @@ public abstract class SunToolkit extends Toolkit
|
||||
if (target instanceof Component) {
|
||||
AWTAccessor.getComponentAccessor().
|
||||
setAppContext((Component)target, context);
|
||||
} else if (target instanceof MenuComponent) {
|
||||
AWTAccessor.getMenuComponentAccessor().
|
||||
setAppContext((MenuComponent)target, context);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@ -351,8 +348,7 @@ public abstract class SunToolkit extends Toolkit
|
||||
return AWTAccessor.getComponentAccessor().
|
||||
getAppContext((Component)target);
|
||||
} else if (target instanceof MenuComponent) {
|
||||
return AWTAccessor.getMenuComponentAccessor().
|
||||
getAppContext((MenuComponent)target);
|
||||
return AppContext.getAppContext();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user