setRound ( StyleConstants.smallRound );
setLayout ( new BorderLayout ( 0, 0 ) );
// Header
headerPanel = new WebPanel ();
headerPanel.setOpaque ( true );
headerPanel.setUndecorated ( false );
headerPanel.setShadeWidth ( 0 );
headerPanel.setLayout ( new BorderLayout () );
headerPanel.addMouseListener ( new MouseAdapter ()
{
@Override
public void mouseReleased ( final MouseEvent e )
{
if ( isAllowAction ( e ) )
{
invertExpandState ();
takeFocus ();
}
}
private boolean isAllowAction ( final MouseEvent e )
{
return SwingUtilities.isLeftMouseButton ( e ) && SwingUtils.size ( WebCollapsiblePane.this ).contains ( e.getPoint () );
}
} );
headerPanel.addKeyListener ( new KeyAdapter ()
{
@Override
public void keyReleased ( final KeyEvent e )
{
if ( Hotkey.ENTER.isTriggered ( e ) || Hotkey.SPACE.isTriggered ( e ) )
{
invertExpandState ();
}
}
} );
updateHeaderPosition ();
updateDefaultTitleComponent ( icon, title );
updateDefaultTitleBorder ();
expandButton = new WebButton ( collapseIcon );
expandButton.setUndecorated ( true );
expandButton.setFocusable ( false );
expandButton.setMoveIconOnPress ( false );
expandButton.addActionListener ( new ActionListener ()
{
@Override
public void actionPerformed ( final ActionEvent e )
{
invertExpandState ();
takeFocus ();
}
} );
setStateIcons ();
updateStateIconMargin ();
updateStateIconPosition ();
// Content
contentPanel = new WebPanel ()
{
@Override
public Dimension getPreferredSize ()
{
final Dimension ps = super.getPreferredSize ();