Hi,
the attached patch add the double-click behavior on the title pane of a
JInternalFrame: It should do minimize/maximize on the frame. Now it does. :)

The ChangeLog:

2006-05-17  Robert Schuster  <[EMAIL PROTECTED]>

        Fixes PR 26947.
        * javax/swing/plaf/basic/BasicInternalFrameUI.java: Updated copyright
        year.
        (BorderListener.mouseClicked): Detect double-clicks in title pane,
        copied code from
        BasicInternalFrameTitlePaneUI.MaximizeAction.actionPerformed().

cya
Robert
Index: javax/swing/plaf/basic/BasicInternalFrameUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java,v
retrieving revision 1.35
diff -u -r1.35 BasicInternalFrameUI.java
--- javax/swing/plaf/basic/BasicInternalFrameUI.java	16 May 2006 08:33:00 -0000	1.35
+++ javax/swing/plaf/basic/BasicInternalFrameUI.java	16 May 2006 23:29:16 -0000
@@ -1,5 +1,5 @@
 /* BasicInternalFrameUI.java --
-   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -57,6 +57,7 @@
 import java.awt.event.MouseEvent;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
+import java.beans.PropertyVetoException;
 
 import javax.swing.DefaultDesktopManager;
 import javax.swing.DesktopManager;
@@ -194,6 +195,20 @@
      */
     public void mouseClicked(MouseEvent e)
     {
+      // Do minimization/maximization when double-clicking in the title pane.
+      if (e.getSource() == titlePane && e.getClickCount() == 2)
+        try
+          {
+            if (frame.isMaximizable() && ! frame.isMaximum())
+              frame.setMaximum(true);
+            else if (frame.isMaximum())
+              frame.setMaximum(false);
+          }
+        catch (PropertyVetoException pve)
+          {
+            // We do nothing if the attempt has been vetoed.
+          }
+        
       // There is nothing to do when the mouse is clicked
       // on the border.
     }

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to