<Swing Dev> JSeparator rendered incorrectly on Windows 7

Pavel Porvatov pavel.porvatov at oracle.com
Wed Apr 4 09:25:29 UTC 2012


Hi Alex,
> Hi there,
>
> I have found the cause of the problem - the difference between
> JSeparator and JPopupMenu.Separator.
>
> As I use the GUI builder on NetBeans, I don't know how or when it has
> decided to slip in a single JSeparator into the mix.
>
> Attached a simple test case demonstrating the problem, at least on Win7.
>
> It's not a big deal to me now I've discovered the cause, although it
> would be nice to know the difference between these two classes...
There are three separators and they were designed for different purposes:
1. javax.swing.JSeparator (used for menus)
2. javax.swing.JPopupMenu.Separator (used for JPopupMenus)
3. javax.swing.JToolBar.Separator (used for JToolbars)

To avoid any confusion use correspondent separators in appropriate 
places or use addSeparator() methods from JMenu, JPopupMenu, and JToolbar.

Regards, Pavel
>
> Regards,
> Alex.
>
>
>
>
> On Sun, Apr 1, 2012 at 8:25 PM, Alex Lam S.L.<alexlamsl at gmail.com>  wrote:
>> Hi there,
>>
>> I will try and narrow it down to a simple(r) test case and get back to you.
>>
>>
>> Regards,
>> Alex.
>>
>>
>>
>> On Fri, Mar 30, 2012 at 10:24 AM, Pavel Porvatov
>> <pavel.porvatov at oracle.com>  wrote:
>>> Hi Alex,
>>>
>>> Can you sent a small separated test? I used SwingSet2 demo with the same
>>> Windows and jdk versions and the problem is not reproducible...
>>>
>>> Thanks, Pavel
>>>
>>>
>>>> Hi there,
>>>>
>>>> I noticed that in some cases JSeparator would render differently (see
>>>> attached photo - first one from the top, left window).
>>>>
>>>> It is repeatable - I can quit and re-run the app and the same
>>>> JSeparator would be wrong. Curiously, I use the preview feature from
>>>> NetBeans for the project code which generates this window, and the
>>>> problem does not appear there.
>>>>
>>>>
>>>> Confused,
>>>> Alex.
>>>>
>>>> ---------------
>>>>
>>>> Microsoft Windows [Version 6.1.7601]
>>>>
>>>> java version "1.7.0_02"
>>>> Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
>>>> Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode)
>>>




More information about the swing-dev mailing list