diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java index c70d889f453..d54839f7e3c 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java @@ -799,9 +799,9 @@ class GTKColorChooserPanel extends AbstractColorChooserPanel implements Graphics g = triangleImage.getGraphics(); g.setColor(new Color(0, 0, 0, 0)); g.fillRect(0, 0, a, a); - g.translate((int)(a / 2), 0); + g.translate(a / 2, 0); paintTriangle(g, triangleSize, getColor()); - g.translate((int)(-a / 2), 0); + g.translate(-a / 2, 0); g.dispose(); g = wheelImage.getGraphics(); @@ -897,7 +897,7 @@ class GTKColorChooserPanel extends AbstractColorChooserPanel implements return false; } // Rotate to origin and and verify x is valid. - int triangleSize = (int)innerR * 3 / 2; + int triangleSize = innerR * 3 / 2; double x1 = Math.cos(angle) * x - Math.sin(angle) * y; double y1 = Math.sin(angle) * x + Math.cos(angle) * y; if (x1 < -(innerR / 2)) { @@ -960,7 +960,7 @@ class GTKColorChooserPanel extends AbstractColorChooserPanel implements */ private void setSaturationAndBrightness(float s, float b) { int innerR = getTriangleCircumscribedRadius(); - int triangleSize = (int)innerR * 3 / 2; + int triangleSize = innerR * 3 / 2; double x = b * triangleSize; double maxY = x * Math.tan(Math.toRadians(30.0)); double y = 2 * maxY * s - maxY; @@ -1156,7 +1156,7 @@ class GTKColorChooserPanel extends AbstractColorChooserPanel implements * @param x X location to get color for * @param y Y location to get color for * @param rad Radius from center of color wheel - * @param integer with red, green and blue components + * @return integer with red, green and blue components */ private int colorWheelLocationToRGB(int x, int y, double rad) { double angle = Math.acos((double)x / rad); @@ -1165,12 +1165,12 @@ class GTKColorChooserPanel extends AbstractColorChooserPanel implements if (angle < PI_3) { if (y < 0) { // FFFF00 - FF0000 - rgb = 0xFF0000 | (int)Math.min(255, + rgb = 0xFF0000 | Math.min(255, (int)(255 * angle / PI_3)) << 8; } else { // FF0000 - FF00FF - rgb = 0xFF0000 | (int)Math.min(255, + rgb = 0xFF0000 | Math.min(255, (int)(255 * angle / PI_3)); } } @@ -1178,12 +1178,12 @@ class GTKColorChooserPanel extends AbstractColorChooserPanel implements angle -= PI_3; if (y < 0) { // 00FF00 - FFFF00 - rgb = 0x00FF00 | (int)Math.max(0, 255 - + rgb = 0x00FF00 | Math.max(0, 255 - (int)(255 * angle / PI_3)) << 16; } else { // FF00FF - 0000FF - rgb = 0x0000FF | (int)Math.max(0, 255 - + rgb = 0x0000FF | Math.max(0, 255 - (int)(255 * angle / PI_3)) << 16; } } @@ -1191,12 +1191,12 @@ class GTKColorChooserPanel extends AbstractColorChooserPanel implements angle -= 2 * PI_3; if (y < 0) { // 00FFFF - 00FF00 - rgb = 0x00FF00 | (int)Math.min(255, + rgb = 0x00FF00 | Math.min(255, (int)(255 * angle / PI_3)); } else { // 0000FF - 00FFFF - rgb = 0x0000FF | (int)Math.min(255, + rgb = 0x0000FF | Math.min(255, (int)(255 * angle / PI_3)) << 8; } } diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKEngine.java b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKEngine.java index 95bf090b645..737e20c2243 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKEngine.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKEngine.java @@ -112,7 +112,7 @@ class GTKEngine { } - private static HashMap regionToWidgetTypeMap; + private static HashMap regionToWidgetTypeMap; private ImageCache cache = new ImageCache(CACHE_SIZE); private int x0, y0, w0, h0; private Graphics graphics; @@ -178,7 +178,7 @@ class GTKEngine { Toolkit.getDefaultToolkit(); // Initialize regionToWidgetTypeMap - regionToWidgetTypeMap = new HashMap(50); + regionToWidgetTypeMap = new HashMap(50); regionToWidgetTypeMap.put(Region.ARROW_BUTTON, new WidgetType[] { WidgetType.SPINNER_ARROW_BUTTON, WidgetType.COMBO_BOX_ARROW_BUTTON, diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java index 8b786da73fb..9ca8fa52b61 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java @@ -148,7 +148,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { directoryList : fileList; Object[] files = list.getSelectedValues(); int len = files.length; - Vector result = new Vector(len + 1); + Vector result = new Vector(len + 1); // we return all selected file names for (int i = 0; i < len; i++) { @@ -425,16 +425,16 @@ class GTKFileChooserUI extends SynthFileChooserUI { setDirectorySelected(true); setDirectory(((File)objects[0])); } else { - ArrayList fList = new ArrayList(objects.length); - for (int i = 0; i < objects.length; i++) { - File f = (File)objects[i]; + ArrayList fList = new ArrayList(objects.length); + for (Object object : objects) { + File f = (File) object; if ((chooser.isFileSelectionEnabled() && f.isFile()) || (chooser.isDirectorySelectionEnabled() && f.isDirectory())) { fList.add(f); } } if (fList.size() > 0) { - files = (File[])fList.toArray(new File[fList.size()]); + files = fList.toArray(new File[fList.size()]); } setDirectorySelected(false); } @@ -671,9 +671,9 @@ class GTKFileChooserUI extends SynthFileChooserUI { pathFieldLabel.setLabelFor(fileNameTextField); - Set forwardTraversalKeys = fileNameTextField.getFocusTraversalKeys( + Set forwardTraversalKeys = fileNameTextField.getFocusTraversalKeys( KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS); - forwardTraversalKeys = new HashSet(forwardTraversalKeys); + forwardTraversalKeys = new HashSet(forwardTraversalKeys); forwardTraversalKeys.remove(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0)); fileNameTextField.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, forwardTraversalKeys); @@ -895,10 +895,9 @@ class GTKFileChooserUI extends SynthFileChooserUI { private class GTKDirectoryModel extends BasicDirectoryModel { FileSystemView fsv; - private Comparator fileComparator = new Comparator() { - public int compare(Object o, Object o1) { - return fsv.getSystemDisplayName((File) o).compareTo - (fsv.getSystemDisplayName((File) o1)); + private Comparator fileComparator = new Comparator() { + public int compare(File o, File o1) { + return fsv.getSystemDisplayName(o).compareTo(fsv.getSystemDisplayName(o1)); } }; @@ -1352,8 +1351,8 @@ class GTKFileChooserUI extends SynthFileChooserUI { FileFilter currentFilter = getFileChooser().getFileFilter(); boolean found = false; if (currentFilter != null) { - for (int i = 0; i < filters.length; i++) { - if (filters[i] == currentFilter) { + for (FileFilter filter : filters) { + if (filter == currentFilter) { found = true; } } diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java index 780b01cf6d4..58d61dc909a 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java @@ -299,7 +299,7 @@ class GTKPainter extends SynthPainter { // Paint the default indicator GTKStyle style = (GTKStyle)context.getStyle(); if (defaultCapable && !toolButton) { - Insets defaultInsets = (Insets)style.getClassSpecificInsetsValue( + Insets defaultInsets = style.getClassSpecificInsetsValue( context, "default-border", GTKStyle.BUTTON_DEFAULT_BORDER_INSETS); diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java index a3eada90d84..d432bb088ba 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java @@ -124,7 +124,7 @@ class Metacity implements SynthConstants { } // Initialize constants - variables = new HashMap(); + variables = new HashMap(); NodeList nodes = xmlDoc.getElementsByTagName("constant"); int n = nodes.getLength(); for (int i = 0; i < n; i++) { @@ -144,14 +144,14 @@ class Metacity implements SynthConstants { } // Cache frame geometries - frameGeometries = new HashMap(); + frameGeometries = new HashMap>(); nodes = xmlDoc.getElementsByTagName("frame_geometry"); n = nodes.getLength(); for (int i = 0; i < n; i++) { Node node = nodes.item(i); String name = getStringAttr(node, "name"); if (name != null) { - HashMap gm = new HashMap(); + HashMap gm = new HashMap(); frameGeometries.put(name, gm); String parentGM = getStringAttr(node, "parent"); @@ -458,7 +458,7 @@ class Metacity implements SynthConstants { - private static class Privileged implements PrivilegedAction { + private static class Privileged implements PrivilegedAction { private static int GET_THEME_DIR = 0; private static int GET_USER_THEME = 1; private static int GET_IMAGE = 2; @@ -598,7 +598,7 @@ class Metacity implements SynthConstants { g2.setComposite(oldComp); } - private HashMap images = new HashMap(); + private HashMap images = new HashMap(); protected Image getImage(String key, Color c) { Image image = images.get(key+"-"+c.getRGB()); @@ -1530,8 +1530,8 @@ class Metacity implements SynthConstants { DocumentBuilderFactory.newInstance().newDocumentBuilder(); } InputStream inputStream = - (InputStream)AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction() { + public InputStream run() { try { return new BufferedInputStream(xmlFile.openStream()); } catch (IOException ex) { @@ -1551,7 +1551,7 @@ class Metacity implements SynthConstants { protected Node[] getNodesByName(Node parent, String name) { NodeList nodes = parent.getChildNodes(); // ElementNode int n = nodes.getLength(); - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList(); for (int i=0; i < n; i++) { Node node = nodes.item(i); if (name.equals(node.getNodeName())) { @@ -1603,7 +1603,7 @@ class Metacity implements SynthConstants { String aValue = attrs[a * 2 + 1]; Node attr = nodeAttrs.getNamedItem(aName); if (attr == null || - aValue != null && !aValue.equals((String)attr.getNodeValue())) { + aValue != null && !aValue.equals(attr.getNodeValue())) { matches = false; break; } @@ -1642,7 +1642,7 @@ class Metacity implements SynthConstants { protected String getStringAttr(NamedNodeMap attrs, String name) { Node item = attrs.getNamedItem(name); - return (item != null) ? (String)item.getNodeValue() : null; + return (item != null) ? item.getNodeValue() : null; } protected boolean getBooleanAttr(Node node, String name, boolean fallback) {