package example;
//-*- mode:java; encoding:utf-8 -*-
// vim:set fileencoding=utf-8:
//@homepage@
import java.awt.*;
import java.util.*;
import javax.swing.*;

public final class MainPanel extends JPanel {
    public MainPanel() {
        super(new BorderLayout(5, 5));
        Box box = Box.createVerticalBox();
        box.add(Box.createVerticalStrut(5));
        box.add(makeTitledPanel("Default", makeSlider(false)));
        box.add(Box.createVerticalStrut(5));
        box.add(makeTitledPanel("Triangle Tick", makeSlider(true)));
        box.add(Box.createVerticalGlue());
        add(box);
        setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        setPreferredSize(new Dimension(320, 240));
    }

    private JSlider makeSlider(boolean icon) {
        JSlider slider = new JSlider(0, 100);
        slider.setMajorTickSpacing(10);
        slider.setMinorTickSpacing(5);
        slider.setPaintLabels(true);
        slider.setSnapToTicks(true);
        if (icon) {
            Dictionary dictionary = slider.getLabelTable();
            if (Objects.nonNull(dictionary)) {
                Enumeration elements = dictionary.elements();
                Icon tick = new TickIcon();
                while (elements.hasMoreElements()) {
                    JLabel label = (JLabel) elements.nextElement();
                    label.setBorder(BorderFactory.createEmptyBorder(1, 0, 0, 0));
                    label.setIcon(tick);
                    label.setIconTextGap(0);
                    label.setVerticalAlignment(SwingConstants.TOP);
                    label.setVerticalTextPosition(SwingConstants.BOTTOM);
                    label.setHorizontalAlignment(SwingConstants.CENTER);
                    label.setHorizontalTextPosition(SwingConstants.CENTER);
                    label.setForeground(Color.RED);
                }
            }
        } else {
            slider.setPaintTicks(true);
            slider.setForeground(Color.BLUE);
        }
        return slider;
    }

    private JComponent makeTitledPanel(String title, JComponent c) {
        JPanel p = new JPanel(new BorderLayout());
        p.setBorder(BorderFactory.createTitledBorder(title));
        p.add(c);
        return p;
    }

    public static void main(String... args) {
        EventQueue.invokeLater(new Runnable() {
            @Override public void run() {
                createAndShowGUI();
            }
        });
    }
    public static void createAndShowGUI() {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (ClassNotFoundException | InstantiationException
               | IllegalAccessException | UnsupportedLookAndFeelException ex) {
            ex.printStackTrace();
        }
        JFrame frame = new JFrame("@title@");
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.getContentPane().add(new MainPanel());
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }
}

class TickIcon implements Icon {
    @Override public void paintIcon(Component c, Graphics g, int x, int y) {
        g.setColor(Color.BLUE);
        g.drawLine(x + 2, y + 0, x + 2, y + 2);
        g.drawLine(x + 1, y + 1, x + 3, y + 1);
        g.drawLine(x + 0, y + 2, x + 4, y + 2);
    }
    @Override public int getIconWidth() {
        return 5;
    }
    @Override public int getIconHeight() {
        return 3;
    }
}

@@ -949,32 +949,111 @@
 pToTicks(true);%0A
+        slider.putClientProperty(%22Slider.paintThumbArrowShape%22, Boolean.TRUE);%0A
         if (icon
@@ -3227,17 +3227,95 @@
         
-g
+Graphics2D g2 = (Graphics2D) g.create();%0A        g2.translate(x, y);%0A        g2
 .setColo
@@ -3330,32 +3330,33 @@
 BLUE);%0A        g
+2
 .drawLine(x + 2,
@@ -3353,32 +3353,16 @@
 ine(
-x + 2, y + 0, x + 2, y +
+2, 0, 2,
  2);
@@ -3363,32 +3363,33 @@
 2, 2);%0A        g
+2
 .drawLine(x + 1,
@@ -3386,32 +3386,16 @@
 ine(
-x + 1, y + 1, x + 3, y +
+1, 1, 3,
  1);
@@ -3404,16 +3404,17 @@
        g
+2
 .drawLin
@@ -3419,34 +3419,40 @@
 ine(
-x + 0, y + 2, x + 4, y + 2
+0, 2, 4, 2);%0A        g2.dispose(
 );%0A 

use Slider.paintThumbArrowShape property