Code example for JSlider

Methods: setMaximum

0
 
         if ( max_mem < mem_cap ) {
             max_mem = mem_cap;
         } 
 
         memoryCapacitySlider.setMaximum((int) max_mem);
     } 
 
    /** 
     * Responce to slider changes 
     */ 
    public void stateChanged(ChangeEvent e) {
        JSlider slider = (JSlider) e.getSource();
 
        if ( slider == memoryCapacitySlider ) {
            memoryCapacityLabel.setText( slider.getValue() + " MB" );
            cache.setMemoryCapacity( (long) slider.getValue() * 1024L * 1024L );
 
            if ( statistics != null ) {
                memoryCapacity = (float) cache.getMemoryCapacity();