This commit is contained in:
Phil Race 2014-07-01 10:20:56 -07:00
commit 82cd8b6ece
212 changed files with 4143 additions and 1099 deletions

View File

@ -62,7 +62,7 @@ GENDATA += $(GENDATA_UNINAME)
##########################################################################################
GENDATA_CURDATA := $(JDK_OUTPUTDIR)/lib/currency.data
GENDATA_CURDATA := $(JDK_OUTPUTDIR)/classes/java/util/currency.data
$(GENDATA_CURDATA): $(JDK_TOPDIR)/make/data/currency/CurrencyData.properties $(BUILD_TOOLS)
$(MKDIR) -p $(@D)

View File

@ -27,7 +27,7 @@ DISABLE_WARNINGS := -Xlint:all,-deprecation,-unchecked,-rawtypes,-cast,-serial,-
# To build with all warnings enabled, do the following:
# make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000"
JAVAC_WARNINGS := -Xlint:-unchecked,-deprecation,-overrides,auxiliaryclass,cast,classfile,dep-ann,divzero,empty,fallthrough,finally,overloads,serial,static,try,varargs -Werror
JAVAC_WARNINGS := -Xlint:all,-deprecation,-rawtypes,-unchecked -Werror
# Any java code executed during a JDK build to build other parts of the JDK must be
# executed by the bootstrap JDK (probably with -Xbootclasspath/p: ) and for this

View File

@ -56,7 +56,6 @@ PROFILE_1_JRE_LIB_FILES := \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/Xusage.txt \
calendars.properties \
classlist \
currency.data \
ext/localedata.jar \
ext/meta-index \
ext/sunec.jar \

View File

@ -110,6 +110,7 @@ int main(int argc, const char* argv[]) {
emit_inet("StandardSocketOptions.IP_MULTICAST_LOOP", IPPROTO_IP, IP_MULTICAST_LOOP);
#ifdef AF_INET6
emit_inet6("StandardSocketOptions.IP_TOS", IPPROTO_IPV6, IPV6_TCLASS);
emit_inet6("StandardSocketOptions.IP_MULTICAST_IF", IPPROTO_IPV6, IPV6_MULTICAST_IF);
emit_inet6("StandardSocketOptions.IP_MULTICAST_TTL", IPPROTO_IPV6, IPV6_MULTICAST_HOPS);
emit_inet6("StandardSocketOptions.IP_MULTICAST_LOOP", IPPROTO_IPV6, IPV6_MULTICAST_LOOP);

View File

@ -415,7 +415,7 @@ public final class CStrike extends FontStrike {
generalCache = new HashMap<Integer, Long>();
}
generalCache.put(new Integer(index), new Long(value));
generalCache.put(new Integer(index), Long.valueOf(value));
}
public synchronized void dispose() {

View File

@ -616,7 +616,7 @@ public class GIFImageReader extends ImageReader {
return index;
}
Long l1 = new Long(stream.getStreamPosition());
Long l1 = stream.getStreamPosition();
imageStartPosition.add(l1);
++index;
}

View File

