title: NullPointerException SynthLabelUI
body: <p>I have a <code>NullPointerException</code> that I don't understand. Usually, the console points to a line in my code when this happens. This time, it's pointing to </p>
  
  
  
  <pre class="lang-java prettyprint-override"><code>at javax.swing.plaf.synth.SynthLabelUI.getPreferredSize(SynthLabelUI.java:238)
  </code></pre>
  
  <p>which as far as I understand, is not in my code. Would someone please explain to me what's going on? </p>
  
  <pre class="lang-java prettyprint-override"><code>Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException
  at javax.swing.plaf.synth.SynthLabelUI.getPreferredSize(SynthLabelUI.java:238)
  at javax.swing.JComponent.getPreferredSize(JComponent.java:1660)
  at javax.swing.plaf.basic.BasicSliderUI.getHeightOfTallestLabel(BasicSliderUI.java:775)
  at javax.swing.plaf.synth.SynthSliderUI.layout(SynthSliderUI.java:378)
  at javax.swing.plaf.synth.SynthSliderUI.calculateGeometry(SynthSliderUI.java:343)
  at javax.swing.plaf.basic.BasicSliderUI$Handler.componentResized(BasicSliderUI.java:1496)
  at java.awt.Component.processComponentEvent(Component.java:6331)
  at java.awt.Component.processEvent(Component.java:6285)
  at java.awt.Container.processEvent(Container.java:2229)
  at java.awt.Component.dispatchEventImpl(Component.java:4861)
  at java.awt.Container.dispatchEventImpl(Container.java:2287)
  at java.awt.Component.dispatchEvent(Component.java:4687)
  at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:723)
  at java.awt.EventQueue.access$200(EventQueue.java:103)
  at java.awt.EventQueue$3.run(EventQueue.java:682)
  at java.awt.EventQueue$3.run(EventQueue.java:680)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
  at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
  at java.awt.EventQueue$4.run(EventQueue.java:696)
  at java.awt.EventQueue$4.run(EventQueue.java:694)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
  at java.awt.EventQueue.dispatchEvent(EventQueue.java:693)
  at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
  at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
  at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
  at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
  </code></pre>
  
  <p>I'm painting custom labels with</p>
  
  <pre class="lang-java prettyprint-override"><code>private void setSliderLabels() {
      Dictionary&lt;Integer, JLabel&gt; table = new Hashtable&lt;Integer, JLabel&gt;();
      table.put(-256, new JLabel("-w/2"));
      table.put(-128, new JLabel("-w/4"));
      table.put(0, new JLabel("0"));
      table.put(128, new JLabel("w/4"));
      table.put(256, new JLabel("w/2"));
      LSlider.setLabelTable(table);
      QSlider.setLabelTable(table);
  }
  </code></pre>