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.
In many many occasions undo fails to undo properly to the previous state, leaving resized or repositioned components. I've managed to catch one such occasion, shrink it to a minimum and I'm enclosing it as a test case. To reproduce: pick the white panel, drag it and place it BETWEEN the green and black panels (not *inside* any of them, just between them). For whatever reason, the layout manager decides that it should resize the existing panels. This is an issue, but it maybe because I just don't know what dependancies are there. The real issue is that after this operation, no amount of "undo"ing reverts to the initial state - the panels stay resized vertically.
Created attachment 38094 [details] Testcase - form file
Created attachment 38095 [details] Testcase - java file
If I move the white panel in between it's all fine (see no vertical resize). However, if I move it into the black one, the panels grow vertically, and this vertical size is not changed back with undo. Looking at the layout properties in property sheet, all the panels have the Vertical Resizable property set to true. (Though the vertical arrow in the toolbar does not indicate the resizability - this is a known problem.) If I uncheck Vertical Resizable, then unod works fine. Thanks for finding the test case.
I also experienced this undo problem with NetBeans 5.5, which I used for six months to develop a complex Swing management UI. I have also seen this bug with NetBeans 6 a few times, so decided to comment as the problem obviously is not fixed yet. Typically the undo problem happens in conjunction with an unexpected/unwanted JFrame or JPanel resize by the free design layout manager. Usually the JFrame will be complex and contain many JPanel and sub JPanel and components. And when I try to move or resize a component like a JTextField, the NetBeans free design layout manager decides to perform a resize on top level JFrame or JPanel components!! Sometimes a sub-panel will be widened or deepened for no reason, or worse still the whole frame will be widened !! Why does the layout manager do this ?? I want the top level JFrame and JPanel to keep their exact size. And often the undo will fail to restore the frame or panel to their previous size. This problem doesn't usually happen on a simple JFrame with less than a dozen components. Maybe this is why you guys can't seem to find and fix this, because your diagnostic test cases are too simple. But hey, real world projects require forms with many components. On one occasion I accidentally ran the project immediately after the undo. This unfortunately resulted in the corrupted JFrame and .form file being saved (prior to compilation and execution). So I had to revert back to previous versions from our Subversion repository, ruining two hours work !!
The cause why undo does not restore vertical size is that after undo the designer does not update (rebuild) the layout of the panels that only changed in size but not in content. In this case it is the size of the vertical filling gap in the green panel. The enclosing panel (pnlButtons) is set as fixed, so without updating the contained sub-panels it cannot shrink. It's basically the same problem as in bug 85259.
*** Bug 85259 has been marked as a duplicate of this bug. ***
Fixed in 7.1 - Free Design improvements
Product Version: NetBeans IDE Dev (Build 201110030601) Java: 1.7.0; Java HotSpot(TM) Client VM 21.0-b17 System: Linux version 2.6.38-11-generic running on i386; UTF-8; en_US (nb)