src/share/classes/java/awt/CardLayout.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1995, 2006, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -221,12 +221,12 @@
         synchronized (comp.getTreeLock()) {
             if (!vector.isEmpty()) {
                 comp.setVisible(false);
             }
             for (int i=0; i < vector.size(); i++) {
-                if (((Card)vector.get(i)).name.equals(name)) {
-                    ((Card)vector.get(i)).comp = comp;
+                if ((vector.get(i)).name.equals(name)) {
+                    (vector.get(i)).comp = comp;
                     return;
                 }
             }
             vector.add(new Card(name, comp));
         }

@@ -240,11 +240,11 @@
      * @see     java.awt.Container#removeAll()
      */
     public void removeLayoutComponent(Component comp) {
         synchronized (comp.getTreeLock()) {
             for (int i = 0; i < vector.size(); i++) {
-                if (((Card)vector.get(i)).comp == comp) {
+                if ((vector.get(i)).comp == comp) {
                     // if we remove current component we should show next one
                     if (comp.isVisible() && (comp.getParent() != null)) {
                         next(comp.getParent());
                     }
 

@@ -525,11 +525,11 @@
         synchronized (parent.getTreeLock()) {
             checkLayout(parent);
             Component next = null;
             int ncomponents = vector.size();
             for (int i = 0; i < ncomponents; i++) {
-                Card card = (Card)vector.get(i);
+                Card card = vector.get(i);
                 if (card.name.equals(name)) {
                     next = card.comp;
                     currentCard = i;
                     break;
                 }

@@ -572,12 +572,12 @@
             //  pre-1.4 stream
             Hashtable<String, Component> tab = (Hashtable)f.get("tab", null);
             vector = new Vector<>();
             if (tab != null && !tab.isEmpty()) {
                 for (Enumeration<String> e = tab.keys() ; e.hasMoreElements() ; ) {
-                    String key = (String)e.nextElement();
-                    Component comp = (Component)tab.get(key);
+                    String key = e.nextElement();
+                    Component comp = tab.get(key);
                     vector.add(new Card(key, comp));
                     if (comp.isVisible()) {
                         currentCard = vector.size() - 1;
                     }
                 }

@@ -595,11 +595,11 @@
         throws IOException
     {
         Hashtable<String, Component> tab = new Hashtable<>();
         int ncomponents = vector.size();
         for (int i = 0; i < ncomponents; i++) {
-            Card card = (Card)vector.get(i);
+            Card card = vector.get(i);
             tab.put(card.name, card.comp);
         }
 
         ObjectOutputStream.PutField f = s.putFields();
         f.put("hgap", hgap);