How do I show the pound sterling (£) sign in Java Swing?

character, encoding, java, swing

Solution

Use the \u00A3 notation. Further examples here for the unicodes Unicode code points for other symbols.

Problem

Currently, I add a pound sterling (£) sign to the Java source and compile the resulting Swing component shows as the square (unsupported character) symbol. I suspect it's an encoding problem, the Java source file is encoded as cp1252 (Eclipse seems to default to this). What's the correct way of resolving this?

Original source