class PatternSimilaritySlider extends JSlider {

	final JPopupMenu pop = new JPopupMenu();
	JMenuItem item = new JMenuItem();
	private int curVal = -1;
	private JLabel lblVal = null;

	public PatternSimilaritySlider(int min, int max, int val, JLabel lbl) {
		super(min, max, val);
		curVal = val;
		lblVal = lbl;
		init();
	}

	private void init() {
		showValue(lblVal, curVal);
    setPreferredSize(new Dimension(250, 60));
	}

	@Override
	protected void paintComponent(Graphics g) {
		int w = getWidth();
		final int margin = 13;
		final int y1 = 22, y2 = 33;
    int span = w - margin * 2;
		for (int i = 0; i < span; i++) {
			double score = (double) i / span;
			g.setColor(getScoreColor(score));
			g.drawLine(margin + i, y1, margin + i, y2);
		}
		if (getValue() != curVal) {
			curVal = getValue();
			showValue(lblVal, curVal);
		}
		super.paintComponent(g);
	}

	public void showValue(JLabel lbl, int val) {
		double sim = val > 99 ? 0.99 : (double) val / 100;
		String txt = String.format("   ( %.2f )", sim);
		lbl.setText(txt);
		lbl.repaint();
	}

	static Color getScoreColor(double score) {<FILL_FUNCTION_BODY>}
}

		// map hue to 0.5~1.0
		Color c = new Color(
						Color.HSBtoRGB(0.5f + (float) score / 2, 1.0f, 1.0f));
		// map alpha to 20~150
		Color cMask = new Color(
						c.getRed(), c.getGreen(), c.getBlue(), 20 + (int) (score * 130));
		return cMask;
	
<methods>public void <init>() ,public void <init>(int) ,public void <init>(javax.swing.BoundedRangeModel) ,public void <init>(int, int) ,public void <init>(int, int, int) ,public void <init>(int, int, int, int) ,public void addChangeListener(javax.swing.event.ChangeListener) ,public Hashtable<java.lang.Integer,javax.swing.JComponent> createStandardLabels(int) ,public Hashtable<java.lang.Integer,javax.swing.JComponent> createStandardLabels(int, int) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.event.ChangeListener[] getChangeListeners() ,public int getExtent() ,public boolean getInverted() ,public Dictionary#RAW getLabelTable() ,public int getMajorTickSpacing() ,public int getMaximum() ,public int getMinimum() ,public int getMinorTickSpacing() ,public javax.swing.BoundedRangeModel getModel() ,public int getOrientation() ,public boolean getPaintLabels() ,public boolean getPaintTicks() ,public boolean getPaintTrack() ,public boolean getSnapToTicks() ,public javax.swing.plaf.SliderUI getUI() ,public java.lang.String getUIClassID() ,public int getValue() ,public boolean getValueIsAdjusting() ,public boolean imageUpdate(java.awt.Image, int, int, int, int, int) ,public void removeChangeListener(javax.swing.event.ChangeListener) ,public void setExtent(int) ,public void setFont(java.awt.Font) ,public void setInverted(boolean) ,public void setLabelTable(Dictionary#RAW) ,public void setMajorTickSpacing(int) ,public void setMaximum(int) ,public void setMinimum(int) ,public void setMinorTickSpacing(int) ,public void setModel(javax.swing.BoundedRangeModel) ,public void setOrientation(int) ,public void setPaintLabels(boolean) ,public void setPaintTicks(boolean) ,public void setPaintTrack(boolean) ,public void setSnapToTicks(boolean) ,public void setUI(javax.swing.plaf.SliderUI) ,public void setValue(int) ,public void setValueIsAdjusting(boolean) ,public void updateUI() <variables>protected transient javax.swing.event.ChangeEvent changeEvent,protected javax.swing.event.ChangeListener changeListener,private boolean isInverted,private Dictionary#RAW labelTable,protected int majorTickSpacing,protected int minorTickSpacing,protected int orientation,private boolean paintLabels,private boolean paintTicks,private boolean paintTrack,protected javax.swing.BoundedRangeModel sliderModel,protected boolean snapToTicks,boolean snapToValue,private static final java.lang.String uiClassID