예제 #1
0
 private TreeMap<Integer, String> getSortedTree() {
   Dictionary dictionary = jSlider.getLabelTable();
   TreeMap<Integer, String> treeMap = new TreeMap<Integer, String>();
   for (Enumeration indices = dictionary.keys(); indices.hasMoreElements(); ) {
     Integer index = (Integer) indices.nextElement();
     JComponent component = (JComponent) dictionary.get(index);
     treeMap.put(index, ComponentUtils.getDisplayedName(component));
   }
   return treeMap;
 }
예제 #2
0
 private int getIndexForLabel(String label) {
   Dictionary dictionary = jSlider.getLabelTable();
   for (Enumeration indices = dictionary.keys(); indices.hasMoreElements(); ) {
     Integer index = (Integer) indices.nextElement();
     JComponent component = (JComponent) dictionary.get(index);
     if (label.equals(ComponentUtils.getDisplayedName(component))) {
       return index;
     }
   }
   return -1;
 }
예제 #3
0
 private String getCurrentLabel() {
   int value = jSlider.getValue();
   Dictionary dictionary = jSlider.getLabelTable();
   for (Enumeration indices = dictionary.keys(); indices.hasMoreElements(); ) {
     Integer index = (Integer) indices.nextElement();
     JComponent component = (JComponent) dictionary.get(index);
     if (Utils.equals(index, value)) {
       return ComponentUtils.getDisplayedName(component);
     }
   }
   return null;
 }