title: Swing GUI: drawString - How to set the font size of the String being displayed?
body: <p>We all know that the drawString method can be used this way:</p>
  
  <pre><code>import java.awt.Graphics;
  import java.awt.Graphics2D;
  import javax.swing.JComponent;
  import javax.swing.JFrame;
  
  public class Driver {
  
      public static void main(String[] args) {
          JFrame frame = new JFrame("Frame Heading");
          frame.setSize(1000,500);
          myComponent comp = new myComponent();
          frame.add(comp);
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setVisible(true);
      }
  }
  
  class myComponent extends JComponent {
      public void paintComponent(Graphics g) {
          Graphics2D g2 = (Graphics2D) g;
          g2.drawString("Hello World", 300, 300);
      }
  }
  </code></pre>
  
  <p>But, how do we adjust the font size of the string being displayed? I want to make it larger.</p>