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 133556 - BooleanStateAction throws menu layout off in java1.6
Summary: BooleanStateAction throws menu layout off in java1.6
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 6.x
Hardware: Sun All
: P2 blocker (vote)
Assignee: David Simonek
URL:
Keywords: UI
Depends on:
Blocks:
 
Reported: 2008-04-21 22:47 UTC by ivan
Modified: 2008-12-22 14:45 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
netbeans.gif (7.99 KB, image/gif)
2008-04-21 22:49 UTC, ivan
Details
swing1.5.gif (4.83 KB, image/gif)
2008-04-21 22:49 UTC, ivan
Details
swing1.6.gif (4.99 KB, image/gif)
2008-04-21 22:50 UTC, ivan
Details
swing-base demonstration of the problem (73.97 KB, application/octet-stream)
2008-10-02 05:36 UTC, ivan
Details
NB based demonstration of the problem (4.10 MB, application/octet-stream)
2008-10-02 05:37 UTC, ivan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ivan 2008-04-21 22:47:54 UTC
The netbeans.gif image in the attachment shows the sunstudio Run menu
when running on java 1.6.
Note how the icons "run into" the text.
The cause seems to be the check-box (Allow ss_att...)
which is baed on BooleanStateAction.
If I remove the check-box the run-in problem goes away.

I tried to reproduce this with plain swing. See images
swing1.5.gif & swing1.6.gif. It seems that swing wasn't
doing a good job in 1.5 and then has "fixed" things 1.6.

I suppose NB has worked around swings 1.5 menu layout bugs, but that
the fixes in 1.6 swing somehow interfere with nb's workaround producing the
inferior menu layout.
Comment 1 ivan 2008-04-21 22:49:11 UTC
Created attachment 60515 [details]
netbeans.gif
Comment 2 ivan 2008-04-21 22:49:45 UTC
Created attachment 60516 [details]
swing1.5.gif
Comment 3 ivan 2008-04-21 22:50:05 UTC
Created attachment 60517 [details]
swing1.6.gif
Comment 4 Marian Mirilovic 2008-04-23 07:36:29 UTC
Dafe, 
Jesse asked me to add this issue into the list of issues for Patch 1. What do you think ? Thanks in advance.
Comment 5 David Simonek 2008-04-23 08:04:02 UTC
Well, I know nothing about BooleanStateAction, I think it belongs to actions, passing there. But AFAIK Actions class
uses regular Swing JCheckBoxMenuItem, I'm not aware of any workaround, so this is mystery to me.

Is this bug reproducible always when menu item with checkbox is added?
Comment 6 Jiri Rechtacek 2008-04-23 08:42:29 UTC
I don't know about BooleanStateAction either. But I should try it. I let you know.
Comment 7 Jiri Rechtacek 2008-04-23 08:59:58 UTC
The implementation of this is in org.netbeans.modules.openide.awt.DefaultAWTBridge and org.openide.awt.Actions what are
out of my scope. I'm sorry.
Comment 8 David Simonek 2008-04-23 09:13:27 UTC
OK, but i don't know how to fix it, sorry. If anybody knows, patches are welcomed.
Comment 9 Lukas Hasik 2008-05-29 08:25:04 UTC
I'm not able to reproduce with NB 6.1 running on Windows XP and JDK 1.6.0_10-beta; Java HotSpot(TM) Client VM 11.0-b11
I'll try with a solaris machine later. 
ivan, are you able to reproduce it with NB 6.1 in your setup?
Comment 10 ivan 2008-05-30 04:58:52 UTC
Well, depends which 6.1 ...
If I use the binary bits that thp has (netbeans-6.1-200804211638-cpp) I can reproduce it.
If I use my own bits built off of release61 I can't.
I'm trying to freshen my clone of release61 ... and having problems.

I also should try java 1.6.1 ...
Comment 11 Lukas Hasik 2008-05-30 10:37:14 UTC
ivan, could you investigate it more, please. I've never seen any bug like that in standard distro (but I haven't tried
cpp for looong time). If it is reproducible only in cpp builds then it might be caused by some cpp code. 

What about full distro?
Comment 12 ivan 2008-05-31 03:52:18 UTC
I intend to investigate more ... just having trouble
getting my clones refreshed and juggling everything else :-)
Comment 13 Lukas Hasik 2008-06-04 14:51:18 UTC
marking INCOMPLETE till ivan will provide more info
Comment 14 ivan 2008-06-05 03:43:39 UTC
Sorry it took so long, I ran afoul of problems with external.py.


If I use netbeans-6.1_fixes-200805270103-cpp the symptoms are present
If I use my build of the current trunk bits the symptoms go away.

As much as I don't like inexplicable fixes i'll have to declare this as implicitly fixed.
Comment 15 Lukas Hasik 2008-06-05 07:38:14 UTC
>As much as I don't like inexplicable fixes i'll have to declare this as implicitly fixed.

Could you elaborate on "what is different or fixed in 6.5 and not in 6.1 more?" If you need fix in the 6.1 then we have
to either find what will fix it for you or we can close this issue as worksforme.

