This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 157463

Summary: Vertical window resize fails for non-native Window decorations
Product: platform Reporter: wzberger <wzberger>
Component: Window SystemAssignee: Stanislav Aubrecht <saubrecht>
Status: VERIFIED FIXED    
Severity: blocker CC: maxnitribitt
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: Metal2LookAndFeel
Proposed patch

Description wzberger 2009-01-26 20:03:05 UTC
The NetBeans platform has a problem with third party look and feels and non-native window decoration. Resizing windows
vertically (especially minimizing) isn't possible. You can simply reproduce this by using the LAF below which extends
Metal and additionally enables the Metal window decoration. As soon as Metal2LookAndFeel is applied the main window
can't be resized vertically.

public class Metal2LookAndFeel extends MetalLookAndFeel
{
  @Override
  public void initialize()
  {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);    
    super.initialize();
  }
}

Thanks,
Wolfgang
Comment 1 wzberger 2009-01-26 20:04:53 UTC
Created attachment 76248 [details]
Metal2LookAndFeel
Comment 2 Peter Pis 2009-01-27 09:03:37 UTC
Reassigning to platform.
Comment 3 maxnitribitt 2009-02-08 12:45:33 UTC
Proposed patch: remove setBounds method in MainWindow

The problem is that the decorations use the setBounds Method that MainWindow overrides to fix a bug with SDI:

    /**
     * don't allow smaller bounds than the one constructed from preffered sizes, making sure everything is visible when
     * in SDI. #40063
     */
    @Override
    public void setBounds(Rectangle rect) {
        Rectangle bounds = rect;
        if (bounds != null) {
            if (bounds.height < getPreferredSize().height) {
                bounds = new Rectangle(bounds.x, bounds.y, bounds.width, getPreferredSize().height);
            }
        }
        super.setBounds(bounds);
    }

Commenting the setBounds Method fixes the problem. Since SDI has been removed a long time ago, is there still a reason
to override setBounds?

Thanks
Toni
Comment 4 maxnitribitt 2009-02-08 13:02:59 UTC
Created attachment 76710 [details]
Proposed patch
Comment 5 Stanislav Aubrecht 2009-02-09 16:24:05 UTC
fixed by rolling back fix for #40063, thanks for the patch

daf24180c08a

Comment 6 maxnitribitt 2009-02-10 10:15:00 UTC
Hi Stan,

thanks for taking care of this! Is there a chance to get this into 6.5 as well?

Toni
Comment 7 Stanislav Aubrecht 2009-02-10 10:30:48 UTC
i've added appropriate flag but our sustaining dept has been axed a lot so it'll take some time to produce patch3 for nb 65
Comment 8 Quality Engineering 2009-02-13 09:27:33 UTC
Integrated into 'main-golden', will be available in build *200902130336* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/daf24180c08a
User: S. Aubrecht <saubrecht@netbeans.org>
Log: #157463 - Vertical window resize fails for non-native Window decorations
Comment 9 matusdekanek 2009-02-23 16:23:18 UTC
seems ok
marking verified
Comment 10 Stanislav Aubrecht 2009-02-26 08:40:18 UTC
backporting the fix to release65_fixes: 05fd24ca5025