@@ -0,0 +1,2235 @@
+package ch.raffael.util.swing.components;%0A%0Aimport java.awt.BorderLayout;%0Aimport java.awt.Color;%0Aimport java.awt.Component;%0A%0Aimport javax.swing.JLabel;%0Aimport javax.swing.JPanel;%0A%0A%0A/**%0A * Holder for another component. Used in GUI designers to provide a container for custom%0A * components or components, that will be created programmatically.%0A *%0A * @author %3Ca href=%22mailto:herzog@raffael.ch%22%3ERaffael Herzog%3C/a%3E%0A */%0Apublic class ComponentHolder extends JPanel %7B%0A%0A    private String description;%0A    private JLabel placeholder;%0A%0A    public ComponentHolder(String description) %7B%0A        this();%0A        setDescription(description);%0A    %7D%0A%0A    public ComponentHolder() %7B%0A        super(new BorderLayout());%0A        setComponent(null);%0A    %7D%0A%0A    public String getDescription() %7B%0A        return description;%0A    %7D%0A%0A    public void setDescription(String description) %7B%0A        this.description = description;%0A        if ( placeholder != null ) %7B%0A            placeholder.setText(labelText(description));%0A        %7D%0A    %7D%0A%0A    private static String labelText(String description) %7B%0A        if ( description == null ) %7B%0A            return %22Component Placeholder%22;%0A        %7D%0A        else %7B%0A            return description;%0A        %7D%0A    %7D%0A%0A    @Override%0A    protected void addImpl(Component comp, Object constraints, int index) %7B%0A        throw new UnsupportedOperationException(%22Use setComponent()%22);%0A    %7D%0A%0A    public Component getComponent() %7B%0A        if ( getComponentCount() == 0 ) %7B%0A            return null;%0A        %7D%0A        else if ( getComponent(0) == placeholder ) %7B%0A            return null;%0A        %7D%0A        else %7B%0A            return getComponent(0);%0A        %7D%0A    %7D%0A%0A    public void setComponent(Component component) %7B%0A        removeAll();%0A        if ( component == null ) %7B%0A            if ( placeholder == null ) %7B%0A                placeholder = new JLabel();%0A                placeholder.setOpaque(true);%0A                placeholder.setBackground(Color.ORANGE);%0A                placeholder.setText(labelText(description));%0A            %7D%0A            super.addImpl(placeholder, BorderLayout.CENTER, 0);%0A        %7D%0A        else %7B%0A            placeholder = null;%0A            super.addImpl(component, BorderLayout.CENTER, 0);%0A        %7D%0A    %7D%0A%0A%7D%0A

Add ComponentHolder.