This commit is contained in:
Lana Steuck 2012-02-10 10:23:13 -08:00
commit 9fbc16e840
8 changed files with 51 additions and 44 deletions

View File

@ -115,7 +115,7 @@ public class List extends Component implements ItemSelectable, Accessible {
* @see #addItem(String) * @see #addItem(String)
* @see #getItem(int) * @see #getItem(int)
*/ */
Vector items = new Vector(); Vector<String> items = new Vector<>();
/** /**
* This field will represent the number of visible rows in the * This field will represent the number of visible rows in the
@ -306,7 +306,7 @@ public class List extends Component implements ItemSelectable, Accessible {
// to insure that it cannot be overridden by client subclasses. // to insure that it cannot be overridden by client subclasses.
// DO NOT INVOKE CLIENT CODE ON THIS THREAD! // DO NOT INVOKE CLIENT CODE ON THIS THREAD!
final String getItemImpl(int index) { final String getItemImpl(int index) {
return (String)items.elementAt(index); return items.elementAt(index);
} }
/** /**
@ -415,7 +415,7 @@ public class List extends Component implements ItemSelectable, Accessible {
if (peer != null) { if (peer != null) {
peer.removeAll(); peer.removeAll();
} }
items = new Vector(); items = new Vector<>();
selected = new int[0]; selected = new int[0];
} }
@ -490,9 +490,9 @@ public class List extends Component implements ItemSelectable, Accessible {
public synchronized int[] getSelectedIndexes() { public synchronized int[] getSelectedIndexes() {
ListPeer peer = (ListPeer)this.peer; ListPeer peer = (ListPeer)this.peer;
if (peer != null) { if (peer != null) {
selected = ((ListPeer)peer).getSelectedIndexes(); selected = peer.getSelectedIndexes();
} }
return (int[])selected.clone(); return selected.clone();
} }
/** /**
@ -908,7 +908,7 @@ public class List extends Component implements ItemSelectable, Accessible {
* @since 1.4 * @since 1.4
*/ */
public synchronized ItemListener[] getItemListeners() { public synchronized ItemListener[] getItemListeners() {
return (ItemListener[])(getListeners(ItemListener.class)); return getListeners(ItemListener.class);
} }
/** /**
@ -975,7 +975,7 @@ public class List extends Component implements ItemSelectable, Accessible {
* @since 1.4 * @since 1.4
*/ */
public synchronized ActionListener[] getActionListeners() { public synchronized ActionListener[] getActionListeners() {
return (ActionListener[])(getListeners(ActionListener.class)); return getListeners(ActionListener.class);
} }
/** /**

View File

@ -398,10 +398,10 @@ public class Window extends Container implements Accessible {
initIDs(); initIDs();
} }
String s = (String) java.security.AccessController.doPrivileged( String s = java.security.AccessController.doPrivileged(
new GetPropertyAction("java.awt.syncLWRequests")); new GetPropertyAction("java.awt.syncLWRequests"));
systemSyncLWRequests = (s != null && s.equals("true")); systemSyncLWRequests = (s != null && s.equals("true"));
s = (String) java.security.AccessController.doPrivileged( s = java.security.AccessController.doPrivileged(
new GetPropertyAction("java.awt.Window.locationByPlatform")); new GetPropertyAction("java.awt.Window.locationByPlatform"));
locationByPlatformProp = (s != null && s.equals("true")); locationByPlatformProp = (s != null && s.equals("true"));
} }
@ -1378,7 +1378,7 @@ public class Window extends Container implements Accessible {
// make sure the privileged action is only // make sure the privileged action is only
// for getting the property! We don't want the // for getting the property! We don't want the
// above checkTopLevelWindow call to always succeed! // above checkTopLevelWindow call to always succeed!
warningString = (String) AccessController.doPrivileged( warningString = AccessController.doPrivileged(
new GetPropertyAction("awt.appletWarning", new GetPropertyAction("awt.appletWarning",
"Java Applet Window")); "Java Applet Window"));
} }

View File

@ -921,9 +921,9 @@ public class ICC_Profile implements Serializable {
*/ */
private static ICC_Profile getStandardProfile(final String name) { private static ICC_Profile getStandardProfile(final String name) {
return (ICC_Profile) AccessController.doPrivileged( return AccessController.doPrivileged(
new PrivilegedAction() { new PrivilegedAction<ICC_Profile>() {
public Object run() { public ICC_Profile run() {
ICC_Profile p = null; ICC_Profile p = null;
try { try {
p = getInstance (name); p = getInstance (name);

View File

@ -321,14 +321,15 @@ public abstract class InputEvent extends ComponentEvent {
* @param when a long int that gives the time the event occurred. * @param when a long int that gives the time the event occurred.
* Passing negative or zero value * Passing negative or zero value
* is not recommended * is not recommended
* @param modifiers the modifier keys down during event (e.g. shift, ctrl, * @param modifiers a modifier mask describing the modifier keys and mouse
* alt, meta) * buttons (for example, shift, ctrl, alt, and meta) that
* Passing negative parameter is not recommended. * are down during the event.
* Zero value means no modifiers. * Only extended modifiers are allowed to be used as a
* Either extended _DOWN_MASK or old _MASK modifiers * value for this parameter (see the {@link InputEvent#getModifiersEx}
* should be used, but both models should not be mixed * class for the description of extended modifiers).
* in one event. Use of the extended modifiers is * Passing negative parameter
* preferred * is not recommended.
* Zero value means that no modifiers were passed
* @throws IllegalArgumentException if <code>source</code> is null * @throws IllegalArgumentException if <code>source</code> is null
* @see #getSource() * @see #getSource()
* @see #getID() * @see #getID()
@ -416,9 +417,13 @@ public abstract class InputEvent extends ComponentEvent {
/** /**
* Returns the extended modifier mask for this event. * Returns the extended modifier mask for this event.
* <P>
* Extended modifiers are the modifiers that ends with the _DOWN_MASK suffix,
* such as ALT_DOWN_MASK, BUTTON1_DOWN_MASK, and others.
* <P>
* Extended modifiers represent the state of all modal keys, * Extended modifiers represent the state of all modal keys,
* such as ALT, CTRL, META, and the mouse buttons just after * such as ALT, CTRL, META, and the mouse buttons just after
* the event occurred * the event occurred.
* <P> * <P>
* For example, if the user presses <b>button 1</b> followed by * For example, if the user presses <b>button 1</b> followed by
* <b>button 2</b>, and then releases them in the same order, * <b>button 2</b>, and then releases them in the same order,

View File

@ -488,14 +488,15 @@ public class MouseEvent extends InputEvent {
* @param when A long integer that gives the time the event occurred. * @param when A long integer that gives the time the event occurred.
* Passing negative or zero value * Passing negative or zero value
* is not recommended * is not recommended
* @param modifiers The modifier keys down during event (e.g. shift, ctrl, * @param modifiers a modifier mask describing the modifier keys and mouse
* alt, meta) * buttons (for example, shift, ctrl, alt, and meta) that
* are down during the event.
* Only extended modifiers are allowed to be used as a
* value for this parameter (see the {@link InputEvent#getModifiersEx}
* class for the description of extended modifiers).
* Passing negative parameter * Passing negative parameter
* is not recommended. * is not recommended.
* Zero value means that no modifiers were passed. * Zero value means that no modifiers were passed
* Use either an extended _DOWN_MASK or old _MASK modifiers,
* however do not mix models in the one event.
* The extended modifiers are preferred for using
* @param x The horizontal x coordinate for the mouse location. * @param x The horizontal x coordinate for the mouse location.
* It is allowed to pass negative values * It is allowed to pass negative values
* @param y The vertical y coordinate for the mouse location. * @param y The vertical y coordinate for the mouse location.
@ -586,14 +587,15 @@ public class MouseEvent extends InputEvent {
* @param when A long integer that gives the time the event occurred. * @param when A long integer that gives the time the event occurred.
* Passing negative or zero value * Passing negative or zero value
* is not recommended * is not recommended
* @param modifiers The modifier keys down during event (e.g. shift, ctrl, * @param modifiers a modifier mask describing the modifier keys and mouse
* alt, meta) * buttons (for example, shift, ctrl, alt, and meta) that
* are down during the event.
* Only extended modifiers are allowed to be used as a
* value for this parameter (see the {@link InputEvent#getModifiersEx}
* class for the description of extended modifiers).
* Passing negative parameter * Passing negative parameter
* is not recommended. * is not recommended.
* Zero value means that no modifiers were passed. * Zero value means that no modifiers were passed
* Use either an extended _DOWN_MASK or old _MASK modifiers,
* however do not mix models in the one event.
* The extended modifiers are preferred for using
* @param x The horizontal x coordinate for the mouse location. * @param x The horizontal x coordinate for the mouse location.
* It is allowed to pass negative values * It is allowed to pass negative values
* @param y The vertical y coordinate for the mouse location. * @param y The vertical y coordinate for the mouse location.
@ -657,14 +659,15 @@ public class MouseEvent extends InputEvent {
* @param when A long integer that gives the time the event occurred. * @param when A long integer that gives the time the event occurred.
* Passing negative or zero value * Passing negative or zero value
* is not recommended * is not recommended
* @param modifiers The modifier keys down during event (e.g. shift, ctrl, * @param modifiers a modifier mask describing the modifier keys and mouse
* alt, meta) * buttons (for example, shift, ctrl, alt, and meta) that
* are down during the event.
* Only extended modifiers are allowed to be used as a
* value for this parameter (see the {@link InputEvent#getModifiersEx}
* class for the description of extended modifiers).
* Passing negative parameter * Passing negative parameter
* is not recommended. * is not recommended.
* Zero value means that no modifiers were passed. * Zero value means that no modifiers were passed
* Use either an extended _DOWN_MASK or old _MASK modifiers,
* however do not mix models in the one event.
* The extended modifiers are preferred for using
* @param x The horizontal x coordinate for the mouse location. * @param x The horizontal x coordinate for the mouse location.
* It is allowed to pass negative values * It is allowed to pass negative values
* @param y The vertical y coordinate for the mouse location. * @param y The vertical y coordinate for the mouse location.

View File

@ -180,8 +180,7 @@ public final class PrinterStateReasons
if (severity == null) { if (severity == null) {
throw new NullPointerException("severity is null"); throw new NullPointerException("severity is null");
} }
return super.put((PrinterStateReason) reason, return super.put(reason, severity);
(Severity) severity);
} }
/** /**

View File

@ -141,7 +141,7 @@ public class ReferenceUriSchemesSupported
* Returns the string table for class ReferenceUriSchemesSupported. * Returns the string table for class ReferenceUriSchemesSupported.
*/ */
protected String[] getStringTable() { protected String[] getStringTable() {
return (String[])myStringTable.clone(); return myStringTable.clone();
} }
/** /**

View File

@ -32,7 +32,7 @@ import java.beans.*;
*/ */
public class ComponentBeanInfo extends SimpleBeanInfo { public class ComponentBeanInfo extends SimpleBeanInfo {
private static final Class beanClass = java.awt.Component.class; private static final Class<java.awt.Component> beanClass = java.awt.Component.class;
public PropertyDescriptor[] getPropertyDescriptors() { public PropertyDescriptor[] getPropertyDescriptors() {
try { try {