Up to you guys. From my point of view - works for me in 6.5. Feel free to reopen with more detail about the differences
between cpp 6.1 build and trunk
Comment 16 ivan 2008-06-09 23:25:23 UTC
I built my own NB from the following repositories:
    release61
    release61_fixes
    main
The problem doesn't show up in _any_ of my personal builds.
It only shows up when we use the cached bits that thomas gets from somehwre.

Comment 17 ivan 2008-10-02 05:31:58 UTC
We're still seeing the problem with nb65.
And fortunately I've finally traced the problem to it's source

org.openide.awt.Actions.CheckMenuBridge.updateButtonIcon() uses an image, gap.gif,
to pad the spacing between the checkbox and the text. That should
be changed to empty.gif. gap.gif is a bit narrower than empty.gif
and that is the right padding for 1.5, but the "improvement" in menu layout
from JDK 1.5 to 1.6 requires the padding to be wider and empty.gif seems to
be just right.

I'll be adding some attachments for reproducible testcases ...

Comment 18 ivan 2008-10-02 05:36:15 UTC
Created attachment 71015 [details]
swing-base demonstration of the problem
Comment 19 ivan 2008-10-02 05:37:40 UTC
Created attachment 71016 [details]
NB based demonstration of the problem
Comment 20 ivan 2008-10-02 05:45:34 UTC
In the swing based demonstration of the problem (project GUIPlay)
choose the Menu menu. It has a pullright, an action with an icon 
and an action w/o an icon. Choose the action with an icon.
This will add more actions to the menu, including a CheckBox action.
This menu isn't padded right.

Now look at the source for Window.addCheckBoxMenuItem(). It has two menuItem.setIcon()s
commented out. If you use gap.gif the menu looks wrong. If you use empty.gif 
the menu looks right.


In the NB-based demonstration of the problem (project MenuItemBug) 
choose the Debug menu. At the top it has two new items: Dummy and Checkit.
Checkit is the one that causes problems. If gap.gif is used the menu is
poorly layed out. If empty.gif is used the menu looks right.
Comment 21 Alexander Pepin 2008-10-02 12:10:38 UTC
This issue is critical for sunstudio IDE, please fix it as soon as practical.
Comment 22 David Simonek 2008-10-02 13:28:00 UTC
Yes, accepted, I will look at it ASAP.
Comment 23 David Simonek 2008-10-03 14:03:00 UTC
ivan, thank you for excellent report. I modified code in Actions.CheckMenuBridge to put "empty.gif" on JDK 1.6 and
newer, according to your instructions. And it really does the trick, as I verified by running your nb module sample.

So hopefully fixed now: 8cbdc375ba72
Comment 24 ivan 2008-10-03 20:21:03 UTC
I had two concerns ... 
- One was whether the new wider padding would affect menus with _only_ checkboxes.
  The NB View menu is an example. Fortunately it seems to be OK although I don't
  understand why. Make sure you check for this on other platforms.
- This fix might have an undesirable effect if NB is run on JDK 1.5 ... but is
  NB supposed to run on 1.5 anymore?
Comment 25 Quality Engineering 2008-10-04 09:25:09 UTC
Integrated into 'main-golden', will be available in build *200810040600* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/8cbdc375ba72
User: Dafe Simonek <dsimonek@netbeans.org>
Log: #133556: Spacing icon changed for jdk 1.6 and newer to align menu well
Comment 26 David Simonek 2008-10-06 08:07:42 UTC
Yes I checked on Win OS, both with Metal and Win L&F. Will try with GTK L&F also...
As for JDK 1.5, look at the patch, we are still using "gap.gif" spacing for JDK 1.5 and "empty.gif" only for JDK 1.6 and
newer.

NB is supposed to run well on two latest JDKs which are in FCS state, so for now NB should run well on JDK 1.5. Once JDK
1.7 FCS will be available on supported platforms we can say goodbye to 1.5.x
Comment 27 rbalada 2008-10-06 09:26:05 UTC
Mariane,

you've put sustaining to Cc: field with a note, that it has been requested for release in NB 6.1 Patch 1. I don't see
any "61fixes*" keyword in Status whiteboard including it's history. This issue is not going to make it into NB 6.1 Patch
4. We may consider releasing it as part of services-driven NB 6.1 Patch5 release once it would have been scheduled (if
it would ever happen).
Please mark this issue with 61fixes5-candidate keyword in Status whiteboard or remove sustaining from Cc:, whatever you
prefer. For 61fixes5-candidate it has to be verified in trunk (NB 6.5) first.

Thanks,
-R10a
Comment 28 Marian Mirilovic 2008-10-06 10:04:25 UTC
Ruda,
I was told (I think Jesse Grodnik sent me a list of issues, they wanted to fix into one of the patches) to do so. I do
not have strong opinion about that, so if the request doesn't exist anymore (Jesse?), remove sustaining from cc list.
Thanks in advance.
Comment 29 Thomas Preisler 2008-10-20 18:28:16 UTC
Removing SSIDE. Fix has been delivered to SS.