< prev index next >
src/java.desktop/share/classes/java/awt/FontMetrics.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -330,11 +330,11 @@
*/
public int charWidth(char ch) {
if (ch < 256) {
return getWidths()[ch];
}
- char data[] = {ch};
+ char[] data = {ch};
return charsWidth(data, 0, 1);
}
/**
* Returns the total advance width for showing the specified
@@ -353,11 +353,11 @@
* @see #charsWidth(char[], int, int)
* @see #getStringBounds(String, Graphics)
*/
public int stringWidth(String str) {
int len = str.length();
- char data[] = new char[len];
+ char[] data = new char[len];
str.getChars(0, len, data, 0);
return charsWidth(data, 0, len);
}
/**
@@ -381,11 +381,11 @@
* @see #charWidth(int)
* @see #charWidth(char)
* @see #bytesWidth(byte[], int, int)
* @see #stringWidth(String)
*/
- public int charsWidth(char data[], int off, int len) {
+ public int charsWidth(char[] data, int off, int len) {
return stringWidth(new String(data, off, len));
}
/**
* Returns the total advance width for showing the specified array
@@ -408,11 +408,11 @@
* the bounds of the {@code data} array.
* @see #charsWidth(char[], int, int)
* @see #stringWidth(String)
*/
@SuppressWarnings("deprecation")
- public int bytesWidth(byte data[], int off, int len) {
+ public int bytesWidth(byte[] data, int off, int len) {
return stringWidth(new String(data, 0, off, len));
}
/**
* Gets the advance widths of the first 256 characters in the
@@ -424,11 +424,11 @@
* @return an array storing the advance widths of the
* characters in the {@code Font}
* described by this {@code FontMetrics} object.
*/
public int[] getWidths() {
- int widths[] = new int[256];
+ int[] widths = new int[256];
for (char ch = 0 ; ch < 256 ; ch++) {
widths[ch] = charWidth(ch);
}
return widths;
}
< prev index next >