jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java
changeset 1852 958801d67667
parent 715 f16baef3a20e
child 2488 4d54c9133cda
equal deleted inserted replaced
1851:8203c7eb8caf 1852:958801d67667
   834      *         null.
   834      *         null.
   835      * @since 1.6
   835      * @since 1.6
   836      */
   836      */
   837     protected Integer getHighestValue() {
   837     protected Integer getHighestValue() {
   838         Dictionary dictionary = slider.getLabelTable();
   838         Dictionary dictionary = slider.getLabelTable();
   839         if (dictionary != null) {
   839 
   840             Enumeration keys = dictionary.keys();
   840         if (dictionary == null) {
   841             int max = slider.getMinimum() - 1;
   841             return null;
   842             while (keys.hasMoreElements()) {
   842         }
   843                 max = Math.max(max, ((Integer)keys.nextElement()).intValue());
   843 
   844             }
   844         Enumeration keys = dictionary.keys();
   845             if (max == slider.getMinimum() - 1) {
   845 
   846                 return null;
   846         Integer max = null;
   847             }
   847 
   848             return max;
   848         while (keys.hasMoreElements()) {
   849         }
   849             Integer i = (Integer) keys.nextElement();
   850         return null;
   850 
       
   851             if (max == null || i > max) {
       
   852                 max = i;
       
   853             }
       
   854         }
       
   855 
       
   856         return max;
   851     }
   857     }
   852 
   858 
   853     /**
   859     /**
   854      * Returns the smallest value that has an entry in the label table.
   860      * Returns the smallest value that has an entry in the label table.
   855      *
   861      *
   857      *         null.
   863      *         null.
   858      * @since 1.6
   864      * @since 1.6
   859      */
   865      */
   860     protected Integer getLowestValue() {
   866     protected Integer getLowestValue() {
   861         Dictionary dictionary = slider.getLabelTable();
   867         Dictionary dictionary = slider.getLabelTable();
   862         if (dictionary != null) {
   868 
   863             Enumeration keys = dictionary.keys();
   869         if (dictionary == null) {
   864             int min = slider.getMaximum() + 1;
   870             return null;
   865             while (keys.hasMoreElements()) {
   871         }
   866                 min = Math.min(min, ((Integer)keys.nextElement()).intValue());
   872 
   867             }
   873         Enumeration keys = dictionary.keys();
   868             if (min == slider.getMaximum() + 1) {
   874 
   869                 return null;
   875         Integer min = null;
   870             }
   876 
   871             return min;
   877         while (keys.hasMoreElements()) {
   872         }
   878             Integer i = (Integer) keys.nextElement();
   873         return null;
   879 
       
   880             if (min == null || i < min) {
       
   881                 min = i;
       
   882             }
       
   883         }
       
   884 
       
   885         return min;
   874     }
   886     }
   875 
   887 
   876 
   888 
   877     /**
   889     /**
   878      * Returns the label that corresponds to the highest slider value in the label table.
   890      * Returns the label that corresponds to the highest slider value in the label table.