jdk/src/share/classes/java/awt/TextComponent.java
Print this page
rev 5725 : Merge
*** 105,120 ****
// A flag used to tell whether the background has been set by
// developer code (as opposed to AWT code). Used to determine
// the background color of non-editable TextComponents.
boolean backgroundSetByClientCode = false;
- /**
- * True if this <code>TextComponent</code> has access
- * to the System clipboard.
- */
- transient private boolean canAccessClipboard;
-
transient protected TextListener textListener;
/*
* JDK 1.1 serialVersionUID
*/
--- 105,114 ----
*** 135,145 ****
*/
TextComponent(String text) throws HeadlessException {
GraphicsEnvironment.checkHeadless();
this.text = (text != null) ? text : "";
setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
- checkSystemClipboardAccess();
}
private void enableInputMethodsIfNecessary() {
if (checkForEnableIM) {
checkForEnableIM = false;
--- 129,138 ----
*** 730,750 ****
}
/**
* Assigns a valid value to the canAccessClipboard instance variable.
*/
! private void checkSystemClipboardAccess() {
! canAccessClipboard = true;
SecurityManager sm = System.getSecurityManager();
! if (sm != null) {
try {
sm.checkSystemClipboardAccess();
! }
! catch (SecurityException e) {
! canAccessClipboard = false;
! }
! }
}
/*
* Serialization support.
*/
--- 723,740 ----
}
/**
* Assigns a valid value to the canAccessClipboard instance variable.
*/
! private boolean canAccessClipboard() {
SecurityManager sm = System.getSecurityManager();
! if (sm == null) return true;
try {
sm.checkSystemClipboardAccess();
! return true;
! } catch (SecurityException e) {}
! return false;
}
/*
* Serialization support.
*/
*** 823,833 ****
// skip value for unrecognized key
s.readObject();
}
}
enableInputMethodsIfNecessary();
- checkSystemClipboardAccess();
}
/////////////////
// Accessibility support
--- 813,822 ----