/** * Expands or collapses this <code>JCollapsiblePane</code>. * * <p> * * <p>If the component is collapsed and <code>val</code> is false, then this call expands the * JCollapsiblePane, such that the entire JCollapsiblePane will be visible. If {@link * #isAnimated()} returns true, the expansion will be accompanied by an animation. * * <p> * * <p>However, if the component is expanded and <code>val</code> is true, then this call collapses * the JCollapsiblePane, such that the entire JCollapsiblePane will be invisible. If {@link * #isAnimated()} returns true, the collapse will be accompanied by an animation. * * @javabean.property bound="true" preferred="true" * @see #isAnimated() * @see #setAnimated(boolean) */ public void setCollapsed(boolean val) { if (collapsed != val) { collapsed = val; if (isAnimated()) { if (collapsed) { setAnimationParams( new AnimationParams(30, Math.max(8, wrapper.getHeight() / 10), 1.0f, 0.01f)); animator.reinit(wrapper.getHeight(), 0); animateTimer.start(); } else { setAnimationParams( new AnimationParams( 30, Math.max(8, getContentPane().getPreferredSize().height / 10), 0.01f, 1.0f)); animator.reinit(wrapper.getHeight(), getContentPane().getPreferredSize().height); animateTimer.start(); } } else { wrapper.c.setVisible(!collapsed); invalidate(); doLayout(); } repaint(); firePropertyChange("collapsed", !collapsed, collapsed); } }