class CollapsePanel extends javax.swing.JPanel {

    private boolean extended;
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel buttonPanel;
    private javax.swing.JButton extendButton;
    // End of variables declaration//GEN-END:variables

    /**
     * Creates new form CollapsePanel
     */
    public CollapsePanel() {
        initComponents();
    }

    public void init(JComponent topBar, final JComponent extendedPanel, boolean extended) {
        add(topBar, BorderLayout.CENTER);
        add(extendedPanel, BorderLayout.SOUTH);

        this.extended = extended;
        if (extended) {
            extendButton.setIcon(ImageUtilities.loadImageIcon("VisualizationImpl/arrowDown.png", false)); // NOI18N
            extendButton.setRolloverIcon(ImageUtilities.loadImageIcon("VisualizationImpl/arrowDown_rollover.png", false)); // NOI18N

        } else {
            extendButton.setIcon(ImageUtilities.loadImageIcon("VisualizationImpl/arrowUp.png", false)); // NOI18N
            extendButton.setRolloverIcon(
                ImageUtilities.loadImageIcon("VisualizationImpl/arrowUp_rollover.png", false)); // NOI18N
        }
        extendButton.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                boolean ext = CollapsePanel.this.extended;
                ext = !ext;
                CollapsePanel.this.extended = ext;
                if (ext) {
                    extendButton.setIcon(ImageUtilities.loadImageIcon("VisualizationImpl/arrowDown.png", false)); // NOI18N
                    extendButton.setRolloverIcon(ImageUtilities.loadImageIcon("VisualizationImpl/arrowDown_rollover.png", false)); // NOI18N
                } else {
                    extendButton.setIcon(ImageUtilities.loadImageIcon("VisualizationImpl/arrowUp.png", false)); // NOI18N
                    extendButton.setRolloverIcon(ImageUtilities.loadImageIcon("VisualizationImpl/arrowUp_rollover.png", false)); // NOI18N
                }
                extendedPanel.setVisible(ext);

                // Workaround for JOGL bug 1274
                (VizController.getInstance().getDrawable()).reinitWindow();
            }
        });
        if (!extended) {
            extendedPanel.setVisible(extended);
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {<FILL_FUNCTION_BODY>}// </editor-fold>//GEN-END:initComponents
}


        buttonPanel = new javax.swing.JPanel();
        extendButton = new javax.swing.JButton();

        setOpaque(true);
        setLayout(new java.awt.BorderLayout());

        buttonPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 0, 3));

        extendButton.setToolTipText(
            org.openide.util.NbBundle.getMessage(CollapsePanel.class, "CollapsePanel.extendButton.text")); // NOI18N
        extendButton.setAlignmentY(0.0F);
        extendButton.setBorderPainted(false);
        extendButton.setContentAreaFilled(false);
        extendButton.setFocusable(false);
        buttonPanel.add(extendButton);

        add(buttonPanel, java.awt.BorderLayout.EAST);
    
<methods>public void <init>() ,public void <init>(java.awt.LayoutManager) ,public void <init>(boolean) ,public void <init>(java.awt.LayoutManager, boolean) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.plaf.PanelUI getUI() ,public java.lang.String getUIClassID() ,public void setUI(javax.swing.plaf.PanelUI) ,public void updateUI() <variables>private static final java.lang.String uiClassID