import java.awt.Font;
import javax.swing.*;
import javax.swing.border.EtchedBorder;

        // A simple note display. Used as a visualization of
        // the actions of a Note class.
class NoteDisplay extends JLabel {
    public NoteDisplay(){
        super("                              ",JLabel.CENTER);
        setBorder(new EtchedBorder(EtchedBorder.LOWERED));
        getFridge().addComponent(this);
    }

    public void showMessage(String message){
        setText(message);
        delay();
    }

    private void delay(){
        // Notify the parent frame of a change of contents.
        getFridge().validate();
        final int sleepTime = 3000;
        try{
            Thread.sleep(sleepTime);
        }
        catch(Exception e){
        }
    }

    private static Fridge getFridge(){
        return fridge;
    }

    // The refrigerator shared by all Notes. displays.
    private static final Fridge fridge = new Fridge();
    private static final int textSize = 20;
    private static final Font font = new Font("SansSerif",Font.BOLD,textSize);
    {
        setFont(font);
    }
}
