Collections.sort(
priorityList,
new Comparator() {
public int compare(Object o1, Object o2) {
Level p1 = (Level) o1;
Level p2 = (Level) o2;
if (p1.toInt() == p2.toInt()) {
return 0;
} else if (p1.toInt() < p2.toInt()) {
return -1;
}
return 1;
}
});
setModel(
new DefaultBoundedRangeModel(
priorityList.indexOf(Level.TRACE), 0, 0, priorityList.size() - 1));
Hashtable labelMap = new Hashtable();
for (Iterator iter = priorityList.iterator(); iter.hasNext();) {
Level item = (Level) iter.next();
labelMap.put(
new Integer(priorityList.indexOf(item)), new JLabel(item.toString()));
// System.out.println("creating levels for :: " + item.toInt() + "," + item.toString());
}
setOrientation(JSlider.VERTICAL);