--- old/src/share/classes/javax/swing/JSlider.java 2014-07-02 23:00:25.000000000 -0700 +++ new/src/share/classes/javax/swing/JSlider.java 2014-07-02 23:00:24.000000000 -0700 @@ -138,7 +138,7 @@ /** * {@code Dictionary} of what labels to draw at which values */ - private Dictionary labelTable; + private Dictionary labelTable; /** @@ -769,10 +769,10 @@ } // Check that there is a label with such image - Enumeration elements = labelTable.elements(); + Enumeration elements = labelTable.elements(); while (elements.hasMoreElements()) { - Component component = (Component) elements.nextElement(); + JComponent component = elements.nextElement(); if (component instanceof JLabel) { JLabel label = (JLabel) component; @@ -793,7 +793,7 @@ * @return the Dictionary containing labels and * where to draw them */ - public Dictionary getLabelTable() { + public Dictionary getLabelTable() { /* if ( labelTable == null && getMajorTickSpacing() > 0 ) { setLabelTable( createStandardLabels( getMajorTickSpacing() ) ); @@ -826,8 +826,8 @@ * attribute: visualUpdate true * description: Specifies what labels will be drawn for any given value. */ - public void setLabelTable( Dictionary labels ) { - Dictionary oldTable = labelTable; + public void setLabelTable( Dictionary labels ) { + Dictionary oldTable = labelTable; labelTable = labels; updateLabelUIs(); firePropertyChange("labelTable", oldTable, labelTable ); @@ -848,25 +848,25 @@ * @see JComponent#updateUI */ protected void updateLabelUIs() { - Dictionary labelTable = getLabelTable(); + Dictionary labelTable = getLabelTable(); if (labelTable == null) { return; } - Enumeration labels = labelTable.keys(); + Enumeration labels = labelTable.keys(); while ( labels.hasMoreElements() ) { - JComponent component = (JComponent) labelTable.get(labels.nextElement()); + JComponent component = labelTable.get(labels.nextElement()); component.updateUI(); component.setSize(component.getPreferredSize()); } } private void updateLabelSizes() { - Dictionary labelTable = getLabelTable(); + Dictionary labelTable = getLabelTable(); if (labelTable != null) { - Enumeration labels = labelTable.elements(); + Enumeration labels = labelTable.elements(); while (labels.hasMoreElements()) { - JComponent component = (JComponent) labels.nextElement(); + JComponent component = labels.nextElement(); component.setSize(component.getPreferredSize()); } } @@ -894,7 +894,7 @@ * @throws IllegalArgumentException if {@code increment} is less than or * equal to zero */ - public Hashtable createStandardLabels( int increment ) { + public Hashtable createStandardLabels( int increment ) { return createStandardLabels( increment, getMinimum() ); } @@ -922,7 +922,7 @@ * out of range, or if {@code increment} is less than or equal * to zero */ - public Hashtable createStandardLabels( int increment, int start ) { + public Hashtable createStandardLabels( int increment, int start ) { if ( start > getMaximum() || start < getMinimum() ) { throw new IllegalArgumentException( "Slider label start point out of range." ); } @@ -931,7 +931,7 @@ throw new IllegalArgumentException( "Label incremement must be > 0" ); } - class SmartHashtable extends Hashtable implements PropertyChangeListener { + class SmartHashtable extends Hashtable implements PropertyChangeListener { int increment = 0; int start = 0; boolean startAtMin = false; @@ -978,13 +978,13 @@ if ( e.getPropertyName().equals( "minimum" ) || e.getPropertyName().equals( "maximum" ) ) { - Enumeration keys = getLabelTable().keys(); - Hashtable hashtable = new Hashtable(); + Enumeration keys = getLabelTable().keys(); + Hashtable hashtable = new Hashtable<>(); // Save the labels that were added by the developer while ( keys.hasMoreElements() ) { - Object key = keys.nextElement(); - Object value = labelTable.get(key); + Integer key = keys.nextElement(); + JComponent value = labelTable.get(key); if ( !(value instanceof LabelUIResource) ) { hashtable.put( key, value ); } @@ -996,7 +996,7 @@ // Add the saved labels keys = hashtable.keys(); while ( keys.hasMoreElements() ) { - Object key = keys.nextElement(); + Integer key = keys.nextElement(); put( key, hashtable.get( key ) ); } @@ -1013,7 +1013,7 @@ SmartHashtable table = new SmartHashtable( increment, start ); - Dictionary labelTable = getLabelTable(); + Dictionary labelTable = getLabelTable(); if (labelTable != null && (labelTable instanceof PropertyChangeListener)) { removePropertyChangeListener((PropertyChangeListener) labelTable);