JDK-6209767 : JDesktopPane/BasicDesktopPaneUI does not manage correctly its cache
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2004-12-16
  • Updated: 2024-10-07
  • Resolved: 2014-04-07
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Windows 2000 5.00.2195 SP4

A DESCRIPTION OF THE PROBLEM :
Under 1.4.2 and also 1.5.0, <Ctrl-F6> fails in navigating between between internal frames with keyboard.
 
When putting a JComponent as "back image", cache is incorrectly computed : it is computed every time AND JComponent is taken in the cache when further usage suppose that it can only be JInternalFrame or BasicDesktopPaneUI.

Note that removing the back panel makes the navigation OK.
Trying to put a "not JComponent" (like a Container) does not solve, it generates a NPE at cache usage.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the provided class, hit more than 3 times the "New" menu item.
Then use <CTRL-F6>  to navigate through the internal frames.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Focus must go through all the opened internal frames
ACTUAL -
Only the two last focused internal frames are navigated

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.Color;
import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder;

public class EcranApplication extends javax.swing.JFrame
{
  int nbFrames = 0;
  
  public EcranApplication()
  {
    super();

    setVisible(false);
    setResizable(true);
  	setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
	  setSize(800, 570);

    final javax.swing.JDesktopPane desk = new javax.swing.JDesktopPane();
    setContentPane( desk ) ;

    javax.swing.JTextArea postIt = new javax.swing.JTextArea( 12, 41 );
    postIt.setBackground(new Color(255, 255, 123) );
    postIt.setDisabledTextColor(Color.black);
    postIt.setWrapStyleWord(true) ;
    postIt.setLineWrap(true) ;
    postIt.setEnabled(false);
    postIt.setEditable(false);

    postIt.setBorder(
        new TitledBorder( new LineBorder(Color.black, 1), "Message",
                          TitledBorder.CENTER, TitledBorder.BELOW_TOP
                        )
                    );
    postIt.setSize(postIt.getPreferredSize());
	  postIt.setLocation( 0, 0 );
	  postIt.setText("...This is a long long long text shown as message of the day,\ncan be updated at connexion time for instance...");
	  
    int largPostIt = postIt.getWidth();
    int hautPostIt = postIt.getHeight();
	  int xLab = (800  - largPostIt) / 2;
	  int yLab = ( 570 - hautPostIt) / 2;
		javax.swing.JLabel lab = new javax.swing.JLabel();
	  lab.setBounds( xLab, yLab, largPostIt, hautPostIt );
	  lab.add( postIt, 0 );
		// putting the followibg line in comment makes CTRL-F6 OK
	  desk.add( lab, javax.swing.JLayeredPane.DEFAULT_LAYER) ;
		
		setJMenuBar( new javax.swing.JMenuBar() );
		javax.swing.JMenuItem fileMenuItem= new javax.swing.JMenuItem(
		    new javax.swing.AbstractAction("New")
			  {
			    public void actionPerformed(java.awt.event.ActionEvent e)
			    {
			      javax.swing.JInternalFrame fen = new javax.swing.JInternalFrame();
					  fen.setClosable(true);
					  fen.setDefaultCloseOperation(javax.swing.JFrame.DISPOSE_ON_CLOSE);
					  fen.setIconifiable(true);
					  fen.setMaximizable(true);
					  fen.setResizable(true);
					  fen.setSize(360,180);
					  fen.setTitle("Internal Frame #"+nbFrames++);
					  fen.setLocation(20*nbFrames, 20*nbFrames);
			      desk.add(fen);
			      
			      fen.setVisible(true);
			      if (fen.isClosed())
			      {
			        try
			        {   fen.setClosed(false);    }
			        catch (java.beans.PropertyVetoException e1)
			        {  e1.printStackTrace();  }
			      }
			
			      if (fen.isIcon())
			      {
			        try
			        { fen.setIcon(false); }
			        catch (java.beans.PropertyVetoException e1) {  e1.printStackTrace(); }
			      }
			     
			      show();
			      try { fen.setSelected(true); }
			      catch (Exception e2) {e2.printStackTrace();};
			     }
			  } );
		getJMenuBar().add(fileMenuItem);
		
		addWindowListener( new java.awt.event.WindowAdapter()
			  {
			    public void windowClosing(java.awt.event.WindowEvent e)
			    {
						  setVisible(false);
						  System.exit(0);
			    }
			  });
  }

	public static void main (java.lang.String args[])
	{
		try
		{
		  EcranApplication ecran = new EcranApplication();
		  ecran.show();
		}
		catch (java.lang.Throwable e) { e.printStackTrace(); }
	}
}


---------- END SOURCE ----------
###@###.### 2004-12-16 22:04:29 GMT

Comments
The issue is reproduced in 1.5.0_55 and is not reproduced in JDK 1.6.0_46
07-04-2014

EVALUATION The last message in the forum suggests the bug appears to be fixed. Verify this in dolphin.
13-06-2006

EVALUATION Contribution forum : https://jdk-collaboration.dev.java.net/servlets/ProjectForumMessageView?forumID=1463&messageID=13505
08-06-2006