class Test1 extends JFrame{
Test1(){
this.getContentPane().setLayout(new FlowLayout());
JLabel l = new JLabel("111111");
l.setBackground(Color.red);
l.setOpaque(true);
this.getContentPane().add(l);
this.setSize(300, 300);
this.setVisible(true);
}
public static void main(String[] args){
new Test1();
}
}