This is about module project and the platform - please change to correct
cat/subcat as needed.
jdk does not provide the following behavior - if user is running in a locale in
which the default ui behavior is left to right, like display of menus, like
arabic locale -- it does not show such menus or other ui unless additional
code is added about orientation direction.
Am filing this since it seems that module projects and platforms should show
their ui objects orientation as per locale, without user needing to add code.
In other mail, Jesse indicated he thought that this situation was a filable
kind of issue.
This is an aspect of the platform (probably o.o.awt.MenuBar?), not the module
First I should say that platform does not works correctly when we have Right to
It is not a module development feature and indeed it is a core feature, defect.
As JDK does not layout the components correctly based on user locale Netbeans
platform should do it.
for example imagine that you have to write an application with more than one
languages like Hebrew, Arabic, English and Chinese.
What the platform core should do is something like :
- Accept a direction argument when executing Launcher or pick up the direction
from resource files.
- Apply the direction to all components. (As i can tell if we apply the
direction in a top level container its child will comply with the new direction)
This way platform can provide correct support for RTL languages.
*** Issue 96471 has been marked as a duplicate of this issue. ***
just confirming that when its fixed here for platform, then ide will get the
fix also, and no need for any additional coding or building steps for the ide ?
Couple of comments & questions:
- The fact that JDK/Swing doesn't support RTL makes things complicated. Why they
don't support this?
- (to kalali) Is there any way to change text direction easily for Swing
- where is the information of text direction stored? Somewhere in locale? I
simply know nothing about locales...
- We don't have resources for fixing this, so I had to set target milestone to
the future. Coding help is of course welcomed, given that nobody here knows
anything about RTL languages.
why jdk did not fix ?
see swing issue 4505945
to fix it, there is a one line code change related to
orientation, that could be done for nb windows,
although additional code would be needed for
Tomas suggested such a line might be like
The locale settings might have some information about rtl but I think
its more in jdk/swing that the info is stored about orientation,
and that combined with nb code, to detect a list of rtl locales,
would allow such a line as above (or perhaps the getOrientation call
I think also conversations with jdk/swing people might be helpful;
let me know if that will help and I can point you to some of them.
i think this is an RFE, not a bug.
even if we applied that suggested one liner to change the component orientation the whole editor would fall apart.
fixing rtl related issues would require tremendous amount of effort.
besides, how would qa test this?
I suggest getting additonal comments on this from filer and viewing other user input and how its handled
by other ides to see if would be viewed as enhancement or issue.
could dev team take another look at this and see if
something can be done about it ?
seems that a user in rtl locale should not need to do anything
special, and that behavior of applications should work as other ones
I realize there might need to be several different issues filed or
a mini project to deal with rtl, as suggested in another issue on this topic.
Created attachment 102429 [details]
right to left text editing bug
The right to left (rtl) text is not shown properly in the upper text that is captured inside Netbeans PHP, while the lower one which is captured in WordPad is shown in the correct way.
Here I have attached a picture of the right to left editing bug in Netbeans.
(In reply to comment #10)
> Created an attachment (id=102429) [details]
> right to left text editing bug
> The right to left (rtl) text is not shown properly in the upper text that is
> captured inside Netbeans PHP, while the lower one which is captured in WordPad
> is shown in the correct way.
please provide jdk, os and netbeans version info.
also try reproducing this problem with swingset demo application (part of jdk distribution), it is probably a jdk bug.
I am using NB 7, and i need to develop an application on top of it which uses an rtl locale.
I ran into 2 main issues
1. the menu system
2. the explorer tabs
1. I managed to get the menu right aligned, but the contents of each menu are still ltr, and no matter what i tried, it didnt work (my menu consisted only of strings in the rtl locale)
2. the tabs seemed to be "pixel written", so in order to have them right to left, one have to re-code major parts of the *TabRendererUI classes, for all the supported l&f's.
Does anyone have any workarounds for the two issues i mentioned?
Also, this bug is quite old, should we expect any resolution for the rtl issues, or rtl based programs should not use NB rcp altogether?...
I managed to partially resolve these issues:
For the menu systems, the problem is that although the swing code that executes setComponentOrientation on the main menu was called from a module installer's restore method, wrapped around by an invokeWhenUiReady, it was called *before the LazyMenu was realized, which was the problem. once i put the code in some later performing action, the menus acted as expected, becoming right to left. I still need to find the proper place to put that code so it will be automatic.
as to the EDITOR-tabs (forgive my mistake in the previous post), i managed to hack the Metal's l&f tab classes, and i now have a first working version of a right-to-left tab system, supporting resize, and overflow cases. If you are interested, ill try to upload the code.
Created attachment 109606 [details]
screenshot of the current fix
Here is a screenshot of the module that attempts to fix the toolbar to become RTL. here is the link to the source https://github.com/vadali/NB-RTL