Using Overlayables in GridBagLayout

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Using Overlayables in GridBagLayout

Postby ymene » Wed Oct 27, 2010 1:51 am

Hello everyone,

lately we deceided to try using Overlayables for userfeedback, when something is wrong within a textfield. All was fine, until we installed them on dialogs with GridBagLayout (which is the case for most of our dialogs). The Icon doesnt get displayed anymore, unless its activated by default. I prepared a small example to give you an impression of what I am talking about:

Code: Select all
/**
 * Example: weird behaviour for Overlays within a GridBagLayout.
 */
public class OverlayWeirdBehaviourExample extends JPanel
{
  public OverlayWeirdBehaviourExample()
  {
    // If any other Layout is used it works as well.
    setLayout( new GridBagLayout() );

    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.insets = new Insets( 10, 10, 10, 10 );

    JLabel correctIcon =
        new JLabel( OverlayableUtils.getPredefinedOverlayIcon( OverlayableIconsFactory.ATTENTION ) );
    correctIcon.setToolTipText( "Error ..." );
    correctIcon.setCursor( Cursor.getPredefinedCursor( Cursor.HAND_CURSOR ) );

    final DefaultOverlayable overlayTextField =
        new DefaultOverlayable( new OverlayTextField( "Text Field", 10 ), correctIcon,
            SwingConstants.NORTH_EAST );

    //Without setting it to false, it also works on gridbaglayout!
    overlayTextField.setOverlayVisible( false );
    add( overlayTextField, c );

    JButton button = new JButton( "change state" );
    c = new GridBagConstraints();
    c.gridx = 1;
    c.gridy = 0;
    c.insets = new Insets( 10, 10, 10, 10 );
    button.addActionListener( new ActionListener()
    {
      @Override
      public void actionPerformed( ActionEvent e )
      {
        if ( overlayTextField.getOverlayComponents()[ 0 ].isVisible() )
        {
          overlayTextField.setOverlayVisible( false );
          System.out.println( "false" );
        }
        else
        {
          overlayTextField.setOverlayVisible( true );
          System.out.println( "true" );
        }
      }
    } );
    add( button, c );
  }

  public static void main( String[] args )
  {
    JFrame frame = new JFrame( "OverlayWeirdBehaviourExample" );
    frame.add( new OverlayWeirdBehaviourExample() );
    frame.pack();
    frame.setLocationByPlatform( true );
    frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    frame.setVisible( true );
  }
}


Switching the LayoutManager to any other LayoutManager and the Example works. It also works fine (even within GridBagLayout), when I comment out the line:

Code: Select all
overlayTextField.setOverlayVisible( false );


But since we dont want the icon to be shown, when everything is fine, that aint an option. Has anyone an idea of what we do wrong?

Thank you very much in advance,
ymene
ymene
 
Posts: 2
Joined: Wed Oct 27, 2010 1:28 am

Re: Using Overlayables in GridBagLayout

Postby JIDE Support » Wed Oct 27, 2010 3:37 pm

Thanks for bug report. Will fix the issue in 2.10.2.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Using Overlayables in GridBagLayout

Postby JIDE Support » Wed Nov 17, 2010 7:19 pm

Just so you know, this is fixed in 2.10.2 just released.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Using Overlayables in GridBagLayout

Postby ymene » Mon Nov 22, 2010 8:21 am

Just tested it and it works as expected. Thank you very much for informing me!
ymene
 
Posts: 2
Joined: Wed Oct 27, 2010 1:28 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 4 guests