Run the code below. The JSlider thumb is twice smaller:
--------------
import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JSlider;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.plaf.metal.MetalLookAndFeel;
public class JSliderTest {
public static void main(String[] args) {
System.setProperty("sun.java2d.uiScale", "2");
SwingUtilities.invokeLater(() -> {
try {
UIManager.setLookAndFeel(new MetalLookAndFeel());
} catch (Exception e) {
throw new RuntimeException(e);
}
JFrame frame = new JFrame();
frame.setSize(300, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel = new JPanel(new FlowLayout());
JSlider slider = new JSlider();
panel.add(slider);
frame.getContentPane().add(panel);
frame.setVisible(true);
});
}
}
--------------