title: scrolling JLabel in Java
body: <p>i have a little issue with jlabel. When the label displays doubles which are to large for the screen, I would like to have a scrollbar to see them anyway. I have just added a scrollbar to the whole panel, but it does not check, when a overlong double is displayed.</p>
  
  <p>here is my code </p>
  
  <pre><code> public class OverviewPanel extends JPanel {
      private static final long serialVersionUID = 1L;
      private JLabel textNoNodes = new JLabel();
      private JLabel textNoEdges = new JLabel();
      private JLabel textInitial = new JLabel();
      private JLabel textTargets = new JLabel();
      private JLabel textFilename = new JLabel();
      private JLabel textProbabilityModelCheck = new JLabel();
      private JLabel textProbabilityCounterExample = new JLabel();
      private JLabel textNoSteps = new JLabel();
  
      public OverviewPanel() {
          super(new SpringLayout());
          addRow("Number states", textNoNodes);
          addRow("Number edges", textNoEdges);
          addRow("Initial", textInitial);
          addRow("Targets", textTargets);
          addRow("Filename", textFilename);
          addRow("Prob. model check", textProbabilityModelCheck);
          addRow("Prob. counter example", textProbabilityCounterExample);
          addRow("Number steps", textNoSteps);
          SpringUtilities.makeCompactGrid(this, 8, 2, // rows, cols
                  6, 6, // initX, initY
                  6, 6); // xPad, yPad
          setDefault();
      }
  
      private void addRow(String text, JComponent component) {
          JLabel l = new JLabel(text);
          add(l);
          l.setLabelFor(component);       
          add(component);
      }
     ...
     }
  </code></pre>