classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: Some swing fixes


From: Roman Kennke
Subject: [cp-patches] FYI: Some swing fixes
Date: Thu, 19 Jan 2006 21:41:49 +0000

Hi,

this fixes an issue I had with JWindow. The constructor JWindow(Frame) is
allowed to take a null parameter and in that case should install a
shared owner frame (as returned by SwingUtilites.getOwnerFrame).
However, the implementation of this is a little tricky, since the super
class does not allow null parameters. So I changed the
SwingUtilities.getOwnerFrame() method (this is not public) to take a
parameter 'owner' which is returned when not null. Later it came to
mind that I also could have solved this problem with a super(owner ==
null? SwingUtilities.getOwnerFrame():owner) construct, however I really
don't like the ?: expression, I feel Sun really should have left this
out of Java :-)

I had to adjust a couple of other classes for the changed
SwingUtilities.getOwnerFrame() method, one of which is JFileChooser.
Unfortunately I had a fix for this class lying around on my HD, which is
now also going in. This is to call pack() in the showXXXDialog()
methods. I feel that this will break the JFileChooser a little, but I
already know how to fix it (I only must find time to do it - basically
we need a special subclass of JList that displays the files)

2006-01-19  Roman Kennke  <address@hidden>

        * javax/swing/JDialog.java
        (JDialog()): Call SwingUtilities.getOwnerFrame() with null.
        (JDialog(Frame,String,boolean,GraphicsConfiguration)): Call
        SwingUtilities.getOwnerFrame() with the owner argument.
        * javax/swing/JFileChooser.java
        (showOpenDialog(Component)): Call pack() on the dialog instead of
        setting a fixed height.
        (showSaveDialog()): Likewise.
        (showDialog()): Likewise.
        (createDialog): Call SwingUtilities.getOwnerFrame() with null.
        * javax/swing/JOptionPane.java: Call
SwingUtilities.getOwnerFrame()
        with null.
        * javax/swing/JWindow.java
        (JWindow()): Call SwingUtilities.getOwnerFrame() with null.
        (JWindow(Frame)): Call SwingUtilities.getOwnerFrame() with owner
        argument.
        * javax/swing/SwingUtilities.java
        (getOwnerFrame): Changed to take a owner parameter that is
returned
        as owner frame when not null.

/Roman

Attachment: patch.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]