@ -367,10 +367,10 @@ public class JPEGImageReader extends ImageReader {
// Now we are at the first image if there are any, so add it
// to the list
if (hasNextImage()) {
imagePositions.add(new Long(iis.getStreamPosition()));
imagePositions.add(iis.getStreamPosition());
}
} else { // Not tables only, so add original pos to the list
imagePositions.add(new Long(savePos));
imagePositions.add(savePos);
// And set current image since we've read it now
currentImage = 0;
}
@ -498,7 +498,7 @@ public class JPEGImageReader extends ImageReader {
if (!hasNextImage()) {
throw new IndexOutOfBoundsException();
}
pos = new Long(iis.getStreamPosition());
pos = iis.getStreamPosition();
imagePositions.add(pos);
if (seekForwardOnly) {
iis.flushBefore(pos.longValue());

View File

@ -1102,8 +1102,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
"PasswordField.selectionBackground", SelectionBackgroundColor,
"PasswordField.selectionForeground", SelectionTextColor,
"PasswordField.caretForeground",WindowTextColor,
"PasswordField.echoChar", new XPValue(new Character((char)0x25CF),
new Character('*')),
"PasswordField.echoChar", new XPValue((char)0x25CF, '*'),
// *** ProgressBar
"ProgressBar.font", ControlFont,

View File

@ -84,7 +84,7 @@ public class SnmpCounter64 extends SnmpValue {
* @return The <CODE>Long</CODE> representation of the value.
*/
public Long toLong() {
return new Long(value) ;
return value;
}
/**

View File

@ -130,7 +130,7 @@ public class SnmpInt extends SnmpValue {
* @return The <CODE>Long</CODE> representation of the value.
*/
public Long toLong() {
return new Long(value) ;
return value;
}
/**

View File

@ -140,7 +140,7 @@ public class SnmpString extends SnmpValue {
public Byte[] toByte() {
Byte[] result = new Byte[value.length] ;
for (int i = 0 ; i < value.length ; i++) {
result[i] = new Byte(value[i]) ;
result[i] = value[i];
}
return result ;
}

View File

@ -136,7 +136,7 @@ public abstract class SnmpMibGroup extends SnmpMibOid
*/
public boolean isNestedArc(long arc) {
if (subgroups == null) return false;
Object obj = subgroups.get(new Long(arc));
Object obj = subgroups.get(arc);
// if the arc is registered in the hashtable,
// it leads to a subgroup.
return (obj != null);
@ -260,7 +260,7 @@ public abstract class SnmpMibGroup extends SnmpMibOid
*
*/
void registerNestedArc(long arc) {
Long obj = new Long(arc);
Long obj = arc;
if (subgroups == null) subgroups = new Hashtable<>();
// registers the arc in the hashtable.
subgroups.put(obj,obj);

View File

@ -858,7 +858,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpOutTraps() {
return new Long(snmpOutTraps);
return (long)snmpOutTraps;
}
/**
@ -868,7 +868,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpOutGetResponses() {
return new Long(snmpOutGetResponses);
return (long)snmpOutGetResponses;
}
/**
@ -878,7 +878,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpOutGenErrs() {
return new Long(snmpOutGenErrs);
return (long)snmpOutGenErrs;
}
/**
@ -888,7 +888,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpOutBadValues() {
return new Long(snmpOutBadValues);
return (long)snmpOutBadValues;
}
/**
@ -898,7 +898,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpOutNoSuchNames() {
return new Long(snmpOutNoSuchNames);
return (long)snmpOutNoSuchNames;
}
/**
@ -908,7 +908,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpOutTooBigs() {
return new Long(snmpOutTooBigs);
return (long)snmpOutTooBigs;
}
/**
@ -918,7 +918,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpInASNParseErrs() {
return new Long(snmpInASNParseErrs);
return (long)snmpInASNParseErrs;
}
/**
@ -928,7 +928,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpInBadCommunityUses() {
return new Long(snmpInBadCommunityUses);
return (long)snmpInBadCommunityUses;
}
/**
@ -939,7 +939,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpInBadCommunityNames() {
return new Long(snmpInBadCommunityNames);
return (long)snmpInBadCommunityNames;
}
/**
@ -949,7 +949,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpInBadVersions() {
return new Long(snmpInBadVersions);
return (long)snmpInBadVersions;
}
/**
@ -959,7 +959,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpOutPkts() {
return new Long(snmpOutPkts);
return (long)snmpOutPkts;
}
/**
@ -969,7 +969,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpInPkts() {
return new Long(snmpInPkts);
return (long)snmpInPkts;
}
/**
@ -979,7 +979,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpInGetRequests() {
return new Long(snmpInGetRequests);
return (long)snmpInGetRequests;
}
/**
@ -989,7 +989,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpInGetNexts() {
return new Long(snmpInGetNexts);
return (long)snmpInGetNexts;
}
/**
@ -999,7 +999,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpInSetRequests() {
return new Long(snmpInSetRequests);
return (long)snmpInSetRequests;
}
/**
@ -1009,7 +1009,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpInTotalSetVars() {
return new Long(snmpInTotalSetVars);
return (long)snmpInTotalSetVars;
}
/**
@ -1019,7 +1019,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpInTotalReqVars() {
return new Long(snmpInTotalReqVars);
return (long)snmpInTotalReqVars;
}
/**
@ -1032,7 +1032,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpSilentDrops() {
return new Long(snmpSilentDrops);
return (long)snmpSilentDrops;
}
/**
@ -1045,7 +1045,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpProxyDrops() {
return new Long(0);
return 0L;
}

View File

@ -421,7 +421,7 @@ public final class LdapPoolManager {
try {
return Long.getLong(propName, defVal);
} catch (SecurityException e) {
return new Long(defVal);
return defVal;
}
}
});

View File

@ -221,7 +221,7 @@ final class NamingEventNotifier implements Runnable {
return;
NamingEvent e = new NamingEvent(eventSrc, NamingEvent.OBJECT_ADDED,
newBd, null, new Long(changeID));
newBd, null, changeID);
support.queueEvent(e, namingListeners);
}
@ -233,7 +233,7 @@ final class NamingEventNotifier implements Runnable {
return;
NamingEvent e = new NamingEvent(eventSrc, NamingEvent.OBJECT_REMOVED,
null, oldBd, new Long(changeID));
null, oldBd, changeID);
support.queueEvent(e, namingListeners);
}
@ -248,7 +248,7 @@ final class NamingEventNotifier implements Runnable {
Binding oldBd = new Binding(newBd.getName(), null, newBd.isRelative());
NamingEvent e = new NamingEvent(
eventSrc, NamingEvent.OBJECT_CHANGED, newBd, oldBd, new Long(changeID));
eventSrc, NamingEvent.OBJECT_CHANGED, newBd, oldBd, changeID);
support.queueEvent(e, namingListeners);
}
@ -273,7 +273,7 @@ final class NamingEventNotifier implements Runnable {
}
NamingEvent e = new NamingEvent(
eventSrc, NamingEvent.OBJECT_RENAMED, newBd, oldBd, new Long(changeID));
eventSrc, NamingEvent.OBJECT_RENAMED, newBd, oldBd, changeID);
support.queueEvent(e, namingListeners);
}

View File

@ -379,7 +379,7 @@ public class SearchFilter implements AttrFilter {
// used for substring comparisons (where proto has "*" wildcards
private boolean substringMatch(String proto, String value) {
// simple case 1: "*" means attribute presence is being tested
if(proto.equals(new Character(WILDCARD_TOKEN).toString())) {
if(proto.equals(Character.toString(WILDCARD_TOKEN))) {
if(debug) {System.out.println("simple presence assertion");}
return true;
}

View File

@ -110,7 +110,7 @@ public class SolarisNumericGroupPrincipal implements
*
*/
public SolarisNumericGroupPrincipal(long name, boolean primaryGroup) {
this.name = (new Long(name)).toString();
this.name = Long.toString(name);
this.primaryGroup = primaryGroup;
}
@ -137,7 +137,7 @@ public class SolarisNumericGroupPrincipal implements
* <code>SolarisNumericGroupPrincipal</code> as a long.
*/
public long longValue() {
return ((new Long(name)).longValue());
return Long.parseLong(name);
}
/**

View File

@ -96,7 +96,7 @@ public class SolarisNumericUserPrincipal implements
* represented as a long.
*/
public SolarisNumericUserPrincipal(long name) {
this.name = (new Long(name)).toString();
this.name = Long.toString(name);
}
/**
@ -122,7 +122,7 @@ public class SolarisNumericUserPrincipal implements
* <code>SolarisNumericUserPrincipal</code> as a long.
*/
public long longValue() {
return ((new Long(name)).longValue());
return Long.parseLong(name);
}
/**

View File

@ -102,7 +102,7 @@ public class UnixNumericGroupPrincipal implements
*
*/
public UnixNumericGroupPrincipal(long name, boolean primaryGroup) {
this.name = (new Long(name)).toString();
this.name = Long.toString(name);
this.primaryGroup = primaryGroup;
}
@ -129,7 +129,7 @@ public class UnixNumericGroupPrincipal implements
* <code>UnixNumericGroupPrincipal</code> as a long.
*/
public long longValue() {
return ((new Long(name)).longValue());
return Long.parseLong(name);
}
/**

View File

@ -87,7 +87,7 @@ public class UnixNumericUserPrincipal implements
* represented as a long.
*/
public UnixNumericUserPrincipal(long name) {
this.name = (new Long(name)).toString();
this.name = Long.toString(name);
}
/**
@ -113,7 +113,7 @@ public class UnixNumericUserPrincipal implements
* <code>UnixNumericUserPrincipal</code> as a long.
*/
public long longValue() {
return ((new Long(name)).longValue());
return Long.parseLong(name);
}
/**

View File

@ -1460,7 +1460,7 @@ abstract class DigestMD5Base extends AbstractSaslImpl {
if (logger.isLoggable(Level.INFO)) {
logger.log(Level.INFO,
"DIGEST39:Incorrect padding: {0}",
new Byte(msgWithPadding[msgWithPadding.length - 1]));
msgWithPadding[msgWithPadding.length - 1]);
}
return EMPTY_BYTE_ARRAY;
}

View File

@ -241,7 +241,7 @@ final class GssKrb5Client extends GssKrb5Base implements SaslClient {
"KRB5CLNT05:Challenge [unwrapped]:", gssOutToken);
}
logger.log(Level.FINE, "KRB5CLNT06:Server protections: {0}",
new Byte(gssOutToken[0]));
gssOutToken[0]);
}
// Client selects preferred protection
@ -293,7 +293,7 @@ final class GssKrb5Client extends GssKrb5Base implements SaslClient {
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE,
"KRB5CLNT08:Selected protection: {0}; privacy: {1}; integrity: {2}",
new Object[]{new Byte(selectedQop),
new Object[]{selectedQop,
Boolean.valueOf(privacy),
Boolean.valueOf(integrity)});
}

View File

@ -221,7 +221,7 @@ final class GssKrb5Server extends GssKrb5Base implements SaslServer {
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE,
"KRB5SRV06:Supported protections: {0}; recv max buf size: {1}",
new Object[]{new Byte(allQop),
new Object[]{allQop,
new Integer(recvMaxBufSize)});
}
@ -288,7 +288,7 @@ final class GssKrb5Server extends GssKrb5Base implements SaslServer {
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE,
"KRB5SRV10:Selected protection: {0}; privacy: {1}; integrity: {2}",
new Object[]{new Byte(selectedQop),
new Object[]{selectedQop,
Boolean.valueOf(privacy),
Boolean.valueOf(integrity)});
logger.log(Level.FINE,

View File

@ -77,7 +77,7 @@ public abstract class AbstractSaslImpl {
if (logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, myClassName, "constructor",
"SASLIMPL02:Preferred qop mask: {0}", new Byte(allQop));
"SASLIMPL02:Preferred qop mask: {0}", allQop);
if (qop.length > 0) {
StringBuilder str = new StringBuilder();

View File

@ -142,8 +142,8 @@ class BreakpointSpec extends EventRequestSpec {
refSpec.toString()));
} else if (e instanceof LineNotFoundException) {
return (MessageOutput.format("No code at line",
new Object [] {new Long (lineNumber()),
refSpec.toString()}));
new Object [] {Long.valueOf(lineNumber()),
refSpec.toString()}));
} else if (e instanceof InvalidTypeException) {
return (MessageOutput.format("Breakpoints can be located only in classes.",
refSpec.toString()));

View File

@ -935,7 +935,7 @@ class Commands {
try {
methodInfo = loc.sourceName() +
MessageOutput.format("line number",
new Object [] {new Long(lineNumber)});
new Object [] {Long.valueOf(lineNumber)});
} catch (AbsentInformationException e) {
methodInfo = MessageOutput.format("unknown");
}
@ -946,7 +946,7 @@ class Commands {
meth.declaringType().name(),
meth.name(),
methodInfo,
new Long(pc)});
Long.valueOf(pc)});
} else {
MessageOutput.println("stack frame dump",
new Object [] {new Integer(frameNumber + 1),
@ -1015,7 +1015,7 @@ class Commands {
new Object [] {loc.declaringType().name(),
loc.method().name(),
new Integer (loc.lineNumber()),
new Long (loc.codeIndex())});
Long.valueOf(loc.codeIndex())});
}
void listBreakpoints() {

View File

@ -102,7 +102,7 @@ public abstract class JavaLazyReadObject extends JavaHeapObject {
if ((id & ~Snapshot.SMALL_ID_MASK) == 0) {
return new Integer((int)id);
} else {
return new Long(id);
return id;
}
}

View File

@ -583,7 +583,7 @@ public class Snapshot {
if (identifierSize == 4) {
return new Integer((int)id);
} else {
return new Long(id);
return id;
}
}

View File

@ -215,7 +215,7 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
long id = readID();
byte[] chars = new byte[(int)length - identifierSize];
in.readFully(chars);
names.put(new Long(id), new String(chars));
names.put(id, new String(chars));
break;
}
case HPROF_LOAD_CLASS: {
@ -223,7 +223,7 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
long classID = readID();
int stackTraceSerialNo = in.readInt();
long classNameID = readID();
Long classIdI = new Long(classID);
Long classIdI = classID;
String nm = getNameFromID(classNameID).replace('/', '.');
classNameFromObjectID.put(classIdI, nm);
if (classNameFromSerialNo != null) {
@ -303,7 +303,7 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
warn("Weird stack frame line number: " + lineNumber);
lineNumber = StackFrame.LINE_NUMBER_UNKNOWN;
}
stackFrames.put(new Long(id),
stackFrames.put(id,
new StackFrame(methodName, methodSig,
className, sourceFile,
lineNumber));
@ -319,7 +319,7 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
StackFrame[] frames = new StackFrame[in.readInt()];
for (int i = 0; i < frames.length; i++) {
long fid = readID();
frames[i] = stackFrames.get(new Long(fid));
frames[i] = stackFrames.get(fid);
if (frames[i] == null) {
throw new IOException("Stack frame " + toHex(fid) + " not found");
}
@ -619,7 +619,7 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
}
private String getNameFromID(long id) throws IOException {
return getNameFromID(new Long(id));
return getNameFromID(Long.valueOf(id));
}
private String getNameFromID(Long id) throws IOException {
@ -703,7 +703,7 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
String signature = "" + ((char) type);
fields[i] = new JavaField(fieldName, signature);
}
String name = classNameFromObjectID.get(new Long(id));
String name = classNameFromObjectID.get(id);
if (name == null) {
warn("Class name not found for " + toHex(id));
name = "unknown-name@" + toHex(id);

View File

@ -63,9 +63,9 @@ public class RefsByTypeQuery extends QueryHandler {
}
Long count = referrersStat.get(cl);
if (count == null) {
count = new Long(1);
count = 1L;
} else {
count = new Long(count.longValue() + 1);
count = count + 1L;
}
referrersStat.put(cl, count);
}
@ -75,9 +75,9 @@ public class RefsByTypeQuery extends QueryHandler {
JavaClass cl = obj.getClazz();
Long count = refereesStat.get(cl);
if (count == null) {
count = new Long(1);
count = 1L;
} else {
count = new Long(count.longValue() + 1);
count = count + 1L;
}
refereesStat.put(cl, count);
}

View File

@ -781,7 +781,7 @@ class VirtualMachineImpl extends MirrorImpl
type.setSignature(signature);
}
typesByID.put(new Long(id), type);
typesByID.put(id, type);
typesBySignature.add(type);
if ((vm.traceFlags & VirtualMachine.TRACE_REFTYPES) != 0) {
@ -809,7 +809,7 @@ class VirtualMachineImpl extends MirrorImpl
if (comp == 0) {
matches++;
iter.remove();
typesByID.remove(new Long(type.ref()));
typesByID.remove(type.ref());
if ((vm.traceFlags & VirtualMachine.TRACE_REFTYPES) != 0) {
vm.printTrace("Uncaching ReferenceType, sig=" + signature +
", id=" + type.ref());
@ -895,7 +895,7 @@ class VirtualMachineImpl extends MirrorImpl
ReferenceTypeImpl retType = null;
synchronized (this) {
if (typesByID != null) {
retType = (ReferenceTypeImpl)typesByID.get(new Long(id));
retType = (ReferenceTypeImpl)typesByID.get(id);
}
if (retType == null) {
retType = addReferenceType(id, tag, signature);
@ -1247,7 +1247,7 @@ class VirtualMachineImpl extends MirrorImpl
return null;
}
ObjectReferenceImpl object = null;
Long key = new Long(id);
Long key = id;
/*
* Attempt to retrieve an existing object object reference
@ -1313,7 +1313,7 @@ class VirtualMachineImpl extends MirrorImpl
// Handle any queue elements that are not strongly reachable
processQueue();
SoftObjectReference ref = objectsByID.remove(new Long(object.ref()));
SoftObjectReference ref = objectsByID.remove(object.ref());
if (ref != null) {
batchForDispose(ref);
} else {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, 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
@ -388,6 +388,8 @@ public abstract class AWTEvent extends EventObject {
/**
* Returns the event type.
*
* @return the event's type id
*/
public int getID() {
return id;
@ -446,6 +448,9 @@ public abstract class AWTEvent extends EventObject {
/**
* Returns whether this event has been consumed.
*
* @return {@code true} if this event has been consumed;
* otherwise {@code false}
*/
protected boolean isConsumed() {
return consumed;

View File

@ -110,7 +110,15 @@ public class AWTEventMulticaster implements
TextListener, InputMethodListener, HierarchyListener,
HierarchyBoundsListener, MouseWheelListener {
protected final EventListener a, b;
/**
* A variable in the event chain (listener-a)
*/
protected final EventListener a;
/**
* A variable in the event chain (listener-b)
*/
protected final EventListener b;
/**
* Creates an event multicaster instance which chains listener-a
@ -537,6 +545,7 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param a component-listener-a
* @param b component-listener-b
* @return the resulting listener
*/
public static ComponentListener add(ComponentListener a, ComponentListener b) {
return (ComponentListener)addInternal(a, b);
@ -547,6 +556,7 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param a container-listener-a
* @param b container-listener-b
* @return the resulting listener
*/
public static ContainerListener add(ContainerListener a, ContainerListener b) {
return (ContainerListener)addInternal(a, b);
@ -557,6 +567,7 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param a focus-listener-a
* @param b focus-listener-b
* @return the resulting listener
*/
public static FocusListener add(FocusListener a, FocusListener b) {
return (FocusListener)addInternal(a, b);
@ -567,6 +578,7 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param a key-listener-a
* @param b key-listener-b
* @return the resulting listener
*/
public static KeyListener add(KeyListener a, KeyListener b) {
return (KeyListener)addInternal(a, b);
@ -577,6 +589,7 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param a mouse-listener-a
* @param b mouse-listener-b
* @return the resulting listener
*/
public static MouseListener add(MouseListener a, MouseListener b) {
return (MouseListener)addInternal(a, b);
@ -587,6 +600,7 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param a mouse-motion-listener-a
* @param b mouse-motion-listener-b
* @return the resulting listener
*/
public static MouseMotionListener add(MouseMotionListener a, MouseMotionListener b) {
return (MouseMotionListener)addInternal(a, b);
@ -597,6 +611,7 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param a window-listener-a
* @param b window-listener-b
* @return the resulting listener
*/
public static WindowListener add(WindowListener a, WindowListener b) {
return (WindowListener)addInternal(a, b);
@ -607,6 +622,7 @@ public class AWTEventMulticaster implements
* and returns the resulting multicast listener.
* @param a window-state-listener-a
* @param b window-state-listener-b
* @return the resulting listener
* @since 1.4
*/
@SuppressWarnings("overloads")
@ -620,6 +636,7 @@ public class AWTEventMulticaster implements
* and returns the resulting multicast listener.
* @param a window-focus-listener-a
* @param b window-focus-listener-b
* @return the resulting listener
* @since 1.4
*/
public static WindowFocusListener add(WindowFocusListener a,
@ -632,6 +649,7 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param a action-listener-a
* @param b action-listener-b
* @return the resulting listener
*/
@SuppressWarnings("overloads")
public static ActionListener add(ActionListener a, ActionListener b) {
@ -643,6 +661,7 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param a item-listener-a
* @param b item-listener-b
* @return the resulting listener
*/
@SuppressWarnings("overloads")
public static ItemListener add(ItemListener a, ItemListener b) {
@ -654,11 +673,21 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param a adjustment-listener-a
* @param b adjustment-listener-b
* @return the resulting listener
*/
@SuppressWarnings("overloads")
public static AdjustmentListener add(AdjustmentListener a, AdjustmentListener b) {
return (AdjustmentListener)addInternal(a, b);
}
/**
* Adds text-listener-a with text-listener-b and
* returns the resulting multicast listener.
*
* @param a text-listener-a
* @param b text-listener-b
* @return the resulting listener
*/
@SuppressWarnings("overloads")
public static TextListener add(TextListener a, TextListener b) {
return (TextListener)addInternal(a, b);
@ -669,6 +698,7 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param a input-method-listener-a
* @param b input-method-listener-b
* @return the resulting listener
*/
public static InputMethodListener add(InputMethodListener a, InputMethodListener b) {
return (InputMethodListener)addInternal(a, b);
@ -679,6 +709,7 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param a hierarchy-listener-a
* @param b hierarchy-listener-b
* @return the resulting listener
* @since 1.3
*/
@SuppressWarnings("overloads")
@ -691,6 +722,7 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param a hierarchy-bounds-listener-a
* @param b hierarchy-bounds-listener-b
* @return the resulting listener
* @since 1.3
*/
public static HierarchyBoundsListener add(HierarchyBoundsListener a, HierarchyBoundsListener b) {
@ -702,6 +734,7 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param a mouse-wheel-listener-a
* @param b mouse-wheel-listener-b
* @return the resulting listener
* @since 1.4
*/
@SuppressWarnings("overloads")
@ -715,6 +748,7 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param l component-listener-l
* @param oldl the component-listener being removed
* @return the resulting listener
*/
public static ComponentListener remove(ComponentListener l, ComponentListener oldl) {
return (ComponentListener) removeInternal(l, oldl);
@ -725,6 +759,7 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param l container-listener-l
* @param oldl the container-listener being removed
* @return the resulting listener
*/
public static ContainerListener remove(ContainerListener l, ContainerListener oldl) {
return (ContainerListener) removeInternal(l, oldl);
@ -735,6 +770,7 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param l focus-listener-l
* @param oldl the focus-listener being removed
* @return the resulting listener
*/
public static FocusListener remove(FocusListener l, FocusListener oldl) {
return (FocusListener) removeInternal(l, oldl);
@ -745,6 +781,7 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param l key-listener-l
* @param oldl the key-listener being removed
* @return the resulting listener
*/
public static KeyListener remove(KeyListener l, KeyListener oldl) {
return (KeyListener) removeInternal(l, oldl);
@ -755,6 +792,7 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param l mouse-listener-l
* @param oldl the mouse-listener being removed
* @return the resulting listener
*/
public static MouseListener remove(MouseListener l, MouseListener oldl) {
return (MouseListener) removeInternal(l, oldl);
@ -765,6 +803,7 @@ public class AWTEventMulticaster implements
* and returns the resulting multicast listener.
* @param l mouse-motion-listener-l
* @param oldl the mouse-motion-listener being removed
* @return the resulting listener
*/
public static MouseMotionListener remove(MouseMotionListener l, MouseMotionListener oldl) {
return (MouseMotionListener) removeInternal(l, oldl);
@ -775,6 +814,7 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param l window-listener-l
* @param oldl the window-listener being removed
* @return the resulting listener
*/
public static WindowListener remove(WindowListener l, WindowListener oldl) {
return (WindowListener) removeInternal(l, oldl);
@ -785,6 +825,7 @@ public class AWTEventMulticaster implements
* and returns the resulting multicast listener.
* @param l window-state-listener-l
* @param oldl the window-state-listener being removed
* @return the resulting listener
* @since 1.4
*/
@SuppressWarnings("overloads")
@ -798,6 +839,7 @@ public class AWTEventMulticaster implements
* and returns the resulting multicast listener.
* @param l window-focus-listener-l
* @param oldl the window-focus-listener being removed
* @return the resulting listener
* @since 1.4
*/
public static WindowFocusListener remove(WindowFocusListener l,
@ -810,6 +852,7 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param l action-listener-l
* @param oldl the action-listener being removed
* @return the resulting listener
*/
@SuppressWarnings("overloads")
public static ActionListener remove(ActionListener l, ActionListener oldl) {
@ -821,6 +864,7 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param l item-listener-l
* @param oldl the item-listener being removed
* @return the resulting listener
*/
@SuppressWarnings("overloads")
public static ItemListener remove(ItemListener l, ItemListener oldl) {
@ -832,11 +876,21 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param l adjustment-listener-l
* @param oldl the adjustment-listener being removed
* @return the resulting listener
*/
@SuppressWarnings("overloads")
public static AdjustmentListener remove(AdjustmentListener l, AdjustmentListener oldl) {
return (AdjustmentListener) removeInternal(l, oldl);
}
/**
* Removes the old text-listener from text-listener-l and
* returns the resulting multicast listener.
*
* @param l text-listener-l
* @param oldl the text-listener being removed
* @return the resulting listener
*/
@SuppressWarnings("overloads")
public static TextListener remove(TextListener l, TextListener oldl) {
return (TextListener) removeInternal(l, oldl);
@ -847,6 +901,7 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param l input-method-listener-l
* @param oldl the input-method-listener being removed
* @return the resulting listener
*/
public static InputMethodListener remove(InputMethodListener l, InputMethodListener oldl) {
return (InputMethodListener) removeInternal(l, oldl);
@ -857,6 +912,7 @@ public class AWTEventMulticaster implements
* returns the resulting multicast listener.
* @param l hierarchy-listener-l
* @param oldl the hierarchy-listener being removed
* @return the resulting listener
* @since 1.3
*/
@SuppressWarnings("overloads")
@ -870,6 +926,7 @@ public class AWTEventMulticaster implements
* listener.
* @param l hierarchy-bounds-listener-l
* @param oldl the hierarchy-bounds-listener being removed
* @return the resulting listener
* @since 1.3
*/
public static HierarchyBoundsListener remove(HierarchyBoundsListener l, HierarchyBoundsListener oldl) {
@ -881,6 +938,7 @@ public class AWTEventMulticaster implements
* and returns the resulting multicast listener.
* @param l mouse-wheel-listener-l
* @param oldl the mouse-wheel-listener being removed
* @return the resulting listener
* @since 1.4
*/
@SuppressWarnings("overloads")
@ -898,6 +956,7 @@ public class AWTEventMulticaster implements
* a new AWTEventMulticaster instance which chains a with b.
* @param a event listener-a
* @param b event listener-b
* @return the resulting listener
*/
protected static EventListener addInternal(EventListener a, EventListener b) {
if (a == null) return b;
@ -915,6 +974,7 @@ public class AWTEventMulticaster implements
* Else, returns listener l.
* @param l the listener being removed from
* @param oldl the listener being removed
* @return the resulting listener
*/
protected static EventListener removeInternal(EventListener l, EventListener oldl) {
if (l == oldl || l == null) {
@ -927,9 +987,14 @@ public class AWTEventMulticaster implements
}
/* Serialization support.
*/
/**
* Serialization support. Saves all Serializable listeners
* to a serialization stream.
*
* @param s the stream to save to
* @param k a prefix stream to put before each serializable listener
* @throws IOException if serialization fails
*/
protected void saveInternal(ObjectOutputStream s, String k) throws IOException {
if (a instanceof AWTEventMulticaster) {
((AWTEventMulticaster)a).saveInternal(s, k);
@ -948,6 +1013,14 @@ public class AWTEventMulticaster implements
}
}
/**
* Saves a Serializable listener chain to a serialization stream.
*
* @param s the stream to save to
* @param k a prefix stream to put before each serializable listener
* @param l the listener chain to save
* @throws IOException if serialization fails
*/
protected static void save(ObjectOutputStream s, String k, EventListener l) throws IOException {
if (l == null) {
return;

View File

@ -802,6 +802,7 @@ public class AWTKeyStroke implements Serializable {
* <code>AWTKeyStroke</code>) which is equal to this instance.
*
* @return a cached instance which is equal to this instance
* @throws java.io.ObjectStreamException if a serialization problem occurs
*/
protected Object readResolve() throws java.io.ObjectStreamException {
synchronized (AWTKeyStroke.class) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, 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
@ -621,7 +621,9 @@ public final class AlphaComposite implements Composite {
/**
* Creates an <code>AlphaComposite</code> object with the specified rule.
*
* @param rule the compositing rule
* @return the {@code AlphaComposite} object created
* @throws IllegalArgumentException if <code>rule</code> is not one of
* the following: {@link #CLEAR}, {@link #SRC}, {@link #DST},
* {@link #SRC_OVER}, {@link #DST_OVER}, {@link #SRC_IN},
@ -664,10 +666,12 @@ public final class AlphaComposite implements Composite {
* the constant alpha to multiply with the alpha of the source.
* The source is multiplied with the specified alpha before being composited
* with the destination.
*
* @param rule the compositing rule
* @param alpha the constant alpha to be multiplied with the alpha of
* the source. <code>alpha</code> must be a floating point number in the
* inclusive range [0.0,&nbsp;1.0].
* @return the {@code AlphaComposite} object created
* @throws IllegalArgumentException if
* <code>alpha</code> is less than 0.0 or greater than 1.0, or if
* <code>rule</code> is not one of

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2014, 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
@ -367,6 +367,8 @@ public class BorderLayout implements LayoutManager2,
/**
* Returns the horizontal gap between components.
*
* @return the horizontal gap between components
* @since 1.1
*/
public int getHgap() {
@ -375,6 +377,7 @@ public class BorderLayout implements LayoutManager2,
/**
* Sets the horizontal gap between components.
*
* @param hgap the horizontal gap between components
* @since 1.1
*/
@ -384,6 +387,8 @@ public class BorderLayout implements LayoutManager2,
/**
* Returns the vertical gap between components.
*
* @return the vertical gap between components
* @since 1.1
*/
public int getVgap() {
@ -392,6 +397,7 @@ public class BorderLayout implements LayoutManager2,
/**
* Sets the vertical gap between components.
*
* @param vgap the vertical gap between components
* @since 1.1
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2014, 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
@ -238,6 +238,8 @@ public class Button extends Component implements Accessible {
* Returns the command name of the action event fired by this button.
* If the command name is <code>null</code> (default) then this method
* returns the label of the button.
*
* @return the action command name (or label) for this button
*/
public String getActionCommand() {
return (actionCommand == null? label : actionCommand);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2014, 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
@ -713,6 +713,9 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
*/
private static final long serialVersionUID = 7881579233144754107L;
/**
* Constructor for {@code AccessibleAWTCheckbox}
*/
public AccessibleAWTCheckbox() {
super();
Checkbox.this.addItemListener(this);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2014, 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
@ -91,6 +91,10 @@ public class CheckboxGroup implements java.io.Serializable {
}
/**
* Returns the current choice from this check box group
* or {@code null} if none of checkboxes are selected.
*
* @return the selected checkbox
* @deprecated As of JDK version 1.1,
* replaced by <code>getSelectedCheckbox()</code>.
*/
@ -120,6 +124,11 @@ public class CheckboxGroup implements java.io.Serializable {
}
/**
* Sets the currently selected check box in this group
* to be the specified check box and unsets all others.
*
* @param box the {@code Checkbox} to set as the
* current selection.
* @deprecated As of JDK version 1.1,
* replaced by <code>setSelectedCheckbox(Checkbox)</code>.
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2014, 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
@ -156,6 +156,7 @@ public class Choice extends Component implements ItemSelectable, Accessible {
/**
* Returns the number of items in this <code>Choice</code> menu.
*
* @return the number of items in this <code>Choice</code> menu
* @see #getItem
* @since 1.1
@ -165,6 +166,9 @@ public class Choice extends Component implements ItemSelectable, Accessible {
}
/**
* Returns the number of items in this {@code Choice} menu.
*
* @return the number of items in this {@code Choice} menu
* @deprecated As of JDK version 1.1,
* replaced by <code>getItemCount()</code>.
*/
@ -176,8 +180,10 @@ public class Choice extends Component implements ItemSelectable, Accessible {
/**
* Gets the string at the specified index in this
* <code>Choice</code> menu.
* @param index the index at which to begin
* @see #getItemCount
*
* @param index the index at which to begin
* @return the item at the specified index
* @see #getItemCount
*/
public String getItem(int index) {
return getItemImpl(index);
@ -759,6 +765,9 @@ public class Choice extends Component implements ItemSelectable, Accessible {
*/
private static final long serialVersionUID = 7175603582428509322L;
/**
* Constructor for {@code AccessibleAWTChoice}
*/
public AccessibleAWTChoice() {
super();
}

View File

@ -1075,6 +1075,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @deprecated As of JDK version 1.1,
* programs should not directly manipulate peers;
* replaced by <code>boolean isDisplayable()</code>.
* @return the peer for this component
*/
@Deprecated
public ComponentPeer getPeer() {
@ -1132,6 +1133,8 @@ public abstract class Component implements ImageObserver, MenuContainer,
/**
* Gets the <code>DropTarget</code> associated with this
* <code>Component</code>.
*
* @return the drop target
*/
public synchronized DropTarget getDropTarget() { return dropTarget; }
@ -1498,6 +1501,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
/**
* Enables or disables this component.
*
* @param b {@code true} to enable this component;
* otherwise {@code false}
*
* @deprecated As of JDK version 1.1,
* replaced by <code>setEnabled(boolean)</code>.
*/
@ -1656,6 +1664,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
/**
* Makes this component visible or invisible.
*
* @param b {@code true} to make this component visible;
* otherwise {@code false}
*
* @deprecated As of JDK version 1.1,
* replaced by <code>setVisible(boolean)</code>.
*/
@ -2068,6 +2081,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
/**
* Returns the location of this component's top left corner.
*
* @return the location of this component's top left corner
* @deprecated As of JDK version 1.1,
* replaced by <code>getLocation()</code>.
*/
@ -2102,6 +2118,13 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
/**
* Moves this component to a new location.
*
* @param x the <i>x</i>-coordinate of the new location's
* top-left corner in the parent's coordinate space
* @param y the <i>y</i>-coordinate of the new location's
* top-left corner in the parent's coordinate space
*
* @deprecated As of JDK version 1.1,
* replaced by <code>setLocation(int, int)</code>.
*/
@ -2150,6 +2173,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
/**
* Returns the size of this component in the form of a
* {@code Dimension} object.
*
* @return the {@code Dimension} object that indicates the
* size of this component
* @deprecated As of JDK version 1.1,
* replaced by <code>getSize()</code>.
*/
@ -2177,6 +2205,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
/**
* Resizes this component.
*
* @param width the new width of the component
* @param height the new height of the component
* @deprecated As of JDK version 1.1,
* replaced by <code>setSize(int, int)</code>.
*/
@ -2208,6 +2240,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
/**
* Resizes this component so that it has width {@code d.width}
* and height {@code d.height}.
*
* @param d the new size of this component
* @deprecated As of JDK version 1.1,
* replaced by <code>setSize(Dimension)</code>.
*/
@ -2231,6 +2267,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
/**
* Returns the bounding rectangle of this component.
*
* @return the bounding rectangle for this component
* @deprecated As of JDK version 1.1,
* replaced by <code>getBounds()</code>.
*/
@ -2265,6 +2304,13 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
/**
* Reshapes the bounding rectangle for this component.
*
* @param x the <i>x</i> coordinate of the upper left corner of the rectangle
* @param y the <i>y</i> coordinate of the upper left corner of the rectangle
* @param width the width of the rectangle
* @param height the height of the rectangle
*
* @deprecated As of JDK version 1.1,
* replaced by <code>setBounds(int, int, int, int)</code>.
*/
@ -2631,6 +2677,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
/**
* Returns the component's preferred size.
*
* @return the component's preferred size
* @deprecated As of JDK version 1.1,
* replaced by <code>getPreferredSize()</code>.
*/
@ -2701,6 +2750,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
/**
* Returns the minimum size of this component.
*
* @return the minimum size of this component
* @deprecated As of JDK version 1.1,
* replaced by <code>getMinimumSize()</code>.
*/
@ -2781,6 +2833,8 @@ public abstract class Component implements ImageObserver, MenuContainer,
* components. The value should be a number between 0 and 1
* where 0 represents alignment along the origin, 1 is aligned
* the furthest away from the origin, 0.5 is centered, etc.
*
* @return the horizontal alignment of this component
*/
public float getAlignmentX() {
return CENTER_ALIGNMENT;
@ -2792,6 +2846,8 @@ public abstract class Component implements ImageObserver, MenuContainer,
* components. The value should be a number between 0 and 1
* where 0 represents alignment along the origin, 1 is aligned
* the furthest away from the origin, 0.5 is centered, etc.
*
* @return the vertical alignment of this component
*/
public float getAlignmentY() {
return CENTER_ALIGNMENT;
@ -3157,8 +3213,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
* not have a cursor set, the cursor of its parent is returned.
* If no cursor is set in the entire hierarchy,
* <code>Cursor.DEFAULT_CURSOR</code> is returned.
*
* @return the cursor for this component
* @see #setCursor
* @since 1.1
* @since 1.1
*/
public Cursor getCursor() {
return getCursor_NoClientCode();
@ -3942,6 +4000,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* a lost state.
*/
protected boolean validatedContents; // = false
/**
* Size of the back buffers. (Note: these fields were added in 6.0
* but kept package-private to avoid exposing them in the spec.
@ -3949,7 +4008,15 @@ public abstract class Component implements ImageObserver, MenuContainer,
* protected when they were introduced in 1.4, but now we just have
* to live with that decision.)
*/
/**
* The width of the back buffers
*/
int width;
/**
* The height of the back buffers
*/
int height;
/**
@ -4304,6 +4371,8 @@ public abstract class Component implements ImageObserver, MenuContainer,
/**
* Creates the back buffers
*
* @param numBuffers the number of buffers to create
*/
protected void createBackBuffers(int numBuffers) {
if (numBuffers == 0) {
@ -4593,6 +4662,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
* better performance is desired, or if page-flipping is used as the
* buffer strategy.
*
* @param ignoreRepaint {@code true} if the paint messages from the OS
* should be ignored; otherwise {@code false}
*
* @since 1.4
* @see #getIgnoreRepaint
* @see Canvas#createBufferStrategy
@ -4619,8 +4691,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
* Checks whether this component "contains" the specified point,
* where <code>x</code> and <code>y</code> are defined to be
* relative to the coordinate system of this component.
*
* @param x the <i>x</i> coordinate of the point
* @param y the <i>y</i> coordinate of the point
* @return {@code true} if the point is within the component;
* otherwise {@code false}
* @see #getComponentAt(int, int)
* @since 1.1
*/
@ -4629,6 +4704,12 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
/**
* Checks whether the point is inside of this component.
*
* @param x the <i>x</i> coordinate of the point
* @param y the <i>y</i> coordinate of the point
* @return {@code true} if the point is within the component;
* otherwise {@code false}
* @deprecated As of JDK version 1.1,
* replaced by contains(int, int).
*/
@ -4641,7 +4722,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
* Checks whether this component "contains" the specified point,
* where the point's <i>x</i> and <i>y</i> coordinates are defined
* to be relative to the coordinate system of this component.
*
* @param p the point
* @return {@code true} if the point is within the component;
* otherwise {@code false}
* @throws NullPointerException if {@code p} is {@code null}
* @see #getComponentAt(Point)
* @since 1.1
@ -4676,6 +4760,13 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
/**
* Returns the component occupying the position specified (this component,
* or immediate child component, or null if neither
* of the first two occupies the location).
*
* @param x the <i>x</i> coordinate to search for components at
* @param y the <i>y</i> coordinate to search for components at
* @return the component at the specified location or {@code null}
* @deprecated As of JDK version 1.1,
* replaced by getComponentAt(int, int).
*/
@ -4687,15 +4778,17 @@ public abstract class Component implements ImageObserver, MenuContainer,
/**
* Returns the component or subcomponent that contains the
* specified point.
* @param p the point
* @see java.awt.Component#contains
* @since 1.1
* @param p the point
* @return the component at the specified location or {@code null}
* @see java.awt.Component#contains
* @since 1.1
*/
public Component getComponentAt(Point p) {
return getComponentAt(p.x, p.y);
}
/**
* @param e the event to deliver
* @deprecated As of JDK version 1.1,
* replaced by <code>dispatchEvent(AWTEvent e)</code>.
*/
@ -6746,6 +6839,8 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
/**
* @param evt the event to handle
* @return {@code true} if the event was handled, {@code false} otherwise
* @deprecated As of JDK version 1.1
* replaced by processEvent(AWTEvent).
*/
@ -6789,6 +6884,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
/**
* @param evt the event to handle
* @param x the x coordinate
* @param y the y coordinate
* @return {@code false}
* @deprecated As of JDK version 1.1,
* replaced by processMouseEvent(MouseEvent).
*/
@ -6798,6 +6897,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
/**
* @param evt the event to handle
* @param x the x coordinate
* @param y the y coordinate
* @return {@code false}
* @deprecated As of JDK version 1.1,
* replaced by processMouseMotionEvent(MouseEvent).
*/
@ -6807,6 +6910,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
/**
* @param evt the event to handle
* @param x the x coordinate
* @param y the y coordinate
* @return {@code false}
* @deprecated As of JDK version 1.1,
* replaced by processMouseEvent(MouseEvent).
*/
@ -6816,6 +6923,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
/**
* @param evt the event to handle
* @param x the x coordinate
* @param y the y coordinate
* @return {@code false}
* @deprecated As of JDK version 1.1,
* replaced by processMouseMotionEvent(MouseEvent).
*/
@ -6825,6 +6936,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
/**
* @param evt the event to handle
* @param x the x coordinate
* @param y the y coordinate
* @return {@code false}
* @deprecated As of JDK version 1.1,
* replaced by processMouseEvent(MouseEvent).
*/
@ -6834,6 +6949,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
/**
* @param evt the event to handle
* @param x the x coordinate
* @param y the y coordinate
* @return {@code false}
* @deprecated As of JDK version 1.1,
* replaced by processMouseEvent(MouseEvent).
*/
@ -6843,6 +6962,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
/**
* @param evt the event to handle
* @param key the key pressed
* @return {@code false}
* @deprecated As of JDK version 1.1,
* replaced by processKeyEvent(KeyEvent).
*/
@ -6852,6 +6974,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
/**
* @param evt the event to handle
* @param key the key pressed
* @return {@code false}
* @deprecated As of JDK version 1.1,
* replaced by processKeyEvent(KeyEvent).
*/
@ -6861,6 +6986,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
/**
* @param evt the event to handle
* @param what the object acted on
* @return {@code false}
* @deprecated As of JDK version 1.1,
* should register this component as ActionListener on component
* which fires action events.
@ -7070,6 +7198,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
/**
* @param evt the event to handle
* @param what the object focused
* @return {@code false}
* @deprecated As of JDK version 1.1,
* replaced by processFocusEvent(FocusEvent).
*/
@ -7079,6 +7210,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
/**
* @param evt the event to handle
* @param what the object focused
* @return {@code false}
* @deprecated As of JDK version 1.1,
* replaced by processFocusEvent(FocusEvent).
*/
@ -8390,6 +8524,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* Returns an array of all the listeners which have been associated
* with the named property.
*
* @param propertyName the property name
* @return all of the <code>PropertyChangeListener</code>s associated with
* the named property; if no such listeners have been added or
* if <code>propertyName</code> is <code>null</code>, an empty
@ -8400,8 +8535,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @see #getPropertyChangeListeners
* @since 1.4
*/
public PropertyChangeListener[] getPropertyChangeListeners(
String propertyName) {
public PropertyChangeListener[] getPropertyChangeListeners(String propertyName) {
synchronized (getObjectLock()) {
if (changeSupport == null) {
return new PropertyChangeListener[0];
@ -8506,7 +8640,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
if (changeSupport == null || oldValue == newValue) {
return;
}
firePropertyChange(propertyName, new Character(oldValue), new Character(newValue));
firePropertyChange(propertyName, Character.valueOf(oldValue), Character.valueOf(newValue));
}
/**
@ -8879,6 +9013,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* This method changes layout-related information, and therefore,
* invalidates the component hierarchy.
*
* @param o the orientation to be set
*
* @see ComponentOrientation
* @see #invalidate
@ -8906,6 +9041,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* subclasses that wish to respect orientation should call this method to
* get the component's orientation before performing layout or drawing.
*
* @return the orientation to order the elements or text
* @see ComponentOrientation
*
* @author Laura Werner, IBM
@ -9063,7 +9199,16 @@ public abstract class Component implements ImageObserver, MenuContainer,
*/
private volatile transient int propertyListenersCount = 0;
/**
* A component listener to track show/hide/resize events
* and convert them to PropertyChange events.
*/
protected ComponentListener accessibleAWTComponentHandler = null;
/**
* A listener to track focus events
* and convert them to PropertyChange events.
*/
protected FocusListener accessibleAWTFocusHandler = null;
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2014, 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
@ -126,6 +126,8 @@ public final class ComponentOrientation implements java.io.Serializable
* Are lines horizontal?
* This will return true for horizontal, left-to-right writing
* systems such as Roman.
*
* @return {@code true} if this orientation has horizontal lines
*/
public boolean isHorizontal() {
return (orientation & HORIZ_BIT) != 0;
@ -136,6 +138,8 @@ public final class ComponentOrientation implements java.io.Serializable
* Vertical Lines: Do lines run left-to-right?<br>
* This will return true for horizontal, left-to-right writing
* systems such as Roman.
*
* @return {@code true} if this orientation is left-to-right
*/
public boolean isLeftToRight() {
return (orientation & LTR_BIT) != 0;
@ -143,7 +147,9 @@ public final class ComponentOrientation implements java.io.Serializable
/**
* Returns the orientation that is appropriate for the given locale.
*
* @param locale the specified locale
* @return the orientation for the locale
*/
public static ComponentOrientation getOrientation(Locale locale) {
// A more flexible implementation would consult a ResourceBundle
@ -171,6 +177,8 @@ public final class ComponentOrientation implements java.io.Serializable
* <li>Return the default locale's orientation.
* </ol>
*
* @param bdl the bundle to use
* @return the orientation
* @deprecated As of J2SE 1.4, use {@link #getOrientation(java.util.Locale)}.
*/
@Deprecated

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2014, 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
@ -310,6 +310,9 @@ public class Container extends Component {
}
/**
* Returns the number of components in this container.
*
* @return the number of components in this container
* @deprecated As of JDK version 1.1,
* replaced by getComponentCount().
*/
@ -391,8 +394,11 @@ public class Container extends Component {
}
/**
* Returns the insets for this container.
*
* @deprecated As of JDK version 1.1,
* replaced by <code>getInsets()</code>.
* @return the insets for this container
*/
@Deprecated
public Insets insets() {
@ -438,6 +444,9 @@ public class Container extends Component {
* displayed, the hierarchy must be validated thereafter in order to
* display the added component.
*
* @param name the name of the component to be added
* @param comp the component to be added
* @return the component added
* @exception NullPointerException if {@code comp} is {@code null}
* @see #add(Component, Object)
* @see #invalidate
@ -1471,8 +1480,10 @@ public class Container extends Component {
/**
* Gets the layout manager for this container.
*
* @see #doLayout
* @see #setLayout
* @return the current layout manager for this container
*/
public LayoutManager getLayout() {
return layoutMgr;
@ -3854,6 +3865,10 @@ public class Container extends Component {
*/
private volatile transient int propertyListenersCount = 0;
/**
* The handler to fire {@code PropertyChange}
* when children are added or removed
*/
protected ContainerListener accessibleContainerHandler = null;
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, 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
@ -294,6 +294,7 @@ public class Cursor implements java.io.Serializable {
* @return the system specific custom cursor named
* @exception HeadlessException if
* <code>GraphicsEnvironment.isHeadless</code> returns true
* @exception AWTException in case of erroneous retrieving of the cursor
*/
static public Cursor getSystemCustomCursor(final String name)
throws AWTException, HeadlessException {
@ -378,6 +379,8 @@ public class Cursor implements java.io.Serializable {
/**
* Return the system default cursor.
*
* @return the default cursor
*/
static public Cursor getDefaultCursor() {
return getPredefinedCursor(Cursor.DEFAULT_CURSOR);
@ -416,6 +419,8 @@ public class Cursor implements java.io.Serializable {
/**
* Returns the type for this cursor.
*
* @return the cursor type
*/
public int getType() {
return type;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2014, 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
@ -125,6 +125,8 @@ public final class DisplayMode {
/**
* Returns whether the two display modes are equal.
*
* @param dm the display mode to compare to
* @return whether the two display modes are equal
*/
public boolean equals(DisplayMode dm) {

View File

@ -222,6 +222,9 @@ public class EventQueue {
});
}
/**
* Initializes a new instance of {@code EventQueue}.
*/
public EventQueue() {
for (int i = 0; i < NUM_PRIORITIES; i++) {
queues[i] = new Queue();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2014, 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
@ -1089,6 +1089,9 @@ public class Frame extends Window implements MenuContainer {
}
/**
* Sets the cursor for this frame to the specified type.
*
* @param cursorType the cursor type
* @deprecated As of JDK version 1.1,
* replaced by <code>Component.setCursor(Cursor)</code>.
*/
@ -1103,6 +1106,7 @@ public class Frame extends Window implements MenuContainer {
/**
* @deprecated As of JDK version 1.1,
* replaced by <code>Component.getCursor()</code>.
* @return the cursor type for this frame
*/
@Deprecated
public int getCursorType() {
@ -1124,6 +1128,8 @@ public class Frame extends Window implements MenuContainer {
* ownerless {@code Dialog}s (introduced in release 1.6), use {@link
* Window#getOwnerlessWindows Window.getOwnerlessWindows}.
*
* @return the array of all {@code Frame}s created by this application
*
* @see Window#getWindows()
* @see Window#getOwnerlessWindows
*

View File

@ -357,6 +357,8 @@ public abstract class GraphicsEnvironment {
* <p>Notice that an application can supersede the registration
* of an earlier created font with a new one.
* </ul>
*
* @param font the font to be registered
* @return true if the <code>font</code> is successfully
* registered in this <code>GraphicsEnvironment</code>.
* @throws NullPointerException if <code>font</code> is null

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2014, 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
@ -981,9 +981,15 @@ java.io.Serializable {
* This method is obsolete and supplied for backwards
* compatibility only; new code should call {@link
* #getLayoutInfo(java.awt.Container, int) getLayoutInfo} instead.
* This method is the same as <code>getLayoutInfo</code>;
* refer to <code>getLayoutInfo</code> for details on parameters
* and return value.
*
* Fills in an instance of {@code GridBagLayoutInfo} for the
* current set of managed children. This method is the same
* as {@code getLayoutInfo}; refer to {@code getLayoutInfo}
* description for details.
*
* @param parent the layout container
* @param sizeflag either {@code PREFERREDSIZE} or {@code MINSIZE}
* @return the {@code GridBagLayoutInfo} for the set of children
*/
protected GridBagLayoutInfo GetLayoutInfo(Container parent, int sizeflag) {
synchronized (parent.getTreeLock()) {
@ -1611,13 +1617,17 @@ java.io.Serializable {
}
/**
* Adjusts the x, y, width, and height fields to the correct
* values depending on the constraint geometry and pads.
* <p>
* This method is obsolete and supplied for backwards
* compatibility only; new code should call {@link
* #adjustForGravity(java.awt.GridBagConstraints, java.awt.Rectangle)
* adjustForGravity} instead.
* This method is the same as <code>adjustForGravity</code>;
* refer to <code>adjustForGravity</code> for details
* on parameters.
* This method is the same as <code>adjustForGravity</code>
*
* @param constraints the constraints to be applied
* @param r the {@code Rectangle} to be adjusted
*/
protected void AdjustForGravity(GridBagConstraints constraints,
Rectangle r) {
@ -1995,9 +2005,12 @@ java.io.Serializable {
* This method is obsolete and supplied for backwards
* compatibility only; new code should call {@link
* #getMinSize(java.awt.Container, GridBagLayoutInfo) getMinSize} instead.
* This method is the same as <code>getMinSize</code>;
* refer to <code>getMinSize</code> for details on parameters
* and return value.
* This method is the same as <code>getMinSize</code>
*
* @param parent the layout container
* @param info the layout info for this parent
* @return a <code>Dimension</code> object containing the
* minimum size
*/
protected Dimension GetMinSize(Container parent, GridBagLayoutInfo info) {
Dimension d = new Dimension();
@ -2035,9 +2048,9 @@ java.io.Serializable {
* This method is obsolete and supplied for backwards
* compatibility only; new code should call {@link
* #arrangeGrid(Container) arrangeGrid} instead.
* This method is the same as <code>arrangeGrid</code>;
* refer to <code>arrangeGrid</code> for details on the
* parameter.
* This method is the same as <code>arrangeGrid</code>
*
* @param parent the layout container
*/
protected void ArrangeGrid(Container parent) {
Component comp;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2014, 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
@ -38,10 +38,24 @@ public class HeadlessException extends UnsupportedOperationException {
* JDK 1.4 serialVersionUID
*/
private static final long serialVersionUID = 167183644944358563L;
/**
* Constructs new {@code HeadlessException}
*/
public HeadlessException() {}
/**
* Create a new instance with the specified detailed error message.
*
* @param msg the error message
*/
public HeadlessException(String msg) {
super(msg);
}
/**
* {@inheritDoc}
*/
public String getMessage() {
String superMessage = super.getMessage();
String headlessMessage = GraphicsEnvironment.getHeadlessMessage();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2000, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, 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
@ -39,6 +39,8 @@ public interface ItemSelectable {
/**
* Returns the selected items or <code>null</code> if no
* items are selected.
*
* @return the list of selected objects, or {@code null}
*/
public Object[] getSelectedObjects();

View File

@ -1459,6 +1459,7 @@ public abstract class KeyboardFocusManager
* Returns an array of all the <code>PropertyChangeListener</code>s
* associated with the named property.
*
* @param propertyName the property name
* @return all of the <code>PropertyChangeListener</code>s associated with
* the named property or an empty array if no such listeners have
* been added.
@ -1628,6 +1629,7 @@ public abstract class KeyboardFocusManager
* Returns an array of all the <code>VetoableChangeListener</code>s
* associated with the named property.
*
* @param propertyName the property name
* @return all of the <code>VetoableChangeListener</code>s associated with
* the named property or an empty array if no such listeners have
* been added.

View File

@ -193,7 +193,8 @@ public class Label extends Component implements Accessible {
* Gets the current alignment of this label. Possible values are
* <code>Label.LEFT</code>, <code>Label.RIGHT</code>, and
* <code>Label.CENTER</code>.
* @see java.awt.Label#setAlignment
* @return the alignment of this label
* @see java.awt.Label#setAlignment
*/
public int getAlignment() {
return alignment;
@ -321,6 +322,9 @@ public class Label extends Component implements Accessible {
*/
private static final long serialVersionUID = -3568967560160480438L;
/**
* Constructor for the accessible label.
*/
public AccessibleAWTLabel() {
super();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2014, 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
@ -61,7 +61,9 @@ public interface LayoutManager {
/**
* Calculates the preferred size dimensions for the specified
* container, given the components it contains.
* @param parent the container to be laid out
*
* @param parent the container to be laid out
* @return the preferred dimension for the container
*
* @see #minimumLayoutSize
*/
@ -70,7 +72,10 @@ public interface LayoutManager {
/**
* Calculates the minimum size dimensions for the specified
* container, given the components it contains.
* @param parent the component to be laid out
*
* @param parent the component to be laid out
* @return the minimum dimension for the container
*
* @see #preferredLayoutSize
*/
Dimension minimumLayoutSize(Container parent);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, 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
@ -55,8 +55,11 @@ public interface LayoutManager2 extends LayoutManager {
/**
* Calculates the maximum size dimensions for the specified container,
* given the components it contains.
*
* @see java.awt.Component#getMaximumSize
* @see LayoutManager
* @param target the target container
* @return the maximum size of the container
*/
public Dimension maximumLayoutSize(Container target);
@ -66,6 +69,9 @@ public interface LayoutManager2 extends LayoutManager {
* components. The value should be a number between 0 and 1
* where 0 represents alignment along the origin, 1 is aligned
* the furthest away from the origin, 0.5 is centered, etc.
*
* @param target the target container
* @return the x-axis alignment preference
*/
public float getLayoutAlignmentX(Container target);
@ -75,12 +81,16 @@ public interface LayoutManager2 extends LayoutManager {
* components. The value should be a number between 0 and 1
* where 0 represents alignment along the origin, 1 is aligned
* the furthest away from the origin, 0.5 is centered, etc.
*
* @param target the target container
* @return the y-axis alignment preference
*/
public float getLayoutAlignmentY(Container target);
/**
* Invalidates the layout, indicating that if the layout manager
* has cached information it should be discarded.
* @param target the target container
*/
public void invalidateLayout(Container target);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2014, 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
@ -282,6 +282,9 @@ public class List extends Component implements ItemSelectable, Accessible {
}
/**
* Returns the number of items in the list.
*
* @return the number of items in the list
* @deprecated As of JDK version 1.1,
* replaced by <code>getItemCount()</code>.
*/
@ -333,7 +336,10 @@ public class List extends Component implements ItemSelectable, Accessible {
}
/**
* @deprecated replaced by <code>add(String)</code>.
* Adds the specified item to the end of the list.
*
* @param item the item to be added
* @deprecated replaced by <code>add(String)</code>.
*/
@Deprecated
public void addItem(String item) {
@ -358,7 +364,12 @@ public class List extends Component implements ItemSelectable, Accessible {
}
/**
* @deprecated replaced by <code>add(String, int)</code>.
* Adds the specified item to the the list
* at the position indicated by the index.
*
* @param item the item to be added
* @param index the position at which to add the item
* @deprecated replaced by <code>add(String, int)</code>.
*/
@Deprecated
public synchronized void addItem(String item, int index) {
@ -455,8 +466,11 @@ public class List extends Component implements ItemSelectable, Accessible {
}
/**
* @deprecated replaced by <code>remove(String)</code>
* and <code>remove(int)</code>.
* Removes the item at the specified position.
*
* @param position the index of the item to delete
* @deprecated replaced by <code>remove(String)</code>
* and <code>remove(int)</code>.
*/
@Deprecated
public void delItem(int position) {
@ -646,6 +660,10 @@ public class List extends Component implements ItemSelectable, Accessible {
}
/**
* Determines if the specified item in the list is selected.
*
* @param index specifies the item to be checked
* @return {@code true} if the item is selected; otherwise {@code false}
* @deprecated As of JDK version 1.1,
* replaced by <code>isIndexSelected(int)</code>.
*/
@ -672,6 +690,7 @@ public class List extends Component implements ItemSelectable, Accessible {
/**
* Determines whether this list allows multiple selections.
*
* @return <code>true</code> if this list allows multiple
* selections; otherwise, <code>false</code>
* @see #setMultipleMode
@ -682,6 +701,10 @@ public class List extends Component implements ItemSelectable, Accessible {
}
/**
* Determines whether this list allows multiple selections.
*
* @return {@code true} if this list allows multiple
* selections; otherwise {@code false}
* @deprecated As of JDK version 1.1,
* replaced by <code>isMultipleMode()</code>.
*/
@ -709,6 +732,9 @@ public class List extends Component implements ItemSelectable, Accessible {
}
/**
* Enables or disables multiple selection mode for this list.
*
* @param b {@code true} to enable multiple mode, {@code false} otherwise
* @deprecated As of JDK version 1.1,
* replaced by <code>setMultipleMode(boolean)</code>.
*/
@ -760,6 +786,11 @@ public class List extends Component implements ItemSelectable, Accessible {
}
/**
* Returns the preferred size of this component
* assuming it has the specified number of rows.
*
* @param rows the number of rows
* @return the preferred dimensions for displaying this list
* @deprecated As of JDK version 1.1,
* replaced by <code>getPreferredSize(int)</code>.
*/
@ -810,6 +841,11 @@ public class List extends Component implements ItemSelectable, Accessible {
}
/**
* Returns the minimum dimensions for the list
* with the specified number of rows.
*
* @param rows the number of rows in the list
* @return the minimum dimensions for displaying this list
* @deprecated As of JDK version 1.1,
* replaced by <code>getMinimumSize(int)</code>.
*/
@ -1146,6 +1182,10 @@ public class List extends Component implements ItemSelectable, Accessible {
}
/**
* Deletes the list items in the specified index range.
*
* @param start the beginning index of the range to delete
* @param end the ending index of the range to delete
* @deprecated As of JDK version 1.1,
* Not for public use in the future.
* This method is expected to be retained only as a package
@ -1290,6 +1330,9 @@ public class List extends Component implements ItemSelectable, Accessible {
*/
private static final long serialVersionUID = 7924617370136012829L;
/**
* Constructs new {@code AccessibleAWTList}
*/
public AccessibleAWTList() {
super();
List.this.addActionListener(this);
@ -1491,6 +1534,13 @@ public class List extends Component implements ItemSelectable, Accessible {
private List parent;
private int indexInParent;
/**
* Constructs new {@code AccessibleAWTListChild} with the given
* parent {@code List} and 0-based index of this object in the parent.
*
* @param parent the parent {@code List}
* @param indexInParent the index in the parent
*/
public AccessibleAWTListChild(List parent, int indexInParent) {
this.parent = parent;
this.setAccessibleParent(parent);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2014, 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
@ -643,9 +643,11 @@ public class MediaTracker implements java.io.Serializable {
* image is considered to have finished loading. Use the
* <code>statusID</code>, <code>isErrorID</code>, and
* <code>isErrorAny</code> methods to check for errors.
* @param id the identifier of the images to check
* @param ms the length of time, in milliseconds, to wait
* for the loading to complete
* @param id the identifier of the images to check
* @param ms the length of time, in milliseconds, to wait
* for the loading to complete
* @return {@code true} if the loading completed in time;
* otherwise {@code false}
* @see java.awt.MediaTracker#waitForAll
* @see java.awt.MediaTracker#waitForID(int)
* @see java.awt.MediaTracker#statusID

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2014, 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
@ -213,7 +213,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible {
/**
* Get the number of items in this menu.
* @return the number of items in this menu.
* @return the number of items in this menu
* @since 1.1
*/
public int getItemCount() {
@ -221,6 +221,9 @@ public class Menu extends MenuItem implements MenuContainer, Accessible {
}
/**
* Returns the number of items in this menu.
*
* @return the number of items in this menu
* @deprecated As of JDK version 1.1,
* replaced by <code>getItemCount()</code>.
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2014, 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
@ -279,6 +279,9 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible
}
/**
* Gets the number of menus on the menu bar.
*
* @return the number of menus on the menu bar.
* @deprecated As of JDK version 1.1,
* replaced by <code>getMenuCount()</code>.
*/
@ -338,10 +341,11 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible
* or <code>null</code> if none of the menu items being managed
* by this menu bar is associated with the specified menu
* shortcut.
* @param s the specified menu shortcut.
* @see java.awt.MenuItem
* @see java.awt.MenuShortcut
* @since 1.1
* @param s the specified menu shortcut.
* @return the menu item for the specified shortcut.
* @see java.awt.MenuItem
* @see java.awt.MenuShortcut
* @since 1.1
*/
public MenuItem getShortcutMenuItem(MenuShortcut s) {
int nmenus = getMenuCount();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2014, 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
@ -220,6 +220,7 @@ public abstract class MenuComponent implements java.io.Serializable {
/**
* @deprecated As of JDK version 1.1,
* programs should not directly manipulate peers.
* @return the peer for this component
*/
@Deprecated
public MenuComponentPeer getPeer() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2014, 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
@ -31,10 +31,25 @@ package java.awt;
*/
public interface MenuContainer {
/**
* Returns the font in use by this container.
*
* @return the menu font
*/
Font getFont();
/**
* Removes the specified menu component from the menu.
*
* @param comp the menu component to remove
*/
void remove(MenuComponent comp);
/**
* Posts an event to the listeners.
*
* @param evt the event to dispatch
* @deprecated As of JDK version 1.1
* replaced by dispatchEvent(AWTEvent).
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2014, 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
@ -264,6 +264,9 @@ public class MenuItem extends MenuComponent implements Accessible {
/**
* Checks whether this menu item is enabled.
*
* @return {@code true} if the item is enabled;
* otherwise {@code false}
* @see java.awt.MenuItem#setEnabled
* @since 1.0
*/
@ -296,6 +299,10 @@ public class MenuItem extends MenuComponent implements Accessible {
}
/**
* Sets whether or not this menu item can be chosen.
*
* @param b if {@code true}, enables this menu item;
* otherwise disables
* @deprecated As of JDK version 1.1,
* replaced by <code>setEnabled(boolean)</code>.
*/
@ -494,8 +501,10 @@ public class MenuItem extends MenuComponent implements Accessible {
/**
* Gets the command name of the action event that is fired
* by this menu item.
* @see java.awt.MenuItem#setActionCommand
* @since 1.1
*
* @return the action command name
* @see java.awt.MenuItem#setActionCommand
* @since 1.1
*/
public String getActionCommand() {
return getActionCommandImpl();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 1997, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, 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
@ -35,6 +35,8 @@ public interface PrintGraphics {
/**
* Returns the PrintJob object from which this PrintGraphics
* object originated.
*
* @return the print job for this object
*/
public PrintJob getPrintJob();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, 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
@ -42,6 +42,7 @@ public abstract class PrintJob {
* object is disposed. This graphics object will also implement
* the PrintGraphics interface.
* @see PrintGraphics
* @return the graphics context for printing the next page
*/
public abstract Graphics getGraphics();
@ -49,6 +50,8 @@ public abstract class PrintJob {
* Returns the dimensions of the page in pixels.
* The resolution of the page is chosen so that it
* is similar to the screen resolution.
*
* @return the page dimension
*/
public abstract Dimension getPageDimension();
@ -56,11 +59,16 @@ public abstract class PrintJob {
* Returns the resolution of the page in pixels per inch.
* Note that this doesn't have to correspond to the physical
* resolution of the printer.
*
* @return the page resolution
*/
public abstract int getPageResolution();
/**
* Returns true if the last page will be printed first.
*
* @return {@code true} if the last page will be printed first;
* otherwise {@code false}
*/
public abstract boolean lastPageFirst();

View File

@ -498,6 +498,8 @@ public class Robot {
/**
* Returns the number of milliseconds this Robot sleeps after generating an event.
*
* @return the delay duration in milliseconds
*/
public synchronized int getAutoDelay() {
return autoDelay;
@ -505,7 +507,10 @@ public class Robot {
/**
* Sets the number of milliseconds this Robot sleeps after generating an event.
* @throws IllegalArgumentException If <code>ms</code> is not between 0 and 60,000 milliseconds inclusive
*
* @param ms the delay duration in milliseconds
* @throws IllegalArgumentException If {@code ms}
* is not between 0 and 60,000 milliseconds inclusive
*/
public synchronized void setAutoDelay(int ms) {
checkDelayArgument(ms);
@ -523,9 +528,11 @@ public class Robot {
* Sleeps for the specified time.
* To catch any <code>InterruptedException</code>s that occur,
* <code>Thread.sleep()</code> may be used instead.
* @param ms time to sleep in milliseconds
* @throws IllegalArgumentException if <code>ms</code> is not between 0 and 60,000 milliseconds inclusive
* @see java.lang.Thread#sleep
*
* @param ms time to sleep in milliseconds
* @throws IllegalArgumentException if {@code ms}
* is not between 0 and 60,000 milliseconds inclusive
* @see java.lang.Thread#sleep
*/
public synchronized void delay(int ms) {
checkDelayArgument(ms);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, 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
@ -323,7 +323,9 @@ public class ScrollPane extends Container implements Accessible {
* represents the state of the vertical scrollbar.
* The declared return type of this method is
* <code>Adjustable</code> to maintain backward compatibility.
*
* @see java.awt.ScrollPaneAdjustable
* @return the vertical scrollbar state
*/
public Adjustable getVAdjustable() {
return vAdjustable;
@ -334,7 +336,9 @@ public class ScrollPane extends Container implements Accessible {
* represents the state of the horizontal scrollbar.
* The declared return type of this method is
* <code>Adjustable</code> to maintain backward compatibility.
*
* @see java.awt.ScrollPaneAdjustable
* @return the horizontal scrollbar state
*/
public Adjustable getHAdjustable() {
return hAdjustable;
@ -657,6 +661,9 @@ public class ScrollPane extends Container implements Accessible {
* Indicates whether or not scrolling will take place in response to
* the mouse wheel. Wheel scrolling is enabled by default.
*
* @return {@code true} if the wheel scrolling enabled;
* otherwise {@code false}
*
* @see #setWheelScrollingEnabled(boolean)
* @since 1.4
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2014, 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
@ -656,6 +656,9 @@ public class Scrollbar extends Component implements Adjustable, Accessible {
}
/**
* Returns the visible amount of this scroll bar.
*
* @return the visible amount of this scroll bar
* @deprecated As of JDK version 1.1,
* replaced by <code>getVisibleAmount()</code>.
*/
@ -729,6 +732,10 @@ public class Scrollbar extends Component implements Adjustable, Accessible {
}
/**
* Sets the unit increment for this scroll bar.
*
* @param v the increment value
*
* @deprecated As of JDK version 1.1,
* replaced by <code>setUnitIncrement(int)</code>.
*/
@ -768,6 +775,9 @@ public class Scrollbar extends Component implements Adjustable, Accessible {
}
/**
* Returns the unit increment for this scrollbar.
*
* @return the unit increment for this scrollbar
* @deprecated As of JDK version 1.1,
* replaced by <code>getUnitIncrement()</code>.
*/
@ -797,6 +807,9 @@ public class Scrollbar extends Component implements Adjustable, Accessible {
}
/**
* Sets the block increment for this scroll bar.
*
* @param v the block increment
* @deprecated As of JDK version 1.1,
* replaced by <code>setBlockIncrement()</code>.
*/
@ -833,6 +846,10 @@ public class Scrollbar extends Component implements Adjustable, Accessible {
}
/**
* Returns the block increment of this scroll bar.
*
* @return the block increment of this scroll bar
*
* @deprecated As of JDK version 1.1,
* replaced by <code>getBlockIncrement()</code>.
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2014, 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
@ -314,6 +314,11 @@ public class TextArea extends TextComponent {
}
/**
* Inserts the specified text at the specified position
* in this text area.
*
* @param str the non-{@code null} text to insert
* @param pos the position at which to insert
* @deprecated As of JDK version 1.1,
* replaced by <code>insert(String, int)</code>.
*/
@ -342,6 +347,9 @@ public class TextArea extends TextComponent {
}
/**
* Appends the given text to the text area's current text.
*
* @param str the text to append
* @deprecated As of JDK version 1.1,
* replaced by <code>append(String)</code>.
*/
@ -378,6 +386,15 @@ public class TextArea extends TextComponent {
}
/**
* Replaces a range of characters between
* the indicated start and end positions
* with the specified replacement text (the text at the end
* position will not be replaced).
*
* @param str the non-{@code null} text to use as
* the replacement
* @param start the start position
* @param end the end position
* @deprecated As of JDK version 1.1,
* replaced by <code>replaceRange(String, int, int)</code>.
*/
@ -492,6 +509,12 @@ public class TextArea extends TextComponent {
}
/**
* Determines the preferred size of the text area with the specified
* number of rows and columns.
*
* @param rows the number of rows
* @param columns the number of columns
* @return the preferred dimensions needed for the text area
* @deprecated As of JDK version 1.1,
* replaced by <code>getPreferredSize(int, int)</code>.
*/
@ -544,6 +567,12 @@ public class TextArea extends TextComponent {
}
/**
* Determines the minimum size of the text area with the specified
* number of rows and columns.
*
* @param rows the number of rows
* @param columns the number of columns
* @return the minimum size for the text area
* @deprecated As of JDK version 1.1,
* replaced by <code>getMinimumSize(int, int)</code>.
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2014, 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
@ -107,6 +107,9 @@ public class TextComponent extends Component implements Accessible {
// the background color of non-editable TextComponents.
boolean backgroundSetByClientCode = false;
/**
* A list of listeners that will receive events from this object.
*/
transient protected TextListener textListener;
/*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2014, 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
@ -272,6 +272,10 @@ public class TextField extends TextComponent {
}
/**
* Sets the character to be echoed when protected input is displayed.
*
* @param c the echo character for this text field
*
* @deprecated As of JDK version 1.1,
* replaced by <code>setEchoChar(char)</code>.
*/
@ -368,6 +372,12 @@ public class TextField extends TextComponent {
}
/**
* Returns the preferred size for this text field
* with the specified number of columns.
*
* @param columns the number of columns
* @return the preferred size for the text field
*
* @deprecated As of JDK version 1.1,
* replaced by <code>getPreferredSize(int)</code>.
*/
@ -407,8 +417,9 @@ public class TextField extends TextComponent {
/**
* Gets the minimum dimensions for a text field with
* the specified number of columns.
* @param columns the number of columns in
* this text field.
* @param columns the number of columns in
* this text field.
* @return the minimum size for this text field
* @since 1.1
*/
public Dimension getMinimumSize(int columns) {
@ -416,6 +427,11 @@ public class TextField extends TextComponent {
}
/**
* Returns the minimum dimensions for a text field with
* the specified number of columns.
*
* @param columns the number of columns
* @return the minimum size for this text field
* @deprecated As of JDK version 1.1,
* replaced by <code>getMinimumSize(int)</code>.
*/

View File

@ -422,7 +422,8 @@ public abstract class Toolkit {
* and allows the Component and Container classes to be extended directly
* to create windowless components that are defined entirely in java.
*
* @param target The Component to be created.
* @param target The Component to be created.
* @return the peer for the specified component
*/
protected LightweightPeer createComponent(Component target) {
if (lightweightMarker == null) {
@ -1370,6 +1371,9 @@ public abstract class Toolkit {
* {@link java.awt.event.KeyEvent#VK_SCROLL_LOCK VK_SCROLL_LOCK}, and
* {@link java.awt.event.KeyEvent#VK_KANA_LOCK VK_KANA_LOCK}.
*
* @param keyCode the key code
* @return {@code true} if the given key is currently in its "on" state;
* otherwise {@code false}
* @exception java.lang.IllegalArgumentException if <code>keyCode</code>
* is not one of the valid key codes
* @exception java.lang.UnsupportedOperationException if the host system doesn't
@ -1404,6 +1408,8 @@ public abstract class Toolkit {
* involve event processing and therefore may not be immediately
* observable through getLockingKeyState.
*
* @param keyCode the key code
* @param on the state of the key
* @exception java.lang.IllegalArgumentException if <code>keyCode</code>
* is not one of the valid key codes
* @exception java.lang.UnsupportedOperationException if the host system doesn't
@ -1429,6 +1435,9 @@ public abstract class Toolkit {
/**
* Give native peers the ability to query the native container
* given a native component (eg the direct parent may be lightweight).
*
* @param c the component to fetch the container for
* @return the native container object for the component
*/
protected static Container getNativeContainer(Component c) {
return c.getNativeContainer();
@ -1449,6 +1458,7 @@ public abstract class Toolkit {
* @param name a localized description of the cursor, for Java Accessibility use
* @exception IndexOutOfBoundsException if the hotSpot values are outside
* the bounds of the cursor
* @return the cursor created
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
@ -1675,6 +1685,11 @@ public abstract class Toolkit {
/**
* Gets a property with the specified key and default.
* This method returns defaultValue if the property is not found.
*
* @param key the key
* @param defaultValue the default value
* @return the value of the property or the default value
* if the property was not found
*/
public static String getProperty(String key, String defaultValue) {
// first try platform specific bundle
@ -1738,6 +1753,9 @@ public abstract class Toolkit {
* Creates the peer for a DragSourceContext.
* Always throws InvalidDndOperationException if
* GraphicsEnvironment.isHeadless() returns true.
*
* @param dge the {@code DragGestureEvent}
* @return the peer created
* @see java.awt.GraphicsEnvironment#isHeadless
*/
public abstract DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException;
@ -1775,6 +1793,9 @@ public abstract class Toolkit {
* representation for an underlying platform dependent desktop setting.
* For more information on desktop properties supported by the AWT see
* <a href="doc-files/DesktopProperties.html">AWT Desktop Properties</a>.
*
* @param propertyName the property name
* @return the value for the specified desktop property
*/
public final synchronized Object getDesktopProperty(String propertyName) {
// This is a workaround for headless toolkits. It would be
@ -1818,6 +1839,9 @@ public abstract class Toolkit {
/**
* Sets the named desktop property to the specified value and fires a
* property change event to notify any listeners that the value has changed.
*
* @param name the property name
* @param newValue the new property value
*/
protected final void setDesktopProperty(String name, Object newValue) {
// This is a workaround for headless toolkits. It would be

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2014, 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
@ -1452,6 +1452,8 @@ public class Window extends Container implements Accessible {
/**
* Returns the owner of this window.
*
* @return the owner of this window
* @since 1.2
*/
public Window getOwner() {
@ -1464,6 +1466,8 @@ public class Window extends Container implements Accessible {
/**
* Return an array containing all the windows this
* window currently owns.
*
* @return the array of all the owned windows
* @since 1.2
*/
public Window[] getOwnedWindows() {
@ -1586,6 +1590,7 @@ public class Window extends Container implements Accessible {
* dialogs such as component positions, {@code LayoutManager}s
* or serialization.
*
* @return the array of all the {@code Window}s created by the application
* @see Frame#getFrames
* @see Window#getOwnerlessWindows
*
@ -1608,6 +1613,8 @@ public class Window extends Container implements Accessible {
* dialogs such as component positions, {@code LayoutManager}s
* or serialization.
*
* @return the array of all the ownerless {@code Window}s
* created by this application
* @see Frame#getFrames
* @see Window#getWindows()
*
@ -2849,6 +2856,7 @@ public class Window extends Container implements Accessible {
*
* This method can only be called while the window is not displayable.
*
* @param type the window type
* @throws IllegalComponentStateException if the window
* is displayable.
* @throws IllegalArgumentException if the type is {@code null}
@ -2874,6 +2882,7 @@ public class Window extends Container implements Accessible {
/**
* Returns the type of the window.
*
* @return the type of the window
* @see #setType
* @since 1.7
*/

View File

@ -337,7 +337,7 @@ public class ParameterBlock implements Cloneable, Serializable {
* the specified parameter.
*/
public ParameterBlock add(byte b) {
return add(new Byte(b));
return add(Byte.valueOf(b));
}
/**
@ -348,7 +348,7 @@ public class ParameterBlock implements Cloneable, Serializable {
* the specified parameter.
*/
public ParameterBlock add(char c) {
return add(new Character(c));
return add(Character.valueOf(c));
}
/**
@ -359,7 +359,7 @@ public class ParameterBlock implements Cloneable, Serializable {
* the specified parameter.
*/
public ParameterBlock add(short s) {
return add(new Short(s));
return add(Short.valueOf(s));
}
/**
@ -381,7 +381,7 @@ public class ParameterBlock implements Cloneable, Serializable {
* the specified parameter.
*/
public ParameterBlock add(long l) {
return add(new Long(l));
return add(Long.valueOf(l));
}
/**
@ -441,7 +441,7 @@ public class ParameterBlock implements Cloneable, Serializable {
* the specified parameter.
*/
public ParameterBlock set(byte b, int index) {
return set(new Byte(b), index);
return set(Byte.valueOf(b), index);
}
/**
@ -457,7 +457,7 @@ public class ParameterBlock implements Cloneable, Serializable {
* the specified parameter.
*/
public ParameterBlock set(char c, int index) {
return set(new Character(c), index);
return set(Character.valueOf(c), index);
}
/**
@ -473,7 +473,7 @@ public class ParameterBlock implements Cloneable, Serializable {
* the specified parameter.
*/
public ParameterBlock set(short s, int index) {
return set(new Short(s), index);
return set(Short.valueOf(s), index);
}
/**
@ -505,7 +505,7 @@ public class ParameterBlock implements Cloneable, Serializable {
* the specified parameter.
*/
public ParameterBlock set(long l, int index) {
return set(new Long(l), index);
return set(Long.valueOf(l), index);
}
/**

View File

@ -248,7 +248,7 @@ public class Statement {
// ignored elsewhere.
if (target == Character.class && arguments.length == 1 &&
argClasses[0] == String.class) {
return new Character(((String)arguments[0]).charAt(0));
return ((String)arguments[0]).charAt(0);
}
try {
m = ConstructorFinder.findConstructor((Class)target, argClasses);

View File

@ -1859,18 +1859,17 @@ public abstract class ClassLoader {
String name = NativeLibrary.findBuiltinLib(file.getName());
boolean isBuiltin = (name != null);
if (!isBuiltin) {
boolean exists = AccessController.doPrivileged(
new PrivilegedAction<Object>() {
public Object run() {
return file.exists() ? Boolean.TRUE : null;
}})
!= null;
if (!exists) {
return false;
}
try {
name = file.getCanonicalPath();
} catch (IOException e) {
name = AccessController.doPrivileged(
new PrivilegedAction<String>() {
public String run() {
try {
return file.exists() ? file.getCanonicalPath() : null;
} catch (IOException e) {
return null;
}
}
});
if (name == null) {
return false;
}
}

View File

@ -107,6 +107,7 @@ import java.lang.annotation.Annotation;
* loader to be found.
*
* @see ClassLoader#definePackage
* @since 1.2
*/
public class Package implements java.lang.reflect.AnnotatedElement {
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2014, 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
@ -45,7 +45,7 @@ import java.lang.annotation.*;
* <li> the declaration is a fixed arity method or constructor
*
* <li> the declaration is a variable arity method that is neither
* {@code static} nor {@code final}.
* {@code static} nor {@code final} nor {@code private}.
*
* </ul>
*

View File

@ -2094,7 +2094,7 @@ public class DecimalFormat extends NumberFormat {
}
return gotDouble ?
(Number)new Double(doubleResult) : (Number)new Long(longResult);
(Number)new Double(doubleResult) : (Number)Long.valueOf(longResult);
}
}

View File

@ -3031,9 +3031,11 @@ public class Collections {
final Collection<E> c;
final Class<E> type;
void typeCheck(Object o) {
@SuppressWarnings("unchecked")
E typeCheck(Object o) {
if (o != null && !type.isInstance(o))
throw new ClassCastException(badElementMsg(o));
return (E) o;
}
private String badElementMsg(Object o) {
@ -3042,10 +3044,8 @@ public class Collections {
}
CheckedCollection(Collection<E> c, Class<E> type) {
if (c==null || type == null)
throw new NullPointerException();
this.c = c;
this.type = type;
this.c = Objects.requireNonNull(c, "c");
this.type = Objects.requireNonNull(type, "type");
}
public int size() { return c.size(); }
@ -3077,10 +3077,7 @@ public class Collections {
public void remove() { it.remove(); }};
}
public boolean add(E e) {
typeCheck(e);
return c.add(e);
}
public boolean add(E e) { return c.add(typeCheck(e)); }
private E[] zeroLengthElementArray; // Lazily initialized
@ -3091,7 +3088,7 @@ public class Collections {
@SuppressWarnings("unchecked")
Collection<E> checkedCopyOf(Collection<? extends E> coll) {
Object[] a = null;
Object[] a;
try {
E[] z = zeroLengthElementArray();
a = coll.toArray(z);
@ -3187,11 +3184,7 @@ public class Collections {
public E peek() {return queue.peek();}
public E poll() {return queue.poll();}
public E remove() {return queue.remove();}
public boolean offer(E e) {
typeCheck(e);
return add(e);
}
public boolean offer(E e) {return queue.offer(typeCheck(e));}
}
/**
@ -3440,13 +3433,11 @@ public class Collections {
public int lastIndexOf(Object o) { return list.lastIndexOf(o); }
public E set(int index, E element) {
typeCheck(element);
return list.set(index, element);
return list.set(index, typeCheck(element));
}
public void add(int index, E element) {
typeCheck(element);
list.add(index, element);
list.add(index, typeCheck(element));
}
public boolean addAll(int index, Collection<? extends E> c) {
@ -3467,13 +3458,11 @@ public class Collections {
public void remove() { i.remove(); }
public void set(E e) {
typeCheck(e);
i.set(e);
i.set(typeCheck(e));
}
public void add(E e) {
typeCheck(e);
i.add(e);
i.add(typeCheck(e));
}
@Override
@ -3487,10 +3476,19 @@ public class Collections {
return new CheckedList<>(list.subList(fromIndex, toIndex), type);
}
/**
* {@inheritDoc}
*
* @throws ClassCastException if the class of an element returned by the
* operator prevents it from being added to this collection. The
* exception may be thrown after some elements of the list have
* already been replaced.
*/
@Override
public void replaceAll(UnaryOperator<E> operator) {
list.replaceAll(operator);
list.replaceAll(e -> typeCheck(operator.apply(e)));
}
@Override
public void sort(Comparator<? super E> c) {
list.sort(c);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2014, 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
@ -212,13 +212,9 @@ public final class Currency implements Serializable {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
String homeDir = System.getProperty("java.home");
try {
String dataFile = homeDir + File.separator +
"lib" + File.separator + "currency.data";
try (DataInputStream dis = new DataInputStream(
new BufferedInputStream(
new FileInputStream(dataFile)))) {
new BufferedInputStream(getClass().getResourceAsStream("/java/util/currency.data")))) {
if (dis.readInt() != MAGIC_NUMBER) {
throw new InternalError("Currency data is possibly corrupted");
}
@ -248,7 +244,7 @@ public final class Currency implements Serializable {
// look for the properties file for overrides
String propsFile = System.getProperty("java.util.currency.data");
if (propsFile == null) {
propsFile = homeDir + File.separator + "lib" +
propsFile = System.getProperty("java.home") + File.separator + "lib" +
File.separator + "currency.properties";
}
try {

View File

@ -170,7 +170,6 @@ public class CipherInputStream extends FilterInputStream {
* @return the next byte of data, or <code>-1</code> if the end of the
* stream is reached.
* @exception IOException if an I/O error occurs.
* @since JCE1.2
*/
public int read() throws IOException {
if (ostart >= ofinish) {
@ -196,7 +195,6 @@ public class CipherInputStream extends FilterInputStream {
* the stream has been reached.
* @exception IOException if an I/O error occurs.
* @see java.io.InputStream#read(byte[], int, int)
* @since JCE1.2
*/
public int read(byte b[]) throws IOException {
return read(b, 0, b.length);
@ -217,7 +215,6 @@ public class CipherInputStream extends FilterInputStream {
* the stream has been reached.
* @exception IOException if an I/O error occurs.
* @see java.io.InputStream#read()
* @since JCE1.2
*/
public int read(byte b[], int off, int len) throws IOException {
if (ostart >= ofinish) {
@ -254,7 +251,6 @@ public class CipherInputStream extends FilterInputStream {
* @param n the number of bytes to be skipped.
* @return the actual number of bytes skipped.
* @exception IOException if an I/O error occurs.
* @since JCE1.2
*/
public long skip(long n) throws IOException {
int available = ofinish - ostart;
@ -277,7 +273,6 @@ public class CipherInputStream extends FilterInputStream {
* @return the number of bytes that can be read from this input stream
* without blocking.
* @exception IOException if an I/O error occurs.
* @since JCE1.2
*/
public int available() throws IOException {
return (ofinish - ostart);
@ -292,7 +287,6 @@ public class CipherInputStream extends FilterInputStream {
* stream.
*
* @exception IOException if an I/O error occurs.
* @since JCE1.2
*/
public void close() throws IOException {
if (closed) {
@ -321,7 +315,6 @@ public class CipherInputStream extends FilterInputStream {
* <code>mark</code> and <code>reset</code> methods.
* @see java.io.InputStream#mark(int)
* @see java.io.InputStream#reset()
* @since JCE1.2
*/
public boolean markSupported() {
return false;

View File

@ -114,7 +114,6 @@ public class CipherOutputStream extends FilterOutputStream {
*
* @param b the <code>byte</code>.
* @exception IOException if an I/O error occurs.
* @since JCE1.2
*/
public void write(int b) throws IOException {
ibuffer[0] = (byte) b;
@ -138,7 +137,6 @@ public class CipherOutputStream extends FilterOutputStream {
* @exception NullPointerException if <code>b</code> is null.
* @exception IOException if an I/O error occurs.
* @see javax.crypto.CipherOutputStream#write(byte[], int, int)
* @since JCE1.2
*/
public void write(byte b[]) throws IOException {
write(b, 0, b.length);
@ -152,7 +150,6 @@ public class CipherOutputStream extends FilterOutputStream {
* @param off the start offset in the data.
* @param len the number of bytes to write.
* @exception IOException if an I/O error occurs.
* @since JCE1.2
*/
public void write(byte b[], int off, int len) throws IOException {
obuffer = cipher.update(b, off, len);
@ -174,7 +171,6 @@ public class CipherOutputStream extends FilterOutputStream {
* the cipher's block size, no bytes will be written out.
*
* @exception IOException if an I/O error occurs.
* @since JCE1.2
*/
public void flush() throws IOException {
if (obuffer != null) {
@ -198,7 +194,6 @@ public class CipherOutputStream extends FilterOutputStream {
* stream.
*
* @exception IOException if an I/O error occurs.
* @since JCE1.2
*/
public void close() throws IOException {
if (closed) {

View File

@ -1307,11 +1307,11 @@ public class MLet extends java.net.URLClassLoader
if (type.compareTo("java.lang.Boolean") == 0)
return Boolean.valueOf(param);
if (type.compareTo("java.lang.Byte") == 0)
return new Byte(param);
return Byte.valueOf(param);
if (type.compareTo("java.lang.Short") == 0)
return new Short(param);
return Short.valueOf(param);
if (type.compareTo("java.lang.Long") == 0)
return new Long(param);
return Long.valueOf(param);
if (type.compareTo("java.lang.Integer") == 0)
return new Integer(param);
if (type.compareTo("java.lang.Float") == 0)

View File

@ -544,7 +544,7 @@ public class RequiredModelMBean
}
// convert seconds to milliseconds for time comparison
currencyPeriod = ((new Long(expTime)).longValue()) * 1000;
currencyPeriod = Long.parseLong(expTime) * 1000;
if (currencyPeriod < 0) {
/* if currencyTimeLimit is -1 then value is never cached */
returnCachedValue = false;
@ -580,7 +580,7 @@ public class RequiredModelMBean
if (tStamp == null)
tStamp = "0";
long lastTime = (new Long(tStamp)).longValue();
long lastTime = Long.parseLong(tStamp);
if (tracing) {
MODELMBEAN_LOGGER.logp(Level.FINER,

View File

@ -125,7 +125,7 @@ import com.sun.naming.internal.ResourceManager;
* @see Context
* @see NamingManager#setInitialContextFactoryBuilder
* NamingManager.setInitialContextFactoryBuilder
* @since JNDI 1.1 / Java 2 Platform, Standard Edition, v 1.3
* @since 1.3, JNDI 1.1
*/
public class InitialContext implements Context {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2014, 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
@ -142,7 +142,9 @@ public final class Subject implements java.io.Serializable {
* <p> The newly constructed Sets check whether this {@code Subject}
* has been set read-only before permitting subsequent modifications.
* The newly created Sets also prevent illegal modifications
* by ensuring that callers have sufficient permissions.
* by ensuring that callers have sufficient permissions. These Sets
* also prohibit null elements, and attempts to add or query a null
* element will result in a {@code NullPointerException}.
*
* <p> To modify the Principals Set, the caller must have
* {@code AuthPermission("modifyPrincipals")}.
@ -170,7 +172,9 @@ public final class Subject implements java.io.Serializable {
* These newly created Sets check whether this {@code Subject}
* has been set read-only before permitting subsequent modifications.
* The newly created Sets also prevent illegal modifications
* by ensuring that callers have sufficient permissions.
* by ensuring that callers have sufficient permissions. These Sets
* also prohibit null elements, and attempts to add or query a null
* element will result in a {@code NullPointerException}.
*
* <p> To modify the Principals Set, the caller must have
* {@code AuthPermission("modifyPrincipals")}.
@ -194,17 +198,16 @@ public final class Subject implements java.io.Serializable {
*
* @exception NullPointerException if the specified
* {@code principals}, {@code pubCredentials},
* or {@code privCredentials} are {@code null}.
* or {@code privCredentials} are {@code null},
* or a null value exists within any of these three
* Sets.
*/
public Subject(boolean readOnly, Set<? extends Principal> principals,
Set<?> pubCredentials, Set<?> privCredentials)
{
if (principals == null ||
pubCredentials == null ||
privCredentials == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid.null.input.s."));
collectionNullClean(principals);
collectionNullClean(pubCredentials);
collectionNullClean(privCredentials);
this.principals = Collections.synchronizedSet(new SecureSet<Principal>
(this, PRINCIPAL_SET, principals));
@ -287,18 +290,17 @@ public final class Subject implements java.io.Serializable {
sm.checkPermission(AuthPermissionHolder.GET_SUBJECT_PERMISSION);
}
if (acc == null) {
throw new NullPointerException(ResourcesMgr.getString
Objects.requireNonNull(acc, ResourcesMgr.getString
("invalid.null.AccessControlContext.provided"));
}
// return the Subject from the DomainCombiner of the provided context
return AccessController.doPrivileged
(new java.security.PrivilegedAction<Subject>() {
public Subject run() {
DomainCombiner dc = acc.getDomainCombiner();
if (!(dc instanceof SubjectDomainCombiner))
if (!(dc instanceof SubjectDomainCombiner)) {
return null;
}
SubjectDomainCombiner sdc = (SubjectDomainCombiner)dc;
return sdc.getSubject();
}
@ -347,9 +349,9 @@ public final class Subject implements java.io.Serializable {
if (sm != null) {
sm.checkPermission(AuthPermissionHolder.DO_AS_PERMISSION);
}
if (action == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid.null.action.provided"));
Objects.requireNonNull(action,
ResourcesMgr.getString("invalid.null.action.provided"));
// set up the new Subject-based AccessControlContext
// for doPrivileged
@ -410,9 +412,8 @@ public final class Subject implements java.io.Serializable {
sm.checkPermission(AuthPermissionHolder.DO_AS_PERMISSION);
}
if (action == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid.null.action.provided"));
Objects.requireNonNull(action,
ResourcesMgr.getString("invalid.null.action.provided"));
// set up the new Subject-based AccessControlContext for doPrivileged
final AccessControlContext currentAcc = AccessController.getContext();
@ -467,9 +468,8 @@ public final class Subject implements java.io.Serializable {
sm.checkPermission(AuthPermissionHolder.DO_AS_PRIVILEGED_PERMISSION);
}
if (action == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid.null.action.provided"));
Objects.requireNonNull(action,
ResourcesMgr.getString("invalid.null.action.provided"));
// set up the new Subject-based AccessControlContext
// for doPrivileged
@ -534,9 +534,8 @@ public final class Subject implements java.io.Serializable {
sm.checkPermission(AuthPermissionHolder.DO_AS_PRIVILEGED_PERMISSION);
}
if (action == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid.null.action.provided"));
Objects.requireNonNull(action,
ResourcesMgr.getString("invalid.null.action.provided"));
// set up the new Subject-based AccessControlContext for doPrivileged
final AccessControlContext callerAcc =
@ -557,13 +556,14 @@ public final class Subject implements java.io.Serializable {
return java.security.AccessController.doPrivileged
(new java.security.PrivilegedAction<AccessControlContext>() {
public AccessControlContext run() {
if (subject == null)
if (subject == null) {
return new AccessControlContext(acc, null);
else
} else {
return new AccessControlContext
(acc,
new SubjectDomainCombiner(subject));
}
}
});
}
@ -615,9 +615,8 @@ public final class Subject implements java.io.Serializable {
*/
public <T extends Principal> Set<T> getPrincipals(Class<T> c) {
if (c == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid.null.Class.provided"));
Objects.requireNonNull(c,
ResourcesMgr.getString("invalid.null.Class.provided"));
// always return an empty Set instead of null
// so LoginModules can add to the Set if necessary
@ -711,9 +710,8 @@ public final class Subject implements java.io.Serializable {
*/
public <T> Set<T> getPublicCredentials(Class<T> c) {
if (c == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid.null.Class.provided"));
Objects.requireNonNull(c,
ResourcesMgr.getString("invalid.null.Class.provided"));
// always return an empty Set instead of null
// so LoginModules can add to the Set if necessary
@ -758,9 +756,8 @@ public final class Subject implements java.io.Serializable {
// would do is protect the set operations themselves
// (like size()), which don't seem security-sensitive.
if (c == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid.null.Class.provided"));
Objects.requireNonNull(c,
ResourcesMgr.getString("invalid.null.Class.provided"));
// always return an empty Set instead of null
// so LoginModules can add to the Set if necessary
@ -790,11 +787,13 @@ public final class Subject implements java.io.Serializable {
*/
public boolean equals(Object o) {
if (o == null)
if (o == null) {
return false;
}
if (this == o)
if (this == o) {
return true;
}
if (o instanceof Subject) {
@ -969,11 +968,10 @@ public final class Subject implements java.io.Serializable {
Set<Principal> inputPrincs = (Set<Principal>)gf.get("principals", null);
Objects.requireNonNull(inputPrincs,
ResourcesMgr.getString("invalid.null.input.s."));
// Rewrap the principals into a SecureSet
if (inputPrincs == null) {
throw new NullPointerException
(ResourcesMgr.getString("invalid.null.input.s."));
}
try {
principals = Collections.synchronizedSet(new SecureSet<Principal>
(this, PRINCIPAL_SET, inputPrincs));
@ -992,14 +990,44 @@ public final class Subject implements java.io.Serializable {
(new SecureSet<Object>(this, PRIV_CREDENTIAL_SET));
}
/**
* Tests for null-clean collections (both non-null reference and
* no null elements)
*
* @param coll A {@code Collection} to be tested for null references
*
* @exception NullPointerException if the specified collection is either
* {@code null} or contains a {@code null} element
*/
private static void collectionNullClean(Collection<?> coll) {
boolean hasNullElements = false;
Objects.requireNonNull(coll,
ResourcesMgr.getString("invalid.null.input.s."));
try {
hasNullElements = coll.contains(null);
} catch (NullPointerException npe) {
// A null-hostile collection may choose to throw
// NullPointerException if contains(null) is called on it
// rather than returning false.
// If this happens we know the collection is null-clean.
hasNullElements = false;
} finally {
if (hasNullElements) {
throw new NullPointerException
(ResourcesMgr.getString("invalid.null.input.s."));
}
}
}
/**
* Prevent modifications unless caller has permission.
*
* @serial include
*/
private static class SecureSet<E>
extends AbstractSet<E>
implements java.io.Serializable {
implements Set<E>, java.io.Serializable {
private static final long serialVersionUID = 7911754171111800359L;
@ -1098,6 +1126,9 @@ public final class Subject implements java.io.Serializable {
public boolean add(E o) {
Objects.requireNonNull(o,
ResourcesMgr.getString("invalid.null.input.s."));
if (subject.isReadOnly()) {
throw new IllegalStateException
(ResourcesMgr.getString("Subject.is.read.only"));
@ -1133,12 +1164,16 @@ public final class Subject implements java.io.Serializable {
// check for duplicates
if (!elements.contains(o))
return elements.add(o);
else
else {
return false;
}
}
public boolean remove(Object o) {
Objects.requireNonNull(o,
ResourcesMgr.getString("invalid.null.input.s."));
final Iterator<E> e = iterator();
while (e.hasNext()) {
E next;
@ -1153,12 +1188,7 @@ public final class Subject implements java.io.Serializable {
});
}
if (next == null) {
if (o == null) {
e.remove();
return true;
}
} else if (next.equals(o)) {
if (next.equals(o)) {
e.remove();
return true;
}
@ -1167,6 +1197,10 @@ public final class Subject implements java.io.Serializable {
}
public boolean contains(Object o) {
Objects.requireNonNull(o,
ResourcesMgr.getString("invalid.null.input.s."));
final Iterator<E> e = iterator();
while (e.hasNext()) {
E next;
@ -1194,19 +1228,28 @@ public final class Subject implements java.io.Serializable {
});
}
if (next == null) {
if (o == null) {
return true;
}
} else if (next.equals(o)) {
if (next.equals(o)) {
return true;
}
}
return false;
}
public boolean addAll(Collection<? extends E> c) {
boolean result = false;
collectionNullClean(c);
for (E item : c) {
result |= this.add(item);
}
return result;
}
public boolean removeAll(Collection<?> c) {
Objects.requireNonNull(c);
collectionNullClean(c);
boolean modified = false;
final Iterator<E> e = iterator();
while (e.hasNext()) {
@ -1224,30 +1267,34 @@ public final class Subject implements java.io.Serializable {
Iterator<?> ce = c.iterator();
while (ce.hasNext()) {
Object o = ce.next();
if (next == null) {
if (o == null) {
if (next.equals(ce.next())) {
e.remove();
modified = true;
break;
}
} else if (next.equals(o)) {
e.remove();
modified = true;
break;
}
}
}
return modified;
}
public boolean containsAll(Collection<?> c) {
collectionNullClean(c);
for (Object item : c) {
if (this.contains(item) == false) {
return false;
}
}
return true;
}
public boolean retainAll(Collection<?> c) {
Objects.requireNonNull(c);
collectionNullClean(c);
boolean modified = false;
boolean retain = false;
final Iterator<E> e = iterator();
while (e.hasNext()) {
retain = false;
E next;
if (which != Subject.PRIV_CREDENTIAL_SET) {
next = e.next();
@ -1260,26 +1307,12 @@ public final class Subject implements java.io.Serializable {
});
}
Iterator<?> ce = c.iterator();
while (ce.hasNext()) {
Object o = ce.next();
if (next == null) {
if (o == null) {
retain = true;
break;
}
} else if (next.equals(o)) {
retain = true;
break;
if (c.contains(next) == false) {
e.remove();
modified = true;
}
}
if (!retain) {
e.remove();
retain = false;
modified = true;
}
}
return modified;
}
@ -1301,6 +1334,73 @@ public final class Subject implements java.io.Serializable {
}
}
public boolean isEmpty() {
return elements.isEmpty();
}
public Object[] toArray() {
final Iterator<E> e = iterator();
while (e.hasNext()) {
// The next() method performs a security manager check
// on each element in the SecureSet. If we make it all
// the way through we should be able to simply return
// element's toArray results. Otherwise we'll let
// the SecurityException pass up the call stack.
e.next();
}
return elements.toArray();
}
public <T> T[] toArray(T[] a) {
final Iterator<E> e = iterator();
while (e.hasNext()) {
// The next() method performs a security manager check
// on each element in the SecureSet. If we make it all
// the way through we should be able to simply return
// element's toArray results. Otherwise we'll let
// the SecurityException pass up the call stack.
e.next();
}
return elements.toArray(a);
}
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof Set)) {
return false;
}
Collection<?> c = (Collection<?>) o;
if (c.size() != size()) {
return false;
}
try {
return containsAll(c);
} catch (ClassCastException unused) {
return false;
} catch (NullPointerException unused) {
return false;
}
}
public int hashCode() {
int h = 0;
Iterator<E> i = iterator();
while (i.hasNext()) {
E obj = i.next();
if (obj != null) {
h += obj.hashCode();
}
}
return h;
}
/**
* Writes this object out to a stream (i.e., serializes it).
*
@ -1338,12 +1438,16 @@ public final class Subject implements java.io.Serializable {
which = fields.get("which", 0);
LinkedList<E> tmp = (LinkedList<E>) fields.get("elements", null);
Subject.collectionNullClean(tmp);
if (tmp.getClass() != LinkedList.class) {
elements = new LinkedList<E>(tmp);
} else {
elements = tmp;
}
}
}
/**

View File

@ -458,7 +458,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel implements Serializab
Integer fiveHundred = new Integer(500);
// *** Shared Longs
Long oneThousand = new Long(1000);
Long oneThousand = 1000L;
LazyValue dialogPlain12 = t ->
new FontUIResource(Font.DIALOG, Font.PLAIN, 12);

View File

@ -56,6 +56,9 @@ public class MetalBorders {
static Object NO_BUTTON_ROLLOVER =
new StringUIClientPropertyKey("NoButtonRollover");
/**
* The class represents the 3D border.
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public static class Flush3DBorder extends AbstractBorder implements UIResource{
public void paintBorder(Component c, Graphics g, int x, int y,
@ -73,9 +76,15 @@ public class MetalBorders {
}
}
/**
* The class represents the border of a {@code JButton}.
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public static class ButtonBorder extends AbstractBorder implements UIResource {
/**
* The border insets.
*/
protected static Insets borderInsets = new Insets( 3, 3, 3, 3 );
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
@ -188,6 +197,9 @@ public class MetalBorders {
}
}
/**
* The class represents the border of a {@code JInternalFrame}.
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public static class InternalFrameBorder extends AbstractBorder implements UIResource {
private static final int corner = 14;
@ -470,6 +482,9 @@ public class MetalBorders {
}
}
/**
* The class represents the border of an option dialog.
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public static class OptionDialogBorder extends AbstractBorder implements UIResource {
int titleHeight = 0;
@ -532,8 +547,15 @@ public class MetalBorders {
}
}
/**
* The class represents the border of a {@code JMenuBar}.
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public static class MenuBarBorder extends AbstractBorder implements UIResource {
/**
* The border insets.
*/
protected static Insets borderInsets = new Insets( 1, 0, 1, 0 );
public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) {
@ -569,8 +591,15 @@ public class MetalBorders {
}
}
/**
* The class represents the border of a {@code JMenuItem}.
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public static class MenuItemBorder extends AbstractBorder implements UIResource {
/**
* The border insets.
*/
protected static Insets borderInsets = new Insets( 2, 2, 2, 2 );
public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) {
@ -617,8 +646,15 @@ public class MetalBorders {
}
}
/**
* The class represents the border of a {@code JPopupMenu}.
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public static class PopupMenuBorder extends AbstractBorder implements UIResource {
/**
* The border insets.
*/
protected static Insets borderInsets = new Insets( 3, 1, 2, 1 );
public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) {
@ -642,6 +678,9 @@ public class MetalBorders {
}
}
/**
* The class represents the border of a rollover {@code Button}.
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public static class RolloverButtonBorder extends ButtonBorder {
@ -693,9 +732,15 @@ public class MetalBorders {
}
}
/**
* The class represents the border of a {@code JToolBar}.
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public static class ToolBarBorder extends AbstractBorder implements UIResource, SwingConstants
{
/**
* The instance of {@code MetalBumps}.
*/
protected MetalBumps bumps = new MetalBumps( 10, 10,
MetalLookAndFeel.getControlHighlight(),
MetalLookAndFeel.getControlDarkShadow(),
@ -779,7 +824,9 @@ public class MetalBorders {
private static Border buttonBorder;
/**
* Returns a border instance for a JButton
* Returns a border instance for a {@code JButton}.
*
* @return a border instance for a {@code JButton}
* @since 1.3
*/
public static Border getButtonBorder() {
@ -794,7 +841,9 @@ public class MetalBorders {
private static Border textBorder;
/**
* Returns a border instance for a text component
* Returns a border instance for a text component.
*
* @return a border instance for a text component
* @since 1.3
*/
public static Border getTextBorder() {
@ -809,7 +858,9 @@ public class MetalBorders {
private static Border textFieldBorder;
/**
* Returns a border instance for a JTextField
* Returns a border instance for a {@code JTextField}.
*
* @return a border instance for a {@code JTextField}
* @since 1.3
*/
public static Border getTextFieldBorder() {
@ -821,6 +872,9 @@ public class MetalBorders {
return textFieldBorder;
}
/**
* The class represents the border of a {@code JTestField}.
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public static class TextFieldBorder extends Flush3DBorder {
@ -846,6 +900,9 @@ public class MetalBorders {
}
}
/**
* The class represents the border of a {@code JScrollPane}.
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public static class ScrollPaneBorder extends AbstractBorder implements UIResource {
public void paintBorder(Component c, Graphics g, int x, int y,
@ -892,7 +949,9 @@ public class MetalBorders {
private static Border toggleButtonBorder;
/**
* Returns a border instance for a JToggleButton
* Returns a border instance for a {@code JToggleButton}.
*
* @return a border instance for a {@code JToggleButton}
* @since 1.3
*/
public static Border getToggleButtonBorder() {
@ -942,6 +1001,10 @@ public class MetalBorders {
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public static class TableHeaderBorder extends javax.swing.border.AbstractBorder {
/**
* The border insets.
*/
protected Insets editorBorderInsets = new Insets( 2, 2, 2, 0 );
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
@ -964,7 +1027,9 @@ public class MetalBorders {
}
/**
* Returns a border instance for a Desktop Icon
* Returns a border instance for a Desktop Icon.
*
* @return a border instance for a Desktop Icon
* @since 1.3
*/
public static Border getDesktopIconBorder() {

View File

@ -52,10 +52,22 @@ import javax.swing.plaf.*;
*/
@SuppressWarnings("serial") // Same-version serialization only
public class MetalButtonUI extends BasicButtonUI {
// NOTE: These are not really needed, but at this point we can't pull
// them. Their values are updated purely for historical reasons.
/**
* The color of the focused button.
*/
protected Color focusColor;
/**
* The color of the selected button.
*/
protected Color selectColor;
/**
* The color of the disabled color.
*/
protected Color disabledTextColor;
private static final Object METAL_BUTTON_UI_KEY = new Object();
@ -63,6 +75,13 @@ public class MetalButtonUI extends BasicButtonUI {
// ********************************
// Create PLAF
// ********************************
/**
* Returns an instance of {@code MetalButtonUI}.
*
* @param c a component
* @return an instance of {@code MetalButtonUI}
*/
public static ComponentUI createUI(JComponent c) {
AppContext appContext = AppContext.getAppContext();
MetalButtonUI metalButtonUI =
@ -96,17 +115,33 @@ public class MetalButtonUI extends BasicButtonUI {
// ********************************
// Default Accessors
// ********************************
/**
* Returns the color of the selected button.
*
* @return the color of the selected button
*/
protected Color getSelectColor() {
selectColor = UIManager.getColor(getPropertyPrefix() + "select");
return selectColor;
}
/**
* Returns the color of a disabled text.
*
* @return the color of a disabled text
*/
protected Color getDisabledTextColor() {
disabledTextColor = UIManager.getColor(getPropertyPrefix() +
"disabledText");
return disabledTextColor;
}
/**
* Returns the color of the focused button.
*
* @return the color of the focused button
*/
protected Color getFocusColor() {
focusColor = UIManager.getColor(getPropertyPrefix() + "focus");
return focusColor;

View File

@ -49,6 +49,11 @@ import javax.swing.plaf.*;
@SuppressWarnings("serial") // Same-version serialization only
public class MetalCheckBoxIcon implements Icon, UIResource, Serializable {
/**
* Returns the size of the control.
*
* @return the size of the control
*/
protected int getControlSize() { return 13; }
public void paintIcon(Component c, Graphics g, int x, int y) {
@ -91,6 +96,14 @@ public class MetalCheckBoxIcon implements Icon, UIResource, Serializable {
}
}
/**
* Paints {@code MetalCheckBoxIcon}.
*
* @param c a component
* @param g an instance of {@code Graphics}
* @param x an X coordinate
* @param y an Y coordinate
*/
protected void drawCheck(Component c, Graphics g, int x, int y) {
int controlSize = getControlSize();
g.fillRect( x+3, y+5, 2, controlSize-8 );

View File

@ -67,6 +67,13 @@ public class MetalCheckBoxUI extends MetalRadioButtonUI {
// ********************************
// Create PlAF
// ********************************
/**
* Returns an instance of {@code MetalCheckBoxUI}.
*
* @param b a component
* @return a new instance of {@code MetalCheckBoxUI}
*/
public static ComponentUI createUI(JComponent b) {
AppContext appContext = AppContext.getAppContext();
MetalCheckBoxUI checkboxUI =

View File

@ -50,19 +50,72 @@ import java.io.Serializable;
*/
@SuppressWarnings("serial") // Same-version serialization only
public class MetalComboBoxButton extends JButton {
/**
* The instance of {@code JComboBox}.
*/
protected JComboBox comboBox;
/**
* The instance of {@code JList}.
*/
protected JList listBox;
/**
* The instance of {@code CellRendererPane}.
*/
protected CellRendererPane rendererPane;
/**
* The icon.
*/
protected Icon comboIcon;
/**
* The {@code iconOnly} value.
*/
protected boolean iconOnly = false;
/**
* Returns the {@code JComboBox}.
*
* @return the {@code JComboBox}
*/
public final JComboBox getComboBox() { return comboBox;}
/**
* Sets the {@code JComboBox}.
*
* @param cb the {@code JComboBox}
*/
public final void setComboBox( JComboBox cb ) { comboBox = cb;}
/**
* Returns the icon of the {@code JComboBox}.
*
* @return the icon of the {@code JComboBox}
*/
public final Icon getComboIcon() { return comboIcon;}
/**
* Sets the icon of the {@code JComboBox}.
*
* @param i the icon of the {@code JComboBox}
*/
public final void setComboIcon( Icon i ) { comboIcon = i;}
/**
* Returns the {@code isIconOnly} value.
*
* @return the {@code isIconOnly} value
*/
public final boolean isIconOnly() { return iconOnly;}
/**
* If {@code isIconOnly} is {@code true} then only icon is painted.
*
* @param isIconOnly if {@code true} then only icon is painted
*/
public final void setIconOnly( boolean isIconOnly ) { iconOnly = isIconOnly;}
MetalComboBoxButton() {
@ -75,6 +128,14 @@ public class MetalComboBoxButton extends JButton {
setModel( model );
}
/**
* Constructs a new instance of {@code MetalComboBoxButton}.
*
* @param cb an instance of {@code JComboBox}
* @param i an icon
* @param pane an instance of {@code CellRendererPane}
* @param list an instance of {@code JList}
*/
public MetalComboBoxButton( JComboBox cb, Icon i,
CellRendererPane pane, JList list ) {
this();
@ -85,6 +146,15 @@ public class MetalComboBoxButton extends JButton {
setEnabled( comboBox.isEnabled() );
}
/**
* Constructs a new instance of {@code MetalComboBoxButton}.
*
* @param cb an instance of {@code JComboBox}
* @param i an icon
* @param onlyIcon if {@code true} only icon is painted
* @param pane an instance of {@code CellRendererPane}
* @param list an instance of {@code JList}
*/
public MetalComboBoxButton( JComboBox cb, Icon i, boolean onlyIcon,
CellRendererPane pane, JList list ) {
this( cb, i, pane, list );

View File

@ -50,6 +50,9 @@ import javax.swing.plaf.basic.BasicComboBoxEditor;
@SuppressWarnings("serial") // Same-version serialization only
public class MetalComboBoxEditor extends BasicComboBoxEditor {
/**
* Constructs a new instance of {@code MetalComboBoxEditor}.
*/
public MetalComboBoxEditor() {
super();
//editor.removeFocusListener(this);

View File

@ -54,6 +54,12 @@ import java.beans.*;
@SuppressWarnings("serial") // Same-version serialization only
public class MetalComboBoxUI extends BasicComboBoxUI {
/**
* Constructs an instance of {@code MetalComboBoxUI}.
*
* @param c a component
* @return an instance of {@code MetalComboBoxUI}
*/
public static ComponentUI createUI(JComponent c) {
return new MetalComboBoxUI();
}
@ -234,6 +240,7 @@ public class MetalComboBoxUI extends BasicComboBoxUI {
* override. All the functionality of this method is in the
* MetalPropertyChangeListener.
*
* @param e an instance of {@code PropertyChangeEvent}
* @deprecated As of Java 2 platform v1.4.
*/
@Deprecated
@ -251,11 +258,23 @@ public class MetalComboBoxUI extends BasicComboBoxUI {
public void layoutContainer( Container parent ) {
layoutComboBox( parent, this );
}
/**
* Lays out the parent container.
*
* @param parent a container
*/
public void superLayout( Container parent ) {
super.layoutContainer( parent );
}
}
/**
* Lays out the {@code JComboBox} in the {@code parent} container.
*
* @param parent a container
* @param manager an instance of {@code MetalComboBoxLayoutManager}
*/
// This is here because of a bug in the compiler.
// When a protected-inner-class-savvy compiler comes out we
// should move this into MetalComboBoxLayoutManager.
@ -367,6 +386,11 @@ public class MetalComboBoxUI extends BasicComboBoxUI {
@Deprecated
public class MetalComboPopup extends BasicComboPopup {
/**
* Constructs a new instance of {@code MetalComboPopup}.
*
* @param cBox an instance of {@code JComboBox}
*/
public MetalComboPopup( JComboBox cBox) {
super( cBox );
}

View File

@ -48,10 +48,19 @@ public class MetalDesktopIconUI extends BasicDesktopIconUI
TitleListener titleListener;
private int width;
/**
* Constructs a new instance of {@code MetalDesktopIconUI}.
*
* @param c a component
* @return a new instance of {@code MetalDesktopIconUI}
*/
public static ComponentUI createUI(JComponent c) {
return new MetalDesktopIconUI();
}
/**
* Constructs a new instance of {@code MetalDesktopIconUI}.
*/
public MetalDesktopIconUI() {
}

View File

@ -138,13 +138,21 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
}
}
//
// ComponentUI Interface Implementation methods
//
/**
* Constructs a new instance of {@code MetalFileChooserUI}.
*
* @param c a component
* @return a new instance of {@code MetalFileChooserUI}
*/
public static ComponentUI createUI(JComponent c) {
return new MetalFileChooserUI((JFileChooser) c);
}
/**
* Constructs a new instance of {@code MetalFileChooserUI}.
*
* @param filechooser a {@code JFileChooser}
*/
public MetalFileChooserUI(JFileChooser filechooser) {
super(filechooser);
}
@ -446,6 +454,11 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
groupLabels(new AlignedLabel[] { fileNameLabel, filesOfTypeLabel });
}
/**
* Returns the button panel.
*
* @return the button panel
*/
protected JPanel getButtonPanel() {
if (buttonPanel == null) {
buttonPanel = new JPanel();
@ -453,6 +466,11 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
return buttonPanel;
}
/**
* Returns the bottom panel.
*
* @return the bottom panel
*/
protected JPanel getBottomPanel() {
if(bottomPanel == null) {
bottomPanel = new JPanel();
@ -503,20 +521,42 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
SwingUtilities.replaceUIActionMap(fc, actionMap);
}
/**
* Returns an instance of {@code ActionMap}.
*
* @return an instance of {@code ActionMap}
*/
protected ActionMap getActionMap() {
return createActionMap();
}
/**
* Constructs an instance of {@code ActionMap}.
*
* @return an instance of {@code ActionMap}
*/
protected ActionMap createActionMap() {
ActionMap map = new ActionMapUIResource();
FilePane.addActionsToMap(map, filePane.getActions());
return map;
}
/**
* Constructs a details view.
*
* @param fc a {@code JFileChooser}
* @return the list
*/
protected JPanel createList(JFileChooser fc) {
return filePane.createList();
}
/**
* Constructs a details view.
*
* @param fc a {@code JFileChooser}
* @return the details view
*/
protected JPanel createDetailsView(JFileChooser fc) {
return filePane.createDetailsView();
}
@ -533,7 +573,12 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
// Obsolete class, not used in this version.
protected class SingleClickListener extends MouseAdapter {
public SingleClickListener(JList list) {
/**
* Constructs an instance of {@code SingleClickListener}.
*
* @param list an instance of {@code JList}
*/
public SingleClickListener(JList list) {
}
}
@ -788,11 +833,16 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
};
}
/**
* Removes control buttons from bottom panel.
*/
protected void removeControlButtons() {
getBottomPanel().remove(getButtonPanel());
}
/**
* Adds control buttons to bottom panel.
*/
protected void addControlButtons() {
getBottomPanel().add(getButtonPanel());
}
@ -842,15 +892,31 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
}
}
/**
* Returns the directory name.
*
* @return the directory name
*/
public String getDirectoryName() {
// PENDING(jeff) - get the name from the directory combobox
return null;
}
/**
* Sets the directory name.
*
* @param dirname the directory name
*/
public void setDirectoryName(String dirname) {
// PENDING(jeff) - set the name in the directory combobox
}
/**
* Constructs a new instance of {@code DirectoryComboBoxRenderer}.
*
* @param fc a {@code JFileChooser}
* @return a new instance of {@code DirectoryComboBoxRenderer}
*/
protected DirectoryComboBoxRenderer createDirectoryComboBoxRenderer(JFileChooser fc) {
return new DirectoryComboBoxRenderer();
}
@ -906,9 +972,12 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
}
//
// DataModel for DirectoryComboxbox
//
/**
* Constructs a new instance of {@code DataModel} for {@code DirectoryComboBox}.
*
* @param fc a {@code JFileChooser}
* @return a new instance of {@code DataModel} for {@code DirectoryComboBox}
*/
protected DirectoryComboBoxModel createDirectoryComboBoxModel(JFileChooser fc) {
return new DirectoryComboBoxModel();
}
@ -924,6 +993,9 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
JFileChooser chooser = getFileChooser();
FileSystemView fsv = chooser.getFileSystemView();
/**
* Constructs an instance of {@code DirectoryComboBoxModel}.
*/
public DirectoryComboBoxModel() {
// Add the current directory to the model, and make it the
// selectedDirectory
@ -1017,6 +1089,12 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
}
}
/**
* Returns the depth of {@code i}-th file.
*
* @param i an index
* @return the depth of {@code i}-th file
*/
public int getDepth(int i) {
return (depths != null && i >= 0 && i < depths.length) ? depths[i] : 0;
}
@ -1039,9 +1117,11 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
}
}
//
// Renderer for Types ComboBox
//
/**
* Constructs a {@code Renderer} for types {@code ComboBox}.
*
* @return a {@code Renderer} for types {@code ComboBox}
*/
protected FilterComboBoxRenderer createFilterComboBoxRenderer() {
return new FilterComboBoxRenderer();
}
@ -1065,9 +1145,11 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
}
}
//
// DataModel for Types Comboxbox
//
/**
* Constructs a {@code DataModel} for types {@code ComboBox}.
*
* @return a {@code DataModel} for types {@code ComboBox}
*/
protected FilterComboBoxModel createFilterComboBoxModel() {
return new FilterComboBoxModel();
}
@ -1077,7 +1159,15 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
*/
@SuppressWarnings("serial") // Same-version serialization only
protected class FilterComboBoxModel extends AbstractListModel<Object> implements ComboBoxModel<Object>, PropertyChangeListener {
/**
* An array of file filters.
*/
protected FileFilter[] filters;
/**
* Constructs an instance of {@code FilterComboBoxModel}.
*/
protected FilterComboBoxModel() {
super();
filters = getFileChooser().getChoosableFileFilters();
@ -1142,6 +1232,11 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
}
}
/**
* Invokes when {@code ListSelectionEvent} occurs.
*
* @param e an instance of {@code ListSelectionEvent}
*/
public void valueChanged(ListSelectionEvent e) {
JFileChooser fc = getFileChooser();
File f = fc.getSelectedFile();
@ -1155,6 +1250,10 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
protected class DirectoryComboBoxAction extends AbstractAction {
/**
* Constructs a new instance of {@code DirectoryComboBoxAction}.
*/
protected DirectoryComboBoxAction() {
super("DirectoryComboBoxAction");
}

View File

@ -90,10 +90,22 @@ public class MetalIconFactory implements Serializable {
private static Icon oceanVerticalSliderThumb;
// Constants
/**
* {@code DARK} is used for the property {@code Tree.expandedIcon}.
*/
public static final boolean DARK = false;
/**
* {@code LIGHT} is used for the property {@code Tree.collapsedIcon}.
*/
public static final boolean LIGHT = true;
// Accessor functions for Icons. Does the caching work.
/**
* Returns the instance of {@code FileChooserDetailViewIcon}.
*
* @return the instance of {@code FileChooserDetailViewIcon}
*/
public static Icon getFileChooserDetailViewIcon() {
if (fileChooserDetailViewIcon == null) {
fileChooserDetailViewIcon = new FileChooserDetailViewIcon();
@ -101,6 +113,11 @@ public class MetalIconFactory implements Serializable {
return fileChooserDetailViewIcon;
}
/**
* Returns the instance of {@code FileChooserHomeFolderIcon}.
*
* @return the instance of {@code FileChooserHomeFolderIcon}
*/
public static Icon getFileChooserHomeFolderIcon() {
if (fileChooserHomeFolderIcon == null) {
fileChooserHomeFolderIcon = new FileChooserHomeFolderIcon();
@ -108,6 +125,11 @@ public class MetalIconFactory implements Serializable {
return fileChooserHomeFolderIcon;
}
/**
* Returns the instance of {@code FileChooserListViewIcon}.
*
* @return the instance of {@code FileChooserListViewIcon}
*/
public static Icon getFileChooserListViewIcon() {
if (fileChooserListViewIcon == null) {
fileChooserListViewIcon = new FileChooserListViewIcon();
@ -115,6 +137,11 @@ public class MetalIconFactory implements Serializable {
return fileChooserListViewIcon;
}
/**
* Returns the instance of {@code FileChooserNewFolderIcon}.
*
* @return the instance of {@code FileChooserNewFolderIcon}
*/
public static Icon getFileChooserNewFolderIcon() {
if (fileChooserNewFolderIcon == null) {
fileChooserNewFolderIcon = new FileChooserNewFolderIcon();
@ -122,6 +149,11 @@ public class MetalIconFactory implements Serializable {
return fileChooserNewFolderIcon;
}
/**
* Returns the instance of {@code FileChooserUpFolderIcon}.
*
* @return the instance of {@code FileChooserUpFolderIcon}
*/
public static Icon getFileChooserUpFolderIcon() {
if (fileChooserUpFolderIcon == null) {
fileChooserUpFolderIcon = new FileChooserUpFolderIcon();
@ -129,14 +161,31 @@ public class MetalIconFactory implements Serializable {
return fileChooserUpFolderIcon;
}
/**
* Constructs a new instance of {@code InternalFrameAltMaximizeIcon}.
*
* @param size the size of the icon
* @return a new instance of {@code InternalFrameAltMaximizeIcon}
*/
public static Icon getInternalFrameAltMaximizeIcon(int size) {
return new InternalFrameAltMaximizeIcon(size);
}
/**
* Constructs a new instance of {@code InternalFrameCloseIcon}.
*
* @param size the size of the icon
* @return a new instance of {@code InternalFrameCloseIcon}
*/
public static Icon getInternalFrameCloseIcon(int size) {
return new InternalFrameCloseIcon(size);
}
/**
* Returns the instance of {@code InternalFrameDefaultMenuIcon}.
*
* @return the instance of {@code InternalFrameDefaultMenuIcon}
*/
public static Icon getInternalFrameDefaultMenuIcon() {
if (internalFrameDefaultMenuIcon == null) {
internalFrameDefaultMenuIcon = new InternalFrameDefaultMenuIcon();
@ -144,14 +193,31 @@ public class MetalIconFactory implements Serializable {
return internalFrameDefaultMenuIcon;
}
/**
* Constructs a new instance of {@code InternalFrameMaximizeIcon}.
*
* @param size the size of the icon
* @return a new instance of {@code InternalFrameMaximizeIcon}
*/
public static Icon getInternalFrameMaximizeIcon(int size) {
return new InternalFrameMaximizeIcon(size);
}
/**
* Constructs a new instance of {@code InternalFrameMinimizeIcon}.
*
* @param size the size of the icon
* @return a new instance of {@code InternalFrameMinimizeIcon}
*/
public static Icon getInternalFrameMinimizeIcon(int size) {
return new InternalFrameMinimizeIcon(size);
}
/**
* Returns the instance of {@code RadioButtonIcon}.
*
* @return the instance of {@code RadioButtonIcon}
*/
public static Icon getRadioButtonIcon() {
if (radioButtonIcon == null) {
radioButtonIcon = new RadioButtonIcon();
@ -161,6 +227,8 @@ public class MetalIconFactory implements Serializable {
/**
* Returns a checkbox icon.
*
* @return a checkbox icon
* @since 1.3
*/
public static Icon getCheckBoxIcon() {
@ -170,6 +238,11 @@ public class MetalIconFactory implements Serializable {
return checkBoxIcon;
}
/**
* Returns the instance of {@code TreeComputerIcon}.
*
* @return the instance of {@code TreeComputerIcon}
*/
public static Icon getTreeComputerIcon() {
if ( treeComputerIcon == null ) {
treeComputerIcon = new TreeComputerIcon();
@ -177,6 +250,11 @@ public class MetalIconFactory implements Serializable {
return treeComputerIcon;
}
/**
* Returns the instance of {@code TreeFloppyDriveIcon}.
*
* @return the instance of {@code TreeFloppyDriveIcon}
*/
public static Icon getTreeFloppyDriveIcon() {
if ( treeFloppyDriveIcon == null ) {
treeFloppyDriveIcon = new TreeFloppyDriveIcon();
@ -184,10 +262,20 @@ public class MetalIconFactory implements Serializable {
return treeFloppyDriveIcon;
}
/**
* Constructs a new instance of {@code TreeFolderIcon}.
*
* @return a new instance of {@code TreeFolderIcon}
*/
public static Icon getTreeFolderIcon() {
return new TreeFolderIcon();
}
/**
* Returns the instance of {@code TreeHardDriveIcon}.
*
* @return the instance of {@code TreeHardDriveIcon}
*/
public static Icon getTreeHardDriveIcon() {
if ( treeHardDriveIcon == null ) {
treeHardDriveIcon = new TreeHardDriveIcon();
@ -195,14 +283,30 @@ public class MetalIconFactory implements Serializable {
return treeHardDriveIcon;
}
/**
* Constructs a new instance of {@code TreeLeafIcon}.
*
* @return a new instance of {@code TreeLeafIcon}
*/
public static Icon getTreeLeafIcon() {
return new TreeLeafIcon();
}
/**
* Constructs a new instance of {@code TreeControlIcon}.
*
* @param isCollapsed if {@code true} the icon is collapsed
* @return a new instance of {@code TreeControlIcon}
*/
public static Icon getTreeControlIcon( boolean isCollapsed ) {
return new TreeControlIcon( isCollapsed );
}
/**
* Returns an icon to be used by {@code JMenu}.
*
* @return an icon to be used by {@code JMenu}
*/
public static Icon getMenuArrowIcon() {
if (menuArrowIcon == null) {
menuArrowIcon = new MenuArrowIcon();
@ -220,6 +324,11 @@ public class MetalIconFactory implements Serializable {
return null;
}
/**
* Returns an icon to be used by {@code JMenuItem}.
*
* @return an icon to be used by {@code JMenuItem}
*/
public static Icon getMenuItemArrowIcon() {
if (menuItemArrowIcon == null) {
menuItemArrowIcon = new MenuItemArrowIcon();
@ -227,6 +336,11 @@ public class MetalIconFactory implements Serializable {
return menuItemArrowIcon;
}
/**
* Returns an icon to be used by {@code JCheckBoxMenuItem}.
*
* @return an icon to be used by {@code JCheckBoxMenuItem}
*/
public static Icon getCheckBoxMenuItemIcon() {
if (checkBoxMenuItemIcon == null) {
checkBoxMenuItemIcon = new CheckBoxMenuItemIcon();
@ -234,6 +348,11 @@ public class MetalIconFactory implements Serializable {
return checkBoxMenuItemIcon;
}
/**
* Returns an icon to be used by {@code JRadioButtonMenuItem}.
*
* @return an icon to be used by {@code JRadioButtonMenuItem}
*/
public static Icon getRadioButtonMenuItemIcon() {
if (radioButtonMenuItemIcon == null) {
radioButtonMenuItemIcon = new RadioButtonMenuItemIcon();
@ -241,6 +360,11 @@ public class MetalIconFactory implements Serializable {
return radioButtonMenuItemIcon;
}
/**
* Returns a thumb icon to be used by horizontal slider.
*
* @return a thumb icon to be used by horizontal slider
*/
public static Icon getHorizontalSliderThumbIcon() {
if (MetalLookAndFeel.usingOcean()) {
if (oceanHorizontalSliderThumb == null) {
@ -253,6 +377,11 @@ public class MetalIconFactory implements Serializable {
return new HorizontalSliderThumbIcon();
}
/**
* Returns a thumb icon to be used by vertical slider.
*
* @return a thumb icon to be used by vertical slider
*/
public static Icon getVerticalSliderThumbIcon() {
if (MetalLookAndFeel.usingOcean()) {
if (oceanVerticalSliderThumb == null) {
@ -1621,7 +1750,18 @@ public class MetalIconFactory implements Serializable {
}
/**
* Returns a shift of the icon.
*
* @return a shift of the icon
*/
public int getShift() { return 0; }
/**
* Returns an additional height of the icon.
*
* @return an additional height of the icon
*/
public int getAdditionalHeight() { return 0; }
public int getIconWidth() { return folderIcon16Size.width; }
@ -1719,7 +1859,18 @@ public class MetalIconFactory implements Serializable {
}
/**
* Returns a shift of the icon.
*
* @return a shift of the icon
*/
public int getShift() { return 0; }
/**
* Returns an additional height of the icon.
*
* @return an additional height of the icon
*/
public int getAdditionalHeight() { return 0; }
public int getIconWidth() { return fileIcon16Size.width; }
@ -1727,6 +1878,9 @@ public class MetalIconFactory implements Serializable {
}
/**
* The class represents a tree leaf icon.
*/
public static class TreeLeafIcon extends FileIcon16 {
public int getShift() { return 2; }
public int getAdditionalHeight() { return 4; }
@ -1748,12 +1902,20 @@ public class MetalIconFactory implements Serializable {
*/
@SuppressWarnings("serial") // Same-version serialization only
public static class TreeControlIcon implements Icon, Serializable {
// This data member should not have been exposed. It's called
// isLight, but now it really means isCollapsed. Since we can't change
// any APIs... that's life.
/**
* if {@code true} the icon is collapsed.
* NOTE: This data member should not have been exposed. It's called
* {@code isLight}, but now it really means {@code isCollapsed}.
* Since we can't change any APIs... that's life.
*/
protected boolean isLight;
/**
* Constructs an instance of {@code TreeControlIcon}.
*
* @param isCollapsed if {@code true} the icon is collapsed
*/
public TreeControlIcon( boolean isCollapsed ) {
isLight = isCollapsed;
}
@ -1811,6 +1973,14 @@ public class MetalIconFactory implements Serializable {
}
}
/**
* Paints the {@code TreeControlIcon}.
*
* @param c a component
* @param g an instance of {@code Graphics}
* @param x an X coordinate
* @param y an Y coordinate
*/
public void paintMe(Component c, Graphics g, int x, int y) {
g.setColor( MetalLookAndFeel.getPrimaryControlInfo() );
@ -1823,7 +1993,7 @@ public class MetalIconFactory implements Serializable {
g.drawLine( xoff + 6, 4, xoff + 9, 4 ); // top
g.drawLine( xoff + 10, 5, xoff + 10, 5 ); // top right dot
g.drawLine( xoff + 11, 6, xoff + 11, 9 ); // right
g.drawLine( xoff + 10, 10, xoff + 10, 10 ); // botom right dot
g.drawLine( xoff + 10, 10, xoff + 10, 10 ); // bottom right dot
g.drawLine( xoff + 6, 11, xoff + 9, 11 ); // bottom
g.drawLine( xoff + 5, 10, xoff + 5, 10 ); // bottom left dot

View File

@ -46,8 +46,19 @@ import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
@SuppressWarnings("serial") // Superclass is not serializable across versions
public class MetalInternalFrameTitlePane extends BasicInternalFrameTitlePane {
/**
* The value {@code isPalette}
*/
protected boolean isPalette = false;
/**
* The palette close icon.
*/
protected Icon paletteCloseIcon;
/**
* The height of the palette title.
*/
protected int paletteTitleHeight;
private static final Border handyEmptyBorder = new EmptyBorder(0,0,0,0);
@ -94,6 +105,11 @@ public class MetalInternalFrameTitlePane extends BasicInternalFrameTitlePane {
private Color activeBumpsShadow = MetalLookAndFeel.
getPrimaryControlDarkShadow();
/**
* Constructs a new instance of {@code MetalInternalFrameTitlePane}
*
* @param f an instance of {@code JInternalFrame}
*/
public MetalInternalFrameTitlePane(JInternalFrame f) {
super( f );
}
@ -307,6 +323,11 @@ public class MetalInternalFrameTitlePane extends BasicInternalFrameTitlePane {
}
}
/**
* Paints palette.
*
* @param g a instance of {@code Graphics}
*/
public void paintPalette(Graphics g) {
boolean leftToRight = MetalUtils.isLeftToRight(frame);
@ -471,6 +492,11 @@ public class MetalInternalFrameTitlePane extends BasicInternalFrameTitlePane {
bumps.paintIcon(this, g, bumpXOffset, bumpYOffset);
}
/**
* If {@code b} is {@code true}, sets palette icons.
*
* @param b if {@code true}, sets palette icons
*/
public void setPalette(boolean b) {
isPalette = b;

View File

@ -47,6 +47,9 @@ public class MetalInternalFrameUI extends BasicInternalFrameUI {
private static final Border handyEmptyBorder = new EmptyBorder(0,0,0,0);
/**
* The property {@code JInternalFrame.isPalette}.
*/
protected static String IS_PALETTE = "JInternalFrame.isPalette";
private static String IS_PALETTE_KEY = "JInternalFrame.isPalette";
private static String FRAME_TYPE = "JInternalFrame.frameType";
@ -54,10 +57,22 @@ public class MetalInternalFrameUI extends BasicInternalFrameUI {
private static String PALETTE_FRAME = "palette";
private static String OPTION_DIALOG = "optionDialog";
/**
* Constructs a new {@code MetalInternalFrameUI} instance.
*
* @param b an internal frame
*/
public MetalInternalFrameUI(JInternalFrame b) {
super(b);
}
/**
* Constructs a new {@code MetalInternalFrameUI} instance.
*
* @param c a component
* @return a new {@code MetalInternalFrameUI} instance
*/
public static ComponentUI createUI(JComponent c) {
return new MetalInternalFrameUI( (JInternalFrame) c);
}
@ -152,6 +167,11 @@ public class MetalInternalFrameUI extends BasicInternalFrameUI {
}
}
/**
* If {@code isPalette} is {@code true}, sets palette border and title
*
* @param isPalette if {@code true}, sets palette border and title
*/
// this should be deprecated - jcs
public void setPalette(boolean isPalette) {
if (isPalette) {

View File

@ -56,6 +56,12 @@ public class MetalLabelUI extends BasicLabelUI
private static final Object METAL_LABEL_UI_KEY = new Object();
/**
* Returns an instance of {@code MetalLabelUI}.
*
* @param c a component
* @return an instance of {@code MetalLabelUI}
*/
public static ComponentUI createUI(JComponent c) {
if (System.getSecurityManager() != null) {
AppContext appContext = AppContext.getAppContext();

Some files were not shown because too many files have changed in this diff Show More