WindowBuilder Design Mode changes parent when moving objects [message #762745] |
Thu, 08 December 2011 10:14  |
Eclipse User |
|
|
|
I have a great many Swing screens setup to use the absolute layout. They were all created initially with WindowBuilder Pro (over the years). Without going into the merits of absolute layout model I now find that when I am in design mode and move a visual component the hierarchy of the objects changes with the net effect that the object that I moved is no longer visible.
Effectively my hierarchy starts as something like
JFrame -> ContentPane -> DesktopPane -> JButton
I move the position on screen of the button, expecting that the bounds x,y co-ordinates are updated and find that the structure has changed to
JFrame -> ContentPane -> JButton
I don't want to have to re-invent all my code so that I can continue using WindowBuilder - can anyone suggest what has happened here ?
Dave
[Updated on: Thu, 08 December 2011 10:16] by Moderator
|
|
|
|
|
|
|
|
|
|
|
|
Re: WindowBuilder Design Mode changes parent when moving objects [message #765809 is a reply to message #765338] |
Wed, 14 December 2011 13:01  |
Eclipse User |
|
|
|
After further investigation, it appears that Apple is doing something unusual under the covers with JDesktopPane which is not done under Windows. They are giving it a custom, non-standard layout (not absolute layout) when it is instantiated which WB does not recognize. WB does not provide editing support for that layout, so it treats it as a generic, unknown layout and basically ignores it as a drop site.
The work around appears to be simple, Be explicit about your layout choice and add "desktopPane.setLayout(null);" to your code. That will force it to actually use absolute layout and WB will be able to edit it.
Also, in researching this, it appears that your use of JDesktopPane itself is very unusual (see its JavaDoc) so I wonder why you are using it this way at all. I'm guessing that what Apple is doing under the covers here is in support of JDesktopPane normal mission in the context of OSX.
|
|
|
Powered by
FUDForum. Page generated in 0.11735 seconds