JLabel text lost symbol '&' if it bind text resource in .form view

Answered

The actual value of 'foo' in the bundle is 'A & B'.

If I bind it to a JLable in the .fome view, eventually the label text will be 'A  B', the symbol '&' lost:

But if I bind it by using lable.setText(ResouceBundle.getBundle("myBundle").getString("foo")) in java, the label will display 'A & B' correctly.

I tried to use unicode \u0026 replace &, or using '<html>A &amp; B</html>' , none of them works.

1 comment
Comment actions Permalink

Hi,
Please use double ampersand: && to escape it.

1

Please sign in to leave a comment.