title: Workaround for matlab/java slider "Maximum" 1,000,000 bug? (causes bad stepping)
body: <p><strong>ADDENDUM</strong> - The same code works with #items &lt; 1000000.  I tried scaling the data so that the slider's Min and Max were 1/10th of what I show below and therefore &lt; 1,000,000 (the java property Maximum).  It did not fix the problem.  I can only gather that the 1,000,000 java Maximum value has to do with something like the number of increments vs the actual value.</p>
  
  <p>=====</p>
  
  <p>Long story short. I have a slider in a gui set to go between 1 and 1841867.  The relevant Matlab slider handle properties are:</p>
  
  <pre><code>SliderStep = [5.42928e-07 2.71464e-06]
  Max = [1.84187e+06]
  Min = [1]
  </code></pre>
  
  <p>This is setup to yield a minor increment (as per the sliders left/right arrows) of 1:</p>
  
  <pre><code>SliderStep(1)*(1841867-1) == 1
  </code></pre>
  
  <p>However, when I tried using the arrow to increment from 11000 to 11001 I got a slider value of 5973.<br>
  So, I set a breakpoint in the slider callback and confirmed that the slider's value  was in fact 5973.  Looking under the hood I obtained my slider's underlying java objects:</p>
  
  <pre><code>jScrollBar = findjobj(handles.slFrame) 
  </code></pre>
  
  <p>jScrollBar is an array of two java handles with the second one being:</p>
  
  <pre><code>javahandle_withcallbacks.com.mathworks.hg.peer.SliderPeer$MLScrollBar
  </code></pre>
  
  <p>It has a Maximum property and oddly enough it's 1,000,000, i.e.</p>
  
  <pre><code>get(jScrollBar(2), 'Maximum') ==1000000
  </code></pre>
  
  <p>Turns out </p>
  
  <pre><code>SliderStep(1)*(1000000-1)*11001== 5.9727e+03
  </code></pre>
  
  <p>Way to close to the "screw up" value of 5973 (vs 11001) to be a coincidence.  </p>
  
  <p>So, I tried to set that java property to my value of 1841867 (shouldn't that have been done when the slider was created and I gave it the Max property a value of 1841867 as shown in the Matlab slider handle!).  </p>
  
  <pre><code>set(jScrollBar(2),'Maximum',1841867)
  </code></pre>
  
  <p>I then did a get on the same java handle and it showed my new value.  Wonderful.</p>
  
  <p>Unfortunately, when I use the slider again the value is still 5973 and the above java handle object's default value has been reset (reintialized?) to 1,000,000.</p>
  
  <p>Does anybody have a method or magical invocation that will get Matlab(?) to stop resetting/reininitaizling the Maximum value to 1,000,000?</p>