📄 changes
字号:
removed them in 1.1.1. Being convenience methods, they are not
essential, and alternate coding is simple.
To be more specific, the ResourceBundle class in JDK 1.1
included the two methods:
public final Menu getMenu(String key)
throws MissingResourceException {
return (Menu) getObject(key);
}
public final MenuBar getMenuBar(String key)
throws MissingResourceException {
return (MenuBar) getObject(key);
}
These "convenience" methods saved the user from having to
explicitly cast objects in a ResourceBundle that happened to
be of type Menu or MenuBar, such as:
(Menu)rb.getObject(key)
The side effect was that by returning types Menu and MenuBar, this
class referred to the awt package. ResourceBundle is a relatively
low level piece of the core however while AWT is a relatively high
level piece. This dependency caused a number of problems. Most
notably it did not allow a Java runtime environment to be created
that omitted the AWT package (such as in a server).
Removing this dependency on AWT required removing these APIs
completely from ResourceBundle. This change, of course, breaks
code that calls these methods. The upside is that these two APIs
were of very little marginal value. They simply saved the user
the effort of typing an explicit cast. Furthermore, since these
two methods were new at 1.1, they have not been available for
very long.
_____________________
AWT COMPONENT BUG FIX - Changed the field java.awt.Component.locale
from protected to private.
The locale field is accessible through getLocale() and
setLocale() methods, and all code should be using those.
This change is necessary to support future development of
the lightweight framework.
________________________
AWT DATATRANSFER BUG FIX - Corrected the MIME type for DataFlavor.
[Bug 4037854]
In JDK 1.1, java.awt.datatransfer.DataFlavor used the wrong MIME
type. DataFlavor claimed that the MIME type for a java
serialized object was:
application/x-javaserializedobject
This name is inconsistent with other existing names and common
conventions. The name has been corrected by adding hypens to it,
as follows:
application/x-java-serialized-object
This makes it consistent with:
application/java-vm
application/x-java-vm
application/x-java-archive
____________
FONT CHANGES - Times, Helvetica, and Courier are now mapped to
Latin1 characters.
Times, Helvetica, and Courier fonts are no longer mapped to
non-Latin1 classes of fonts, such as Symbol or ZapfDingabats.
These three fonts are now mapped to Latin1 characters, just like
they were in version 1.0.
If you want to have non-Latin1 characters, you must map fonts
such as Symbol and ZapfDingabats to the Java virtual fonts. These
virtual font classes are Serif, Sans-serif, Monospaced, Dialog,
and DialogInput.
===================================================================
Changes from JDK 1.1beta3 to JDK 1.1_Final
-------------------------------------------------------------------
The following changes and bug fixes are in the JDK 1.1 final release.
______________
VERSION NUMBER - The version number for this release is "JDK1.1_Final".
Throughout the documentation we call it simply "JDK1.1"
____________
TEXT CHANGES - Extensive surface changes to Text package
The following extensive changes in the Text package are the
result of a design review recently carried out to
simplify, rationalize and properly abstract the
internationalization API. We realized this would
make a significant improvement in learning and using
internationalization in Java.
The changes involve mostly surface changes, such as
renaming and moving API, and changing the order of arguments,
to better conform with conventions established with the rest
of Java.
____________
TEXT CHANGES - CharacterIterator
Removed getText method. CharacterIterators are intended to allow
character
at a time access to text without exposing how the text is actually
stored.
It is expected that some CharacterIterators will operate on text
that can
not easily or efficiently be stored as a String. Accessing the text
as a
whole should be the responsibility of the text object.
Rename startIndex to getBeginIndex and rename endIndex to
getEndIndex. This is to follow established naming patterns for
getters and
setters as well as java.lang.String's convention for identifying
ranges in
text.
____________
TEXT CHANGES - ChoiceFormat
Changed the constructor to take an array of Strings rather than an
array
of Objects. String were the only type that made sense in this
context.
Changed the setChoices method to take an array of Strings rather
than an
array of Objects. String were the only type that made sense in
this
context.
Added applyPattern and toPattern methods similar to the methods on
other
Format classes.
Changed the format methods to take a FieldPosition rather than a
FormatStatus argument. See the change description for FormatStatus.
Changed the parse method to take a ParsePosition rather than a
ParseStatus
argument. See the change description for ParseStatus.
Added clone, hashCode and equals methods. These are standard
overrides
and do not change the semantics.
____________
TEXT CHANGES - Collation
Renamed class "Collator". It was not clear from the old name
whether this
class actually did collation or simply represented a set of
collation
rules. The new name makes it clear that the class performs string
comparisons.
Removed the constants LESS, EQUAL and GREATER. Changed the compare
methods
to return the int value -1, 0 or 1 instead of LESS, EQUAL or
GREATER. This
follows the pattern used by the java.lang.String.compareTo method.
Removed the greater and greaterOrEqual methods. The same
information is
provided by the compare method. Having only a compare and and
equals
method mimics the comparison API provided by java.lang.String.
Removed the compare(String, int, int, String, int, int) version of
the
compare method and the getSortKey(String, int, int) version of the
getSortKey method. A recent change to String.substring makes the
substring
operation efficient. Users can use String.substring to specify a
substring
rather than requiring methods to provide substring variants.
Slimming the
API makes it easier to learn.
Changed the type of public constants from byte to int. Changed the
getStrength and getDecomposition methods to return int instead of
byte.
Changed the setStrength and setDecomposition methods to accept int
arguments instead of byte. Although the byte type provides a small
amount
of type safety, using ints for constants is more in keeping with
the rest
of the JDK. The affected constants are:
byte PRIMARY = 0; ==> int PRIMARY = 0;
byte SECONDARY = 1; ==> int SECONDARY = 1;
byte TERTIARY = 2; ==> int TERTIARY = 2;
byte IDENTICAL = 3; ==> int IDENTICAL = 3;
byte NO_DECOMPOSITION = 0; ==> int NO_DECOMPOSITION = 0;
byte CANONICAL_DECOMPOSITION = 1; ==> int
CANONICAL_DECOMPOSITION = 1;
byte FULL_DECOMPOSITION = 2; ==> int FULL_DECOMPOSITION =
2;
Removed the getDisplayName methods. These returned the same result
as
the corresponding Locale.getDisplayName method calls. Until we
have more
useful data, its better not to have these methods in the API.
Provided a concrete equals method. This allows sub-classes to
correctly
implement the equals method.
Renamed getSortKey method to getCollationKey. See the change
description
for getSortKey.
Renamed getDefault methods to getInstance. This follows new naming
pattern
for factory methods.
____________
TEXT CHANGES - CollatedString
Removed this class. Its purpose was to associate a String with its
CollationKey. CollationKey has been changed retain a reference to
the
String it was generated from. This allows us to reduce the size of
the
API.
____________
TEXT CHANGES - CollationElementIterator
Removed the public constructor. CollationElementIterators are
created by
RuleBasedCollator objects. This was expressed by handing a
RuleBasedCollator object to the constructor. This connection is
more
obvious if the CollationElementIterator can only be created by a
factory
method on RuleBasedCollator.
Made the values returned by the next method directly comparable.
This is
not an API change but a semantic change for the next method.
____________
TEXT CHANGES - DateFormat
Made the constructor protected. DateFormat is an abstract class so
it
doesn't need a public constructor.
Removed the getDisplayName methods. These returned the same result
as
the corresponding Locale.getDisplayName method calls. Until we
have more
useful data, its better not to have these methods in the API.
Added a style called MEDIUM that does what DEFAULT does now. For
this
release, MEDIUM and DEFAULT have the same effect. In future, the
meaning
of DEFAULT will be determined from the locale data. This is a more
logical organization of the style choices.
Changed the format methods to take a FieldPosition rather than a
FormatStatus argument. See the change description for FormatStatus.
Changed the parse and parseObject methods to take a ParsePosition
rather
than a ParseStatus argument. See the change description for
ParseStatus.
Renamed the getTimeFormat methods to getTimeInstance. Renamed the
getDateFormat methods to getDateInstance. Renamed the
getDateTimeFormat
methods to getDateTimeInstance. This follows new naming pattern
for factory methods.
Added a getInstance() factory method that does the same thing as
getDateTimeFormat(SHORT,SHORT) previously did. This follows the
pattern
for factories which provides for a getInstance() that returns a
default
value to be always available.
Renamed getValidationMode to isLenient. Renamed setValidationMode
to
setLenient. These names are more descriptive.
Change the type of public constants from byte to int. Although the
byte
type provides a small amount of type safety, using ints for
constants is
more in keeping with the rest of the JDK. Also rename constants to
follow
the naming convention uses by JDK. The results are:
byte ERA_FIELD = 0; ==> int ERA_FIELD = 0;
byte YEAR_FIELD = 1; ==> int YEAR_FIELD = 1;
byte MONTH_FIELD = 2; ==> int MONTH_FIELD = 2;
byte DATE_FIELD = 3; ==> int DATE_FIELD = 3;
byte HOUROFDAY1_FIELD = 4; ==> int HOUR_OF_DAY1_FIELD = 4;
byte HOUROFDAY0_FIELD = 5; ==> int HOUR_OF_DAY0_FIELD = 5;
byte MINUTE_FIELD = 6; ==> int MINUTE_FIELD = 6;
byte SECOND_FIELD = 7; ==> int SECOND_FIELD = 7;
byte MILLISECOND_FIELD = 8; ==> int MILLISECOND_FIELD = 8;
byte DAYOFWEEK_FIELD = 9; ==> int DAY_OF_WEEK_FIELD = 9;
byte DAYOFYEAR_FIELD = 10; ==> int DAY_OF_YEAR_FIELD = 10;
byte DAYOFWEEKINMONTH_FIELD = 11; ==> int
DAY_OF_WEEK_IN_MONTH_FIELD = 11;
byte WEEKOFYEAR_FIELD = 12; ==> int WEEK_OF_YEAR_FIELD = 12;
byte WEEKOFMONTH_FIELD = 13; ==> int WEEK_OF_MONTH_FIELD =
13;
byte AMPM_FIELD = 14; ==> int AM_PM_FIELD = 14;
byte HOUR1_FIELD = 15; ==> int HOUR1_FIELD = 15;
byte HOUR0_FIELD = 16; ==> int HOUR0_FIELD = 16;
byte TIMEZONE_FIELD = 17; ==> int TIMEZONE_FIELD = 17;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -