title: JSlider Modifies JLabel Size
body: <p>I'm trying to make a Java program that has a JLabel that is directly modified by a JSlider. I've gotten all of the prettyness over with, but I can't get the Font to work on the JLabel. Below is my code.</p>
  
  <pre><code>int PIX_INIT = 24;
  int PIX_MIN = 0;
  int PIX_MAX = 100;
  JCheckBox text;
  JCheckBox slide;
  JTextField size;
  JSlider pixel;
  JLabel label1;
  JLabel label2;
  
  //Adds header
      JPanel header = new JPanel(new BorderLayout());
      header.setBackground(Color.CYAN);
      header.setSize(400, 50);
      header.setVisible(true);
  
          //Adds content to header
          JPanel content = new JPanel();
          content.setBackground(Color.CYAN);
          label1 = new JLabel("Marker Size: ");
          content.add(label1);
  
          size = new JTextField(5);
          content.add(size);
  
          label2 = new JLabel(" pixels");
          content.add(label2);
          header.add(content, BorderLayout.SOUTH);
          this.add(header, BorderLayout.CENTER);
  
      //Adds body
      JPanel body = new JPanel(new BorderLayout());
      body.setBackground(Color.WHITE);
      body.setSize(400, 325);
      body.setVisible(true);
      this.add(body, BorderLayout.CENTER);
  //End body
  //Creates slider
  
      //Adds slider
      pixel = new JSlider(SwingConstants.HORIZONTAL, PIX_MIN, PIX_MAX, PIX_INIT);
      pixel.setMajorTickSpacing( 10 );
      pixel.setPaintTicks(true);
      this.add(pixel, BorderLayout.SOUTH);
  //End slider
  
  private class SliderHandler implements ChangeListener {
      public void stateChanged(ChangeEvent e) {
          pixel = (JSlider)e.getSource();
          int scale = pixel.getValue();
          Font font = new Font("Serif", Font.PLAIN, scale);
          label1.setFont(font);
          System.out.println(scale);
      }
  }
  </code></pre>