title: How to display a Custom Font Text in a JFrame in java?
body: <p>I have being trying to display a phrase with a custom font onto a JFrame but I only end up with the text without the font. When I compile the following code: </p>
  
  <pre><code>import java.awt.*;
  import javax.swing.*;
  import java.awt.image.*;
  import java.awt.Font.*;
  
  public class JavaPractice{
    public static void main(String[]args){
      JFrame frame = new JFrame("Java Practice!");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.add(label);
      frame.pack();
      frame.getContentPane().setBackground(Color.decode("#101010"));
      frame.setSize(720,480);
      frame.setResizable(false);
      frame.setVisible(true);
      JLabel label = new JLabel("Press Enter To Continue");
      Font font = Font.createFont(Font.TRUETYPE_FONT, getClass().getResourceAsStream("PixelFont.ttf"));
      label.setFont(font.deriveFont(Font.BOLD, 12f));
    }
  }
  </code></pre>
  
  <p>I get feedback from the compiler saying that getClass() is not a non-static method and cannot be referenced from a static context.</p>
  
  <p>It also says that it cannot find the symbol frame.add(label);</p>
  
  <p>Please be specific in your answer since I am not that advanced in Java.</p>