void (JSlider slider) { slider.setMajorTickSpacing(25); slider.setMinorTickSpacing(5); slider.setPaintTicks(true); slider.setPaintLabels(true); slider.setSnapToTicks(true); @SuppressWarnings("UseOfObsoleteCollectionType") var position = new Hashtable<Integer, JLabel>(); position.put(0, new JLabel("Hashtable")); position.put(25, new JLabel("Hash")); position.put(50, new JLabel("Ha")); position.put(75, new JLabel("HashtableHashtable")); position.put(100, new JLabel("100")); slider.setLabelTable(position); }