< prev index next >

## src/com/sun/javatest/agent/Folder.java

Print this page

    @@ -141,11 +141,11 @@
             showTab(name, false);
         }

         public void showTab(String name, boolean visible) {
             for (int i = 0; i < entries.size(); i++) {
    -            Entry e = (Entry)entries.elementAt(i);
    +            Entry e = entries.elementAt(i);
                 if (e.name.equals(name)) {
                     if (e.visibleTab != visible) {
                         e.visibleTab = visible;
                         repaint();
                     }

    @@ -155,49 +155,49 @@
         }

         public String getNextVisibleTab() {
             int currentIndex = Math.max(0, getCurrentIndex());
             for (int i = currentIndex + 1; i < entries.size(); i++) {
    -            Entry e = (Entry)entries.elementAt(i);
    +            Entry e = entries.elementAt(i);
                 if (e.visibleTab)
                     return e.name;
             }
             return null;
         }

         public String getPrevVisibleTab() {
             int currentIndex = getCurrentIndex();
             for (int i = currentIndex - 1; i >= 0; i--) {
    -            Entry e = (Entry)entries.elementAt(i);
    +            Entry e = entries.elementAt(i);
                 if (e.visibleTab)
                     return e.name;
             }
             return null;
         }

         public Component current() {
             for (int i = 0; i < entries.size(); i++) {
    -            Entry e = (Entry)entries.elementAt(i);
    +            Entry e = entries.elementAt(i);
                 if (e.comp.isVisible())
                     return e.comp;
             }
             return null;
         }

         public void show(Component comp) {
             for (int i = 0; i < entries.size(); i++) {
    -            Entry e = (Entry)entries.elementAt(i);
    +            Entry e = entries.elementAt(i);
                 if (e.comp == comp) {
                     show(e);
                     return;
                 }
             }
         }

         public void show(String name) {
             for (int i = 0; i < entries.size(); i++) {
    -            Entry e = (Entry)entries.elementAt(i);
    +            Entry e = entries.elementAt(i);
                 if (e.name.equals(name)) {
                     show(e);
                     return;
                 }
             }

    @@ -213,11 +213,11 @@

             FontMetrics fm = g.getFontMetrics();
             int tabHeight = fm.getHeight() + tabpad;
             Entry selected = null;
             for (int i = 0; i < entries.size(); i++) {
    -            Entry e = (Entry)entries.elementAt(i);
    +            Entry e = entries.elementAt(i);
                 if (e.comp.isVisible()) {
                     selected = e;
                     break;
                 }
             }

    @@ -232,11 +232,11 @@
                   dims.width - 2*hgap - 1, dims.height - tabHeight - 2*vgap - 1,
                   border, border);
             int x = border + hgap;
             int baseLine = tabHeight + vgap;
             for (int i = 0; i < entries.size(); i++) {
    -            Entry e = (Entry)entries.elementAt(i);
    +            Entry e = entries.elementAt(i);
                 int tabH = (e.visibleTab || e.comp.isVisible() ? tabHeight : tabHeight / 3);
                 int w = fm.stringWidth(e.name);
                 Polygon tab = new Polygon();
                 tab.addPoint(x, baseLine);
                 tab.addPoint(x + slant, baseLine - tabH);

    @@ -280,11 +280,11 @@

         int getMinimumWidth() {
             FontMetrics fm = getFontMetrics(getFont());
             int w = border + 2 * hgap + tabSpace;
             for (int i = 0; i < entries.size(); i++) {
    -          Entry e = (Entry)entries.elementAt(i);
    +          Entry e = entries.elementAt(i);
               w += slant + (fm == null ? 0 : fm.stringWidth(e.name)) + slant + tabSpace;
             }
             return w;
         }

    @@ -307,28 +307,28 @@
             }
         }

         private int getCurrentIndex() {
             for (int i = 0; i < entries.size(); i++) {
    -            Entry e = (Entry)entries.elementAt(i);
    +            Entry e = entries.elementAt(i);
                 if (e.comp.isVisible())
                     return i;
             }
             return -1;
         }

         private Entry getCurrentEntry() {
             int i = getCurrentIndex();
    -        return (i == -1 ? null : (Entry)(entries.elementAt(i)) );
    +        return (i == -1 ? null : entries.elementAt(i));
         }

         void mousePressed(int mouseX, int mouseY) {
             FontMetrics fm = getFontMetrics(getFont());
             if (vgap < mouseY  &&  mouseY < border + fm.getHeight() + vgap) {
                 int x = border + hgap;
                 for (int i = 0; i < entries.size(); i++) {
    -                Entry e = (Entry)entries.elementAt(i);
    +                Entry e = entries.elementAt(i);
                     int w = fm.stringWidth(e.name);
                     x += slant + w + slant + tabSpace;
                     if (mouseX < x) {
                         show(e);
                         break;

    @@ -337,11 +337,11 @@
             }
         }

         private ItemListener itemListener;
    -    private Vector entries = new Vector();
    +    private Vector<Entry> entries = new Vector<>();
         private int border;
         private int slant;
         private int tabSpace;
         private int hgap;
         private int vgap;

< prev index next >