Java tutorial
//package com.java2s; import java.awt.Color; import javax.swing.JLabel; import javax.swing.JPanel; public class Main { /** * Returns a "warning"-colored panel with given message. * * @param context * @param message * @return */ public static JPanel constructWarningPanel(String message) { JPanel p = new JPanel(); JLabel l = new JLabel(message); // "magical" color p.setBackground(new Color(240, 40, 70)); p.add(l); return p; } }