import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Stickman extends JPanel{
public void paintComponent(Graphics g)
{
super.paintComponent(g);
//Color SKY = new Color(135, 206, 235);
this.setBackground(Color.WHITE);
g.setColor(Color.BLUE);
g.fillRect(30, 100, 10, 5);
g.setColor(Color.gray);
g.fillRect(30, 120, 10, 5);
}
}
import javax.swing.*;
public class WindowPerameters {
public static void main (String[] args)
{
JFrame f = new JFrame ("Hangman");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Stickman s = new Stickman();
f.add(s);
f.setSize(600, 300);
f.setVisible(true);
}
}

You’re not executing the Swing code inside the event dispatch thread. See http://docs.oracle.com/javase/6/docs/api/javax/swing/package-summary.html#threading.
Also, you shouldn’t change the panel’s background inside the paintComponent method. Use this method to paint the component, but not to modify its properties.