/* Generated by Together */

package gui;

import java.util.*;
import java.io.FileNotFoundException;
import java.awt.Font;
import javax.swing.*;
import javax.swing.JPanel;
import javax.swing.border.*;
import java.net.URL;
import evolution.InfoList;

public class InfoPanel extends JPanel {

    public InfoPanel(InfoList infoList, String title, String iconPath, boolean lowered) {
        this.title = title;
        this.iconPath = iconPath;
        this.lowered = lowered;
        setPreferences();
        add(new InfoTable(infoList, iconPath));
    }

    protected void refresh(InfoList infoList) {
        removeAll();
        add(new InfoTable(infoList, iconPath));
        revalidate();
    }

    protected void setPreferences() {
        if (!lowered) {
            if (title != null) setBorder(new TitledBorder(title));
        } else {
            if (title == null) setBorder(new SoftBevelBorder(BevelBorder.LOWERED));
            else setBorder(new CompoundBorder(new TitledBorder(title), new SoftBevelBorder(BevelBorder.LOWERED)));
        }
    }

    private static String title;
    private static String iconPath;
    private static boolean lowered;
}
