Code example for JSlider

Methods: getOrientation

0
    @Override 
    public Dimension getMinimumSize(JComponent c) {
        // Calculate minimum size. 
        Dimension minimumSize = super.getMinimumSize(c);
         
        if (slider.getOrientation() == JSlider.VERTICAL) {
            // For vertical slider, size must be as wide as the thumb image,  
            // and as tall as the track image. 
            if (verticalThumbImage != null) {
                minimumSize.width = Math.max(verticalThumbImage.getWidth(), minimumSize.width);
            } 
            if (verticalTrackImage != null) {
                minimumSize.height = Math.max(verticalTrackImage.getHeight(), minimumSize.height);
            } 
             
        } else { 
            // For horizontal slider, size must be as tall as the thumb image,  
            // and as wide as the track image. 
            if (horizontalThumbImage != null) {
                minimumSize.height = Math.max(horizontalThumbImage.getHeight(), minimumSize.height);
Connect your IDE to all the code out there  Get Codota for Java