8154213: clean up uses of boxed primitive constructors in the java.desktop module

Reviewed-by: serb, psadhukhan
This commit is contained in:
Phil Race 2016-04-25 15:09:45 -07:00
parent d21da4cef9
commit 3f778b5b22
31 changed files with 102 additions and 101 deletions

View File

@ -54,13 +54,13 @@ class UIProperty extends UIDefault<String> {
return String.format(" d.put(\"%s%s\", \"%s\");\n",
prefix, getName(), getValue());
case INT:
return String.format(" d.put(\"%s%s\", new Integer(%s));\n",
return String.format(" d.put(\"%s%s\", Integer.valueOf(%s));\n",
prefix, getName(), getValue());
case FLOAT:
return String.format(" d.put(\"%s%s\", new Float(%sf));\n",
return String.format(" d.put(\"%s%s\", Float.valueOf(%sf));\n",
prefix, getName(), getValue());
case DOUBLE:
return String.format(" d.put(\"%s%s\", new Double(%s));\n",
return String.format(" d.put(\"%s%s\", Double.valueOf(%s));\n",
prefix, getName(), getValue());
case COLOR:
return String.format(" addColor(d, \"%s%s\", %s);\n",

View File

@ -83,7 +83,7 @@ class _AppMenuBarHandler {
// if we have no foreground frames, then we have to "kick" the menubar
final JFrame pingFrame = new JFrame();
pingFrame.getRootPane().putClientProperty("Window.alpha", new Float(0.0f));
pingFrame.getRootPane().putClientProperty("Window.alpha", Float.valueOf(0.0f));
pingFrame.setUndecorated(true);
pingFrame.setVisible(true);
pingFrame.toFront();

View File

@ -58,7 +58,7 @@ class AquaComboBoxPopup extends BasicComboPopup {
updateContents(false);
// TODO: CPlatformWindow?
putClientProperty(CPlatformWindow.WINDOW_FADE_OUT, new Integer(150));
putClientProperty(CPlatformWindow.WINDOW_FADE_OUT, Integer.valueOf(150));
}
public void updateContents(final boolean remove) {

View File

@ -91,7 +91,7 @@ public class AquaInternalFramePaneUI extends BasicDesktopPaneUI implements Mouse
JComponent getDock() {
if (fDock == null) {
fDock = new Dock(desktop);
desktop.add(fDock, new Integer(399)); // Just below the DRAG_LAYER
desktop.add(fDock, Integer.valueOf(399)); // Just below the DRAG_LAYER
}
return fDock;
}

View File

@ -416,7 +416,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
"Button.select", selected,
"Button.border",(LazyValue) t -> AquaButtonBorder.getDynamicButtonBorder(),
"Button.font", controlFont,
"Button.textIconGap", new Integer(4),
"Button.textIconGap", Integer.valueOf(4),
"Button.textShiftOffset", zero, // radar 3308129 - aqua doesn't move images when pressed.
"Button.focusInputMap", controlFocusInputMap,
"Button.margin", new InsetsUIResource(0, 2, 0, 2),
@ -635,8 +635,8 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
//"Menu.checkIcon", emptyCheckIcon, // A non-drawing GlyphIcon to make the spacing consistent
"Menu.arrowIcon",(LazyValue) t -> AquaImageFactory.getMenuArrowIcon(),
"Menu.consumesTabs", Boolean.TRUE,
"Menu.menuPopupOffsetY", new Integer(1),
"Menu.submenuPopupOffsetY", new Integer(-4),
"Menu.menuPopupOffsetY", Integer.valueOf(1),
"Menu.submenuPopupOffsetY", Integer.valueOf(-4),
"MenuBar.font", menuFont,
"MenuBar.background", menuBackgroundColor, // not a menu item, not selected
@ -694,7 +694,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
"OptionPane.informationSound", null, // Info and Plain
"OptionPane.questionSound", null,
"OptionPane.warningSound", null,
"OptionPane.buttonClickThreshhold", new Integer(500),
"OptionPane.buttonClickThreshhold", Integer.valueOf(500),
"OptionPane.yesButtonMnemonic", "",
"OptionPane.noButtonMnemonic", "",
"OptionPane.okButtonMnemonic", "",
@ -717,7 +717,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
"PasswordField.caretBlinkRate", textCaretBlinkRate,
"PasswordField.border", textFieldBorder,
"PasswordField.margin", zeroInsets,
"PasswordField.echoChar", new Character((char)0x25CF),
"PasswordField.echoChar", Character.valueOf((char)0x25CF),
"PasswordField.capsLockIconColor", textPasswordFieldCapsLockIconColor,
"PopupMenu.font", menuFont,
@ -736,7 +736,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
"ProgressBar.selectionForeground", black,
"ProgressBar.selectionBackground", white,
"ProgressBar.border", new BorderUIResource(BorderFactory.createEmptyBorder()),
"ProgressBar.repaintInterval", new Integer(20),
"ProgressBar.repaintInterval", Integer.valueOf(20),
"RadioButton.background", controlBackgroundColor,
"RadioButton.foreground", black,
@ -772,7 +772,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
"ScrollBar.border", null,
"ScrollBar.focusInputMap", aquaKeyBindings.getScrollBarInputMap(),
"ScrollBar.focusInputMap.RightToLeft", aquaKeyBindings.getScrollBarRightToLeftInputMap(),
"ScrollBar.width", new Integer(16),
"ScrollBar.width", Integer.valueOf(16),
"ScrollBar.background", white,
"ScrollBar.foreground", black,
@ -816,7 +816,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
//"SplitPane.shadow", table.get("controlShadow"),
"SplitPane.background", panelBackgroundColor,
"SplitPane.border", scollListBorder,
"SplitPane.dividerSize", new Integer(9), //$
"SplitPane.dividerSize", Integer.valueOf(9), //$
"SplitPaneDivider.border", null, // AquaSplitPaneDividerUI draws it
"SplitPaneDivider.horizontalGradientVariant",(LazyValue) t -> AquaSplitPaneDividerUI.getHorizontalSplitDividerGradientVariant(),
@ -833,7 +833,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
//"TabbedPane.darkShadow", table.get("controlDkShadow"),
//"TabbedPane.focus", table.get("controlText"),
"TabbedPane.opaque", useOpaqueComponents,
"TabbedPane.textIconGap", new Integer(4),
"TabbedPane.textIconGap", Integer.valueOf(4),
"TabbedPane.tabInsets", new InsetsUIResource(0, 10, 3, 10), // Label within tab (top, left, bottom, right)
//"TabbedPane.rightTabInsets", new InsetsUIResource(0, 10, 3, 10), // Label within tab (top, left, bottom, right)
"TabbedPane.leftTabInsets", new InsetsUIResource(0, 10, 3, 10), // Label within tab
@ -973,9 +973,9 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
"Tree.selectionBorderColor", selectionBackground, // match the background so it looks like we don't draw anything
"Tree.editorBorderSelectionColor", null, // The EditTextFrame provides its own border
// "Tree.editorBorder", textFieldBorder, // If you still have Sun bug 4376328 in DefaultTreeCellEditor, it has to have the same insets as TextField.border
"Tree.leftChildIndent", new Integer(7),//$
"Tree.rightChildIndent", new Integer(13),//$
"Tree.rowHeight", new Integer(19),// iconHeight + 3, to match finder - a zero would have the renderer decide, except that leaves the icons touching
"Tree.leftChildIndent", Integer.valueOf(7),//$
"Tree.rightChildIndent", Integer.valueOf(13),//$
"Tree.rowHeight", Integer.valueOf(19),// iconHeight + 3, to match finder - a zero would have the renderer decide, except that leaves the icons touching
"Tree.scrollsOnExpand", Boolean.FALSE,
"Tree.openIcon",(LazyValue) t -> AquaImageFactory.getTreeOpenFolderIcon(), // Open folder icon
"Tree.closedIcon",(LazyValue) t -> AquaImageFactory.getTreeFolderIcon(), // Closed folder icon

View File

@ -521,7 +521,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
}
// [2165820] Mac OS X change: mnemonics need to be triggered with ctrl-option, not just option.
mnemonicInputMap.put(KeyStroke.getKeyStroke(mnemonic, Event.ALT_MASK | Event.CTRL_MASK), "setSelectedIndex");
mnemonicToIndexMap.put(new Integer(mnemonic), new Integer(index));
mnemonicToIndexMap.put(Integer.valueOf(mnemonic), Integer.valueOf(index));
}
/**
@ -2084,7 +2084,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
if (mnemonic >= 'a' && mnemonic <= 'z') {
mnemonic -= ('a' - 'A');
}
final Integer index = ui.mnemonicToIndexMap.get(new Integer(mnemonic));
final Integer index = ui.mnemonicToIndexMap.get(Integer.valueOf(mnemonic));
if (index != null && pane.isEnabledAt(index.intValue())) {
pane.setSelectedIndex(index.intValue());
}

View File

@ -268,7 +268,7 @@ public class AquaUtilControlSize {
public SizeVariant alterFontSize(final float newSize) {
final float oldSize = fontSize == null ? 0.0f : fontSize.floatValue();
fontSize = new Float(newSize + oldSize);
fontSize = newSize + oldSize;
return this;
}

View File

@ -32,8 +32,8 @@ import sun.lwawt.macosx.CPlatformWindow;
import sun.swing.SwingAccessor;
class ScreenPopupFactory extends PopupFactory {
static final Float TRANSLUCENT = new Float(248f/255f);
static final Float OPAQUE = new Float(1.0f);
static final Float TRANSLUCENT = 248f/255f;
static final Float OPAQUE = 1.0f;
boolean fIsActive = true;

View File

@ -386,7 +386,7 @@ public final class CStrike extends PhysicalStrike {
if (generalCache == null) {
return 0L;
}
final Long value = generalCache.get(new Integer(index));
final Long value = generalCache.get(Integer.valueOf(index));
if (value == null) {
return 0L;
}
@ -415,7 +415,7 @@ public final class CStrike extends PhysicalStrike {
generalCache = new HashMap<Integer, Long>();
}
generalCache.put(new Integer(index), Long.valueOf(value));
generalCache.put(Integer.valueOf(index), Long.valueOf(value));
}
public synchronized void dispose() {
@ -526,7 +526,7 @@ public final class CStrike extends PhysicalStrike {
}
if (generalCache == null) return 0;
final Float value = generalCache.get(new Integer(index));
final Float value = generalCache.get(Integer.valueOf(index));
if (value == null) return 0;
return value.floatValue();
}
@ -553,7 +553,7 @@ public final class CStrike extends PhysicalStrike {
generalCache = new HashMap<Integer, Float>();
}
generalCache.put(new Integer(index), new Float(value));
generalCache.put(Integer.valueOf(index), Float.valueOf(value));
}
private static class SparseBitShiftingTwoLayerArray {

View File

@ -378,9 +378,9 @@ public final class LWCToolkit extends LWToolkit {
// These DnD properties must be set, otherwise Swing ends up spewing NPEs
// all over the place. The values came straight off of MToolkit.
desktopProperties.put("DnD.Autoscroll.initialDelay", new Integer(50));
desktopProperties.put("DnD.Autoscroll.interval", new Integer(50));
desktopProperties.put("DnD.Autoscroll.cursorHysteresis", new Integer(5));
desktopProperties.put("DnD.Autoscroll.initialDelay", Integer.valueOf(50));
desktopProperties.put("DnD.Autoscroll.interval", Integer.valueOf(50));
desktopProperties.put("DnD.Autoscroll.cursorHysteresis", Integer.valueOf(5));
desktopProperties.put("DnD.isDragImageSupported", Boolean.TRUE);

View File

@ -42,7 +42,7 @@ import java.util.List;
* &lt;new class="java.lang.Long"&gt;
* &lt;string&gt;10&lt;/string&gt;
* &lt;/new&gt;</pre>
* is equivalent to {@code new Long("10")} in Java code.
* is equivalent to {@code Long.valueOf("10")} in Java code.
* <p>The following attributes are supported:
* <dl>
* <dt>class

View File

@ -128,7 +128,7 @@ public class BMPMetadata extends IIOMetadata implements BMPConstants {
addChildNode(root, "BMPVersion", bmpVersion);
addChildNode(root, "Width", width);
addChildNode(root, "Height", height);
addChildNode(root, "BitsPerPixel", new Short(bitsPerPixel));
addChildNode(root, "BitsPerPixel", Short.valueOf(bitsPerPixel));
addChildNode(root, "Compression", compression);
addChildNode(root, "ImageSize", imageSize);
@ -172,12 +172,12 @@ public class BMPMetadata extends IIOMetadata implements BMPConstants {
red = palette[j++] & 0xff;
green = palette[j++] & 0xff;
blue = palette[j++] & 0xff;
addChildNode(entry, "Red", new Byte((byte)red));
addChildNode(entry, "Green", new Byte((byte)green));
addChildNode(entry, "Blue", new Byte((byte)blue));
addChildNode(entry, "Red", Byte.valueOf((byte)red));
addChildNode(entry, "Green", Byte.valueOf((byte)green));
addChildNode(entry, "Blue", Byte.valueOf((byte)blue));
if (numComps == 4)
addChildNode(entry, "Alpha",
new Byte((byte)(palette[j++] & 0xff)));
Byte.valueOf((byte)(palette[j++] & 0xff)));
}
}
@ -284,9 +284,9 @@ public class BMPMetadata extends IIOMetadata implements BMPConstants {
private void addXYZPoints(IIOMetadataNode root, String name, double x, double y, double z) {
IIOMetadataNode node = addChildNode(root, name, null);
addChildNode(node, "X", new Double(x));
addChildNode(node, "Y", new Double(y));
addChildNode(node, "Z", new Double(z));
addChildNode(node, "X", Double.valueOf(x));
addChildNode(node, "Y", Double.valueOf(y));
addChildNode(node, "Z", Double.valueOf(z));
}
private IIOMetadataNode addChildNode(IIOMetadataNode root,

View File

@ -379,7 +379,7 @@ public class GTKLookAndFeel extends SynthLookAndFeel {
}
Insets zeroInsets = new InsetsUIResource(0, 0, 0, 0);
Double defaultCaretAspectRatio = new Double(0.025);
Double defaultCaretAspectRatio = Double.valueOf(0.025);
Color caretColor = table.getColor("caretColor");
Color controlText = table.getColor("controlText");

View File

@ -185,7 +185,7 @@ class Metacity implements SynthConstants {
getIntAttr(child, "bottom", 0),
getIntAttr(child, "right", 0));
} else if ("aspect_ratio".equals(name)) {
value = new Float(getFloatAttr(child, "value", 1.0F));
value = Float.valueOf(getFloatAttr(child, "value", 1.0F));
} else {
logError(themeName, "Unknown Metacity frame geometry value type: "+name);
}

View File

@ -79,7 +79,7 @@ import jdk.internal.misc.SharedSecrets;
* will be ignored.
* <li>The identity of the value does not matter, only the actual
* value. For example, {@code TextAttribute.WEIGHT_BOLD} and
* {@code new Float(2.0)}
* {@code Float.valueOf(2.0f)}
* indicate the same {@code WEIGHT}.
* <li>Attribute values of type {@code Number} (used for
* {@code WEIGHT}, {@code WIDTH}, {@code POSTURE},

View File

@ -105,7 +105,7 @@ public final class TextMeasurer implements Cloneable {
String s = System.getProperty("estLines");
if (s != null) {
try {
Float f = new Float(s);
Float f = Float.valueOf(s);
EST_LINES = f.floatValue();
}
catch(NumberFormatException e) {

View File

@ -392,7 +392,7 @@ public class ParameterBlock implements Cloneable, Serializable {
* the specified parameter.
*/
public ParameterBlock add(float f) {
return add(new Float(f));
return add(Float.valueOf(f));
}
/**
@ -403,7 +403,7 @@ public class ParameterBlock implements Cloneable, Serializable {
* the specified parameter.
*/
public ParameterBlock add(double d) {
return add(new Double(d));
return add(Double.valueOf(d));
}
/**
@ -521,7 +521,7 @@ public class ParameterBlock implements Cloneable, Serializable {
* the specified parameter.
*/
public ParameterBlock set(float f, int index) {
return set(new Float(f), index);
return set(Float.valueOf(f), index);
}
/**
@ -537,7 +537,7 @@ public class ParameterBlock implements Cloneable, Serializable {
* the specified parameter.
*/
public ParameterBlock set(double d, int index) {
return set(new Double(d), index);
return set(Double.valueOf(d), index);
}
/**

View File

@ -98,7 +98,7 @@ import javax.accessibility.*;
* <PRE>
* layeredPane.add(child, JLayeredPane.DEFAULT_LAYER);
* or
* layeredPane.add(child, new Integer(10));
* layeredPane.add(child, Integer.valueOf.valueOf(10));
* </PRE>
* The layer attribute can also be set on a Component by calling<PRE>
* layeredPaneParent.setLayer(child, 10)</PRE>
@ -162,23 +162,23 @@ import javax.accessibility.*;
@SuppressWarnings("serial")
public class JLayeredPane extends JComponent implements Accessible {
/// Watch the values in getObjectForLayer()
/** Convenience object defining the Default layer. Equivalent to new Integer(0).*/
/** Convenience object defining the Default layer. Equivalent to Integer.valueOf(0).*/
public static final Integer DEFAULT_LAYER = 0;
/** Convenience object defining the Palette layer. Equivalent to new Integer(100).*/
/** Convenience object defining the Palette layer. Equivalent to Integer.valueOf(100).*/
public static final Integer PALETTE_LAYER = 100;
/** Convenience object defining the Modal layer. Equivalent to new Integer(200).*/
/** Convenience object defining the Modal layer. Equivalent to Integer.valueOf(200).*/
public static final Integer MODAL_LAYER = 200;
/** Convenience object defining the Popup layer. Equivalent to new Integer(300).*/
/** Convenience object defining the Popup layer. Equivalent to Integer.valueOf(300).*/
public static final Integer POPUP_LAYER = 300;
/** Convenience object defining the Drag layer. Equivalent to new Integer(400).*/
/** Convenience object defining the Drag layer. Equivalent to Integer.valueOf(400).*/
public static final Integer DRAG_LAYER = 400;
/** Convenience object defining the Frame Content layer.
* This layer is normally only use to position the contentPane and menuBar
* components of JFrame.
* Equivalent to new Integer(-30000).
* Equivalent to Integer.valueOf(-30000).
* @see JFrame
*/
public static final Integer FRAME_CONTENT_LAYER = new Integer(-30000);
public static final Integer FRAME_CONTENT_LAYER = -30000;
/** Bound property */
public static final String LAYER_PROPERTY = "layeredContainerLayer";

View File

@ -478,7 +478,7 @@ public class JProgressBar extends JComponent implements SwingConstants, Accessib
if (format == null) {
format = NumberFormat.getPercentInstance();
}
return format.format(new Double(getPercentComplete()));
return format.format(Double.valueOf(getPercentComplete()));
}
}

View File

@ -81,7 +81,7 @@ import sun.swing.PrintingStatus;
* TableModel dataModel = new AbstractTableModel() {
* public int getColumnCount() { return 10; }
* public int getRowCount() { return 10;}
* public Object getValueAt(int row, int col) { return new Integer(row*col); }
* public Object getValueAt(int row, int col) { return Integer.valueOf(row*col); }
* };
* JTable table = new JTable(dataModel);
* JScrollPane scrollpane = new JScrollPane(table);

View File

@ -51,10 +51,10 @@ import java.io.Serializable;
* range zero to one hundred, with
* fifty as the initial value, one could write:
* <pre>
* Integer value = new Integer(50);
* Integer min = new Integer(0);
* Integer max = new Integer(100);
* Integer step = new Integer(1);
* Integer value = Integer.valueOf(50);
* Integer min = Integer.valueOf(0);
* Integer max = Integer.valueOf(100);
* Integer step = Integer.valueOf(1);
* SpinnerNumberModel model = new SpinnerNumberModel(value, min, max, step);
* int fifty = model.getNumber().intValue();
* </pre>
@ -175,7 +175,8 @@ public class SpinnerNumberModel extends AbstractSpinnerModel implements Serializ
* <code>minimum &lt;= value &lt;= maximum</code>
*/
public SpinnerNumberModel(double value, double minimum, double maximum, double stepSize) {
this(new Double(value), new Double(minimum), new Double(maximum), new Double(stepSize));
this(Double.valueOf(value), Double.valueOf(minimum),
Double.valueOf(maximum), Double.valueOf(stepSize));
}
@ -337,10 +338,10 @@ public class SpinnerNumberModel extends AbstractSpinnerModel implements Serializ
if ((value instanceof Float) || (value instanceof Double)) {
double v = value.doubleValue() + (stepSize.doubleValue() * (double)dir);
if (value instanceof Double) {
newValue = new Double(v);
newValue = Double.valueOf(v);
}
else {
newValue = new Float(v);
newValue = Float.valueOf((float)v);
}
} else {
long v = value.longValue() + (stepSize.longValue() * (long)dir);

View File

@ -120,7 +120,7 @@ public class UIDefaults extends Hashtable<Object,Object>
Object[] uiDefaults = {
"Font", new Font("Dialog", Font.BOLD, 12),
"Color", Color.red,
"five", new Integer(5)
"five", Integer.valueOf(5)
}
UIDefaults myDefaults = new UIDefaults(uiDefaults);
* </pre>

View File

@ -134,7 +134,7 @@ public class OceanTheme extends DefaultMetalTheme {
new BorderUIResource.LineBorderUIResource(getPrimary1());
// .30 0 DDE8F3 white secondary2
java.util.List<?> buttonGradient = Arrays.asList(
new Object[] {new Float(.3f), new Float(0f),
new Object[] {Float.valueOf(.3f), Float.valueOf(0f),
new ColorUIResource(0xDDE8F3), getWhite(), getSecondary2() });
// Other possible properties that aren't defined:
@ -150,7 +150,7 @@ public class OceanTheme extends DefaultMetalTheme {
Object directoryIcon = getIconResource("icons/ocean/directory.gif");
Object fileIcon = getIconResource("icons/ocean/file.gif");
java.util.List<?> sliderGradient = Arrays.asList(new Object[] {
new Float(.3f), new Float(.2f),
Float.valueOf(.3f), Float.valueOf(.2f),
c8ddf2, getWhite(), new ColorUIResource(SECONDARY2) });
Object[] defaults = new Object[] {
@ -192,7 +192,7 @@ public class OceanTheme extends DefaultMetalTheme {
"Menu.opaque", Boolean.FALSE,
"MenuBar.gradient", Arrays.asList(new Object[] {
new Float(1f), new Float(0f),
Float.valueOf(1f), Float.valueOf(0f),
getWhite(), dadada,
new ColorUIResource(dadada) }),
"MenuBar.borderColor", cccccc,

View File

@ -2580,7 +2580,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A
* @param e the DocumentEvent
*/
public void insertUpdate(DocumentEvent e) {
final Integer pos = new Integer (e.getOffset());
final Integer pos = e.getOffset();
if (SwingUtilities.isEventDispatchThread()) {
firePropertyChange(ACCESSIBLE_TEXT_PROPERTY, null, pos);
} else {
@ -2602,7 +2602,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A
* @param e the DocumentEvent
*/
public void removeUpdate(DocumentEvent e) {
final Integer pos = new Integer (e.getOffset());
final Integer pos = e.getOffset();
if (SwingUtilities.isEventDispatchThread()) {
firePropertyChange(ACCESSIBLE_TEXT_PROPERTY, null, pos);
} else {
@ -2624,7 +2624,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A
* @param e the DocumentEvent
*/
public void changedUpdate(DocumentEvent e) {
final Integer pos = new Integer (e.getOffset());
final Integer pos = e.getOffset();
if (SwingUtilities.isEventDispatchThread()) {
firePropertyChange(ACCESSIBLE_TEXT_PROPERTY, null, pos);
} else {

View File

@ -73,7 +73,7 @@ import sun.swing.SwingUtilities2;
* type the value class represents. For example:
* <code>setValueClass(Integer.class)</code> will cause the resulting
* value to be created via
* <code>new Integer(((Number)formatter.parseObject(string)).intValue())</code>.
* <code>Integer.valueOf(((Number)formatter.parseObject(string)).intValue())</code>.
* This is typically useful if you
* wish to set a min/max value as the various <code>Number</code>
* implementations are generally not comparable to each other. This is also

View File

@ -608,7 +608,7 @@ public class StyleConstants {
* @param i the value
*/
public static void setFirstLineIndent(MutableAttributeSet a, float i) {
a.addAttribute(FirstLineIndent, new Float(i));
a.addAttribute(FirstLineIndent, Float.valueOf(i));
}
/**
@ -632,7 +632,7 @@ public class StyleConstants {
* @param i the value
*/
public static void setRightIndent(MutableAttributeSet a, float i) {
a.addAttribute(RightIndent, new Float(i));
a.addAttribute(RightIndent, Float.valueOf(i));
}
/**
@ -656,7 +656,7 @@ public class StyleConstants {
* @param i the value
*/
public static void setLeftIndent(MutableAttributeSet a, float i) {
a.addAttribute(LeftIndent, new Float(i));
a.addAttribute(LeftIndent, Float.valueOf(i));
}
/**
@ -680,7 +680,7 @@ public class StyleConstants {
* @param i the value
*/
public static void setLineSpacing(MutableAttributeSet a, float i) {
a.addAttribute(LineSpacing, new Float(i));
a.addAttribute(LineSpacing, Float.valueOf(i));
}
/**
@ -704,7 +704,7 @@ public class StyleConstants {
* @param i the value
*/
public static void setSpaceAbove(MutableAttributeSet a, float i) {
a.addAttribute(SpaceAbove, new Float(i));
a.addAttribute(SpaceAbove, Float.valueOf(i));
}
/**
@ -728,7 +728,7 @@ public class StyleConstants {
* @param i the value
*/
public static void setSpaceBelow(MutableAttributeSet a, float i) {
a.addAttribute(SpaceBelow, new Float(i));
a.addAttribute(SpaceBelow, Float.valueOf(i));
}
/**

View File

@ -2564,7 +2564,7 @@ public class CSS implements Serializable {
* represents the CSS attribute value
*/
Object toStyleConstants(StyleConstants key, View v) {
return new Float(getValue(false));
return Float.valueOf(getValue(false));
}
/** If true, span is a percentage value, and that to determine
@ -2837,25 +2837,25 @@ public class CSS implements Serializable {
static Hashtable<String, Float> lengthMapping = new Hashtable<String, Float>(6);
static Hashtable<String, Float> w3cLengthMapping = new Hashtable<String, Float>(6);
static {
lengthMapping.put("pt", new Float(1f));
lengthMapping.put("pt", Float.valueOf(1f));
// Not sure about 1.3, determined by experiementation.
lengthMapping.put("px", new Float(1.3f));
lengthMapping.put("mm", new Float(2.83464f));
lengthMapping.put("cm", new Float(28.3464f));
lengthMapping.put("pc", new Float(12f));
lengthMapping.put("in", new Float(72f));
lengthMapping.put("px", Float.valueOf(1.3f));
lengthMapping.put("mm", Float.valueOf(2.83464f));
lengthMapping.put("cm", Float.valueOf(28.3464f));
lengthMapping.put("pc", Float.valueOf(12f));
lengthMapping.put("in", Float.valueOf(72f));
int res = 72;
try {
res = Toolkit.getDefaultToolkit().getScreenResolution();
} catch (HeadlessException e) {
}
// mapping according to the CSS2 spec
w3cLengthMapping.put("pt", new Float(res/72f));
w3cLengthMapping.put("px", new Float(1f));
w3cLengthMapping.put("mm", new Float(res/25.4f));
w3cLengthMapping.put("cm", new Float(res/2.54f));
w3cLengthMapping.put("pc", new Float(res/6f));
w3cLengthMapping.put("in", new Float(res));
w3cLengthMapping.put("pt", Float.valueOf(res/72f));
w3cLengthMapping.put("px", Float.valueOf(1f));
w3cLengthMapping.put("mm", Float.valueOf(res/25.4f));
w3cLengthMapping.put("cm", Float.valueOf(res/2.54f));
w3cLengthMapping.put("pc", Float.valueOf(res/6f));
w3cLengthMapping.put("in", Float.valueOf((float)res));
}
LengthUnit(String value, short defaultType, float defaultValue) {

View File

@ -357,7 +357,7 @@ class RTFAttributes
public static NumericAttribute NewTwips(int d, Object s, String r,
float ds, int dr)
{
return new NumericAttribute(d, s, r, new Float(ds), dr, 20f);
return new NumericAttribute(d, s, r, Float.valueOf(ds), dr, 20f);
}
public static NumericAttribute NewTwips(int d, Object s, String r,
@ -378,7 +378,7 @@ class RTFAttributes
if (scale == 1f)
swingValue = Integer.valueOf(parameter);
else
swingValue = new Float(parameter / scale);
swingValue = Float.valueOf(parameter / scale);
target.addAttribute(swingName, swingValue);
return true;
}

View File

@ -87,7 +87,7 @@ public class PNGImageDecoder extends ImageDecoder
properties.put(key,value);
}
private void property(String key,float value) {
property(key,new Float(value));
property(key, Float.valueOf(value));
}
private final void pngassert(boolean b) throws IOException {
if(!b) {

View File

@ -1402,8 +1402,8 @@ public class ServiceDialog extends JDialog implements ActionListener {
format.setParseIntegerOnly(false);
format.setDecimalSeparatorAlwaysShown(true);
NumberFormatter nf = new NumberFormatter(format);
nf.setMinimum(new Float(0.0f));
nf.setMaximum(new Float(999.0f));
nf.setMinimum(Float.valueOf(0.0f));
nf.setMaximum(Float.valueOf(999.0f));
nf.setAllowsInvalid(true);
nf.setCommitsOnValidEdit(true);
@ -1836,10 +1836,10 @@ public class ServiceDialog extends JDialog implements ActionListener {
rmVal = mediaSize.getX(units) - pax - paw;
bmVal = mediaSize.getY(units) - pay - pah;
lmObj = new Float(lmVal);
rmObj = new Float(rmVal);
tmObj = new Float(tmVal);
bmObj = new Float(bmVal);
lmObj = lmVal;
rmObj = rmVal;
tmObj = tmVal;
bmObj = bmVal;
/* Now we know the values to use, we need to assign them
* to the fields appropriate for the orientation.

View File

@ -117,7 +117,7 @@ public class PrintServiceLookupProvider extends PrintServiceLookup
if (refreshTimeStr != null) {
try {
minRefreshTime = (new Integer(refreshTimeStr)).intValue();
minRefreshTime = (Integer.valueOf(refreshTimeStr)).intValue();
} catch (NumberFormatException e) {
}
if (minRefreshTime < DEFAULT_MINREFRESH) {