Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6526378

JInternalFrame glasspane anomoly between Java 5 and Java 6

    XMLWordPrintable

    Details

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.6.0"
        Java(TM) SE Runtime Environment (build 1.6.0-b105)
        Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)


        ADDITIONAL OS VERSION INFORMATION :

        Microsoft Windows XP [Version 5.1.2600]


        A DESCRIPTION OF THE PROBLEM :
        There is a descrepancy in the behavior of a JInternalFrame
        glass pane between Java 5 and Java 6.


        I have an application that has JDesktopPane in which Several
        JInternalFrame subclasses are added.

        The JInternalFrame subclass installs a GlassPane thusly:

               setGlassPane(new Component() {
                    public void setVisible(boolean b) {
                        super.setVisible(false);
                    }
                });

        The goal is to prevent the frame from being raised when
        the user click on a component in the
        content pane, but do raise the frame when the title bar
        or frame handles are clicked.


        Under Java 5 this would prevent the JInternalFrame from
        being raised when the mouse was clicked in the content
        area of the internal frame. Our application had several
        integrated features that rely on the internal frame not being
        raised during user interaction. But would be raised when
        the user clicks on the title bar of the internal frame.

        The behavior that we are emulating is similar to the X
        windows feature of the focus following the mouse but with
        out the internal frame gaining focus or raising when the
        mouse enters the internal frame or is clicked on the
        content area.

        A program is provided.

        When executed under Java 5 clicking on the button in the
        internal frame invokes the button but does not raise the
        frame.

        When executed under Java 6. The frame is always raised.

        The desired behavior is that the frame is raised only when
        the title bar or frame handles are clicked.


        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        1. Run the provided program under Java 5.

        2. Click button in lower frame. Frame does not raise.

        3. Run the provided program under Java 6.

        4. Click the button in the lower frame. Frame raises.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Lower frame does not raise when content pane components are clicked.
        ACTUAL -
        Lower frames raises when content pane components are clicked.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------



        /*
         * DeskTopTest.java
         *
         * Created on February 16, 2007, 8:06 AM
         */
         
        package com.rolands.framework.test;
         
        import java.awt.Component;
        import javax.swing.JInternalFrame;
         
        /**
         *
         * @author David J. Ward
         */
        public class DeskTopTest extends javax.swing.JFrame {
            
            /** Creates new form DeskTopTest */
            public DeskTopTest() {
                initComponents();
                jInternalFrame1.setGlassPane(new Component() {
                    public void setVisible(boolean b) {
                        super.setVisible(false);
                    }
                });
                jInternalFrame2.setGlassPane(new Component() {
                    public void setVisible(boolean b) {
                        super.setVisible(false);
                    }
                });
            }
            
            /** 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.
             */
            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
            private void initComponents() {
                desktop = new javax.swing.JDesktopPane();
                jInternalFrame1 = new javax.swing.JInternalFrame();
                jButton1 = new javax.swing.JButton();
                jInternalFrame2 = new javax.swing.JInternalFrame();
                jButton2 = new javax.swing.JButton();
         
                getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.X_AXIS));
         
                setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
                desktop.setPreferredSize(new java.awt.Dimension(300, 400));
                jInternalFrame1.setVisible(true);
                jButton1.setText("jButton1");
                jInternalFrame1.getContentPane().add(jButton1, java.awt.BorderLayout.CENTER);
         
                jInternalFrame1.setBounds(50, 40, 130, 100);
                desktop.add(jInternalFrame1, javax.swing.JLayeredPane.DEFAULT_LAYER);
         
                jInternalFrame2.setVisible(true);
                jButton2.setText("jButton2");
                jInternalFrame2.getContentPane().add(jButton2, java.awt.BorderLayout.CENTER);
         
                jInternalFrame2.setBounds(140, 90, 130, 130);
                desktop.add(jInternalFrame2, javax.swing.JLayeredPane.DEFAULT_LAYER);
         
                getContentPane().add(desktop);
         
                pack();
            }
            // </editor-fold>
            
            /**
             * @param args the command line arguments
             */
            public static void main(String args[]) {
                java.awt.EventQueue.invokeLater(new Runnable() {
                    public void run() {
                        new DeskTopTest().setVisible(true);
                    }
                });
            }
            
            // Variables declaration - do not modify
            private javax.swing.JDesktopPane desktop;
            private javax.swing.JButton jButton1;
            private javax.swing.JButton jButton2;
            private javax.swing.JInternalFrame jInternalFrame1;
            private javax.swing.JInternalFrame jInternalFrame2;
            // End of variables declaration
            
        }

        ---------- END SOURCE ----------

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                mbronsonsunw Mike Bronson (Inactive)
                Reporter:
                ndcosta Nelson Dcosta (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: