import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Dimension;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Font;
import java.awt.Rectangle;

public class Example7 {
	public static void main(String[] args) {
		
		// The window to hold the panel
		JFrame frame = new JFrame("GUI Example");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setLocation(200,200);
		
		// All drawing is done on the panel
		JPanel thePanel = new JPanel();
		thePanel.setPreferredSize(new Dimension(300,300));
		thePanel.setBackground(Color.WHITE);
		
		// To see the panel it must be "added" to the frame
		// and set visible
		frame.getContentPane().add(thePanel);
		frame.pack();
		frame.setVisible(true);
		
		// This line gets the "pen" (Graphics2D object) to draw with
		Graphics2D g = (Graphics2D)thePanel.getGraphics();

		// When this is printed the spacing is off because 
		// the font used prints some characters bigger than others.
		// A monospaced font prints all characters the same size.
		String heat1 = "-------------------";
		String heat2 = "|                 |";
		String heat3 = "|    Go Heat!     |";
		String heat4 = "|                 |";
		String heat5 = "-------------------";
		
		
		g.drawString(heat1,20,30);
		g.drawString(heat2,20,40);
		g.drawString(heat3,20,50);
		g.drawString(heat4,20,60);
		g.drawString(heat5,20,70);
		
		g.setFont(new Font("monospaced",Font.BOLD,20));
		
		// When this is printed the spacing OK because 
		// the font used is a monospaced font that 
		// prints all characters the same size.
				
		g.drawString(heat1,20,130);
		g.drawString(heat2,20,140);
		g.drawString(heat3,20,150);
		g.drawString(heat4,20,160);
		g.drawString(heat5,20,170);
		
		Rectangle littleRectangle = new Rectangle(20,200,200, 20);
		g.setColor(Color.ORANGE);
		// this draws and fills the rectangle
		g.fill(littleRectangle);
		
		Rectangle bigRectangle = new Rectangle(5,5,290,290);
		g.setColor(Color.RED);
		// this just outlines the rectangle
		g.draw(bigRectangle);
		
		
	} // end main
	
} // end Example7
