class CSArrayBased
{
    private JPanel panel;
    private PDColorSpace colorSpace = null;
    private int numberOfComponents = 0;
    private String errmsg = "";

    public CSArrayBased(COSArray array)
    {
        try
        {
            colorSpace = PDColorSpace.create(array);
            if (!(colorSpace instanceof PDPattern))
            {
                numberOfComponents = colorSpace.getNumberOfComponents();
            }
        }
        catch (IOException ex)
        {
            errmsg = ex.getMessage();
        }
        initUI();
    }

    private void initUI()
    {<FILL_FUNCTION_BODY>}

    /**
     * return the main panel that hold all the UI elements.
     *
     * @return JPanel instance
     */
    public Component getPanel()
    {
        return panel;
    }

}

        panel = new JPanel();
        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
        panel.setPreferredSize(new Dimension(300, 500));

        if (colorSpace == null)
        {
            JLabel error = new JLabel(errmsg);
            error.setAlignmentX(Component.CENTER_ALIGNMENT);
            error.setFont(new Font(Font.MONOSPACED, Font.BOLD, 15));
            panel.add(error);
            return;
        }
        
        JLabel colorSpaceLabel = new JLabel(colorSpace.getName() + " colorspace");
        colorSpaceLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
        colorSpaceLabel.setFont(new Font(Font.MONOSPACED, Font.BOLD, 30));
        panel.add(colorSpaceLabel);

        if (numberOfComponents > 0)
        {
            JLabel colorCountLabel = new JLabel("Component Count: " + numberOfComponents);
            colorCountLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
            colorCountLabel.setFont(new Font(Font.MONOSPACED, Font.BOLD, 20));
            panel.add(colorCountLabel);
        }

        if (colorSpace instanceof PDICCBased)
        {
            PDICCBased icc = (PDICCBased) colorSpace;
            int colorSpaceType = icc.getColorSpaceType();
            String cs;
            switch (colorSpaceType)
            {
                case ColorSpace.CS_LINEAR_RGB:
                    cs = "linear RGB";
                    break;
                case ColorSpace.CS_CIEXYZ:
                    cs = "CIEXYZ";
                    break;
                case ColorSpace.CS_GRAY:
                    cs = "linear gray";
                    break;
                case ColorSpace.CS_sRGB:
                    cs = "sRGB";
                    break;
                case ColorSpace.TYPE_RGB:
                    cs = "RGB";
                    break;
                case ColorSpace.TYPE_GRAY:
                    cs = "gray";
                    break;
                case ColorSpace.TYPE_CMYK:
                    cs = "CMYK";
                    break;
                default:
                    cs = "type " + colorSpaceType;
                    break;
            }
            JLabel otherLabel = new JLabel("Colorspace type: " + cs);
            otherLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
            otherLabel.setFont(new Font(Font.MONOSPACED, Font.BOLD, 20));
            panel.add(otherLabel);
        }
    
<no_super_class>