import javax.swing.*; import java.awt.Color; public class JColorTest1 extends JFrame{ public static void main(String[] args){ JColorTest1 frame = new JColorTest1(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(10, 10, 300, 200); frame.setTitle("ƒ^ƒCƒgƒ‹"); frame.setVisible(true); } JColorTest1(){ JLabel label1 = new JLabel(" COLOR sample "); label1.setOpaque(true); label1.setBackground(new Color(255,0,0)); JLabel label2 = new JLabel(" COLOR sample "); label2.setOpaque(true); label2.setBackground(new Color(0,128,128)); JPanel p = new JPanel(); p.add(label1); p.add(label2); getContentPane().add(p); } }