为什么背景不变色啊??请指教!!
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class man extends JFrame
{
public static void main(String[] args)
{
man m=new man();
m.setSize(400,350);
m.setLocation(300,180);
woman w=m.new woman();
m.add(w);
w.setBackground(Color.RED);
m.setVisible(true);
m.setDefaultCloseOperation(man.EXIT_ON_CLOSE);
}
class woman extends JPanel
{
public void paintComponent(Graphics g)
{
Graphics2D g1=(Graphics2D)g;
g1.drawLine(1,1,1,81);
g1.drawLine(11,1,11,81);
g1.drawLine(1,1,81,1);
g1.drawLine(1,11,81,11);
}
}
}