src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java

Print this page

        

*** 395,411 **** * @since 1.6 */ protected boolean labelsHaveSameBaselines() { if (!checkedLabelBaselines) { checkedLabelBaselines = true; ! Dictionary<Integer, ? extends JComponent> dictionary = slider.getLabelTable(); if (dictionary != null) { sameLabelBaselines = true; ! Enumeration<? extends JComponent> elements = dictionary.elements(); int baseline = -1; while (elements.hasMoreElements()) { ! JComponent label = elements.nextElement(); Dimension pref = label.getPreferredSize(); int labelBaseline = label.getBaseline(pref.width, pref.height); if (labelBaseline >= 0) { if (baseline == -1) { --- 395,412 ---- * @since 1.6 */ protected boolean labelsHaveSameBaselines() { if (!checkedLabelBaselines) { checkedLabelBaselines = true; ! @SuppressWarnings("rawtypes") ! Dictionary dictionary = slider.getLabelTable(); if (dictionary != null) { sameLabelBaselines = true; ! Enumeration<?> elements = dictionary.elements(); int baseline = -1; while (elements.hasMoreElements()) { ! JComponent label = (JComponent) elements.nextElement(); Dimension pref = label.getPreferredSize(); int labelBaseline = label.getBaseline(pref.width, pref.height); if (labelBaseline >= 0) { if (baseline == -1) {
*** 756,784 **** getHandler().propertyChange(e); } } protected int getWidthOfWidestLabel() { ! Dictionary<?, ? extends JComponent> dictionary = slider.getLabelTable(); int widest = 0; if ( dictionary != null ) { Enumeration<?> keys = dictionary.keys(); while ( keys.hasMoreElements() ) { ! JComponent label = dictionary.get(keys.nextElement()); widest = Math.max( label.getPreferredSize().width, widest ); } } return widest; } protected int getHeightOfTallestLabel() { ! Dictionary<?, ? extends JComponent> dictionary = slider.getLabelTable(); int tallest = 0; if ( dictionary != null ) { Enumeration<?> keys = dictionary.keys(); while ( keys.hasMoreElements() ) { ! JComponent label = dictionary.get(keys.nextElement()); tallest = Math.max( label.getPreferredSize().height, tallest ); } } return tallest; } --- 757,787 ---- getHandler().propertyChange(e); } } protected int getWidthOfWidestLabel() { ! @SuppressWarnings("rawtypes") ! Dictionary dictionary = slider.getLabelTable(); int widest = 0; if ( dictionary != null ) { Enumeration<?> keys = dictionary.keys(); while ( keys.hasMoreElements() ) { ! JComponent label = (JComponent) dictionary.get(keys.nextElement()); widest = Math.max( label.getPreferredSize().width, widest ); } } return widest; } protected int getHeightOfTallestLabel() { ! @SuppressWarnings("rawtypes") ! Dictionary dictionary = slider.getLabelTable(); int tallest = 0; if ( dictionary != null ) { Enumeration<?> keys = dictionary.keys(); while ( keys.hasMoreElements() ) { ! JComponent label = (JComponent) dictionary.get(keys.nextElement()); tallest = Math.max( label.getPreferredSize().height, tallest ); } } return tallest; }
*** 845,866 **** * @return biggest value that has an entry in the label table, or * null. * @since 1.6 */ protected Integer getHighestValue() { ! Dictionary<Integer, ?> dictionary = slider.getLabelTable(); if (dictionary == null) { return null; } ! Enumeration<Integer> keys = dictionary.keys(); Integer max = null; while (keys.hasMoreElements()) { ! Integer i = keys.nextElement(); if (max == null || i > max) { max = i; } } --- 848,870 ---- * @return biggest value that has an entry in the label table, or * null. * @since 1.6 */ protected Integer getHighestValue() { ! @SuppressWarnings("rawtypes") ! Dictionary dictionary = slider.getLabelTable(); if (dictionary == null) { return null; } ! Enumeration<?> keys = dictionary.keys(); Integer max = null; while (keys.hasMoreElements()) { ! Integer i = (Integer) keys.nextElement(); if (max == null || i > max) { max = i; } }
*** 874,895 **** * @return smallest value that has an entry in the label table, or * null. * @since 1.6 */ protected Integer getLowestValue() { ! Dictionary<Integer, ? extends JComponent> dictionary = slider.getLabelTable(); if (dictionary == null) { return null; } ! Enumeration<Integer> keys = dictionary.keys(); Integer min = null; while (keys.hasMoreElements()) { ! Integer i = keys.nextElement(); if (min == null || i < min) { min = i; } } --- 878,900 ---- * @return smallest value that has an entry in the label table, or * null. * @since 1.6 */ protected Integer getLowestValue() { ! @SuppressWarnings("rawtypes") ! Dictionary dictionary = slider.getLabelTable(); if (dictionary == null) { return null; } ! Enumeration<?> keys = dictionary.keys(); Integer min = null; while (keys.hasMoreElements()) { ! Integer i = (Integer) keys.nextElement(); if (min == null || i < min) { min = i; } }
*** 1132,1152 **** } public void paintLabels( Graphics g ) { Rectangle labelBounds = labelRect; ! Dictionary<Integer, ? extends JComponent> dictionary = slider.getLabelTable(); if ( dictionary != null ) { ! Enumeration<Integer> keys = dictionary.keys(); int minValue = slider.getMinimum(); int maxValue = slider.getMaximum(); boolean enabled = slider.isEnabled(); while ( keys.hasMoreElements() ) { ! Integer key = keys.nextElement(); int value = key.intValue(); if (value >= minValue && value <= maxValue) { ! JComponent label = dictionary.get(key); label.setEnabled(enabled); if (label instanceof JLabel) { Icon icon = label.isEnabled() ? ((JLabel) label).getIcon() : ((JLabel) label).getDisabledIcon(); --- 1137,1158 ---- } public void paintLabels( Graphics g ) { Rectangle labelBounds = labelRect; ! @SuppressWarnings("rawtypes") ! Dictionary dictionary = slider.getLabelTable(); if ( dictionary != null ) { ! Enumeration<?> keys = dictionary.keys(); int minValue = slider.getMinimum(); int maxValue = slider.getMaximum(); boolean enabled = slider.isEnabled(); while ( keys.hasMoreElements() ) { ! Integer key = (Integer)keys.nextElement(); int value = key.intValue(); if (value >= minValue && value <= maxValue) { ! JComponent label = (JComponent) dictionary.get(key); label.setEnabled(enabled); if (label instanceof JLabel) { Icon icon = label.isEnabled() ? ((JLabel) label).getIcon() : ((JLabel) label).getDisabledIcon();