title: Resizing Jpanel when resizing JFrame
body: <p>I need to draw a x-y axis coordinate system on a JPanel. I want to implement a function that when resize JFrame, the x,y axis coordinate can resize automatically.</p>
  
  <pre><code>public void paintComponent(Graphics gl) {
  
   Graphics2D g = (Graphics2D) gl;
   g.setColor(new Color(222, 222, 222));
   g.fillRect(0, 0, this.getWidth(), this.getHeight());
   g.setColor(new Color(0, 0, 0));
   int x=15;
   int y=15;
   g.drawString("20", 0, 10);
   for(int i=1;i&lt;=20;i++) {
       g.drawLine(x, y+(35*(i-1)), x, y+(35*i));
       g.drawString(""+(20-i), 0, y+(35*i));
   }
   for(int i=1;i&lt;=10;i++) {
       g.drawLine(x+(70*(i-1)),715, x+(70*i), 715);
       g.drawString(""+i,  x+(70*i),730);
   }
  }
  </code></pre>
  
  <p>This is how I draw the x y coordinate system.<br>
  Could you give me hint for resizing it ?</p>