Catalysoft   Turtle
home products articles about us contact us

Recent Articles

What's Good About Clojure?

Clojure is a relatively new language to appear on the Java Virtual Machine (JVM), although it draws on very mature roots in the form of the LISP langu ...

Should You Care About Requirements Engineering?

Recently, I (Adil) was invited to participate in a one day seminar on the subject of Requirements Engineering. Whilst I have no direct experience of t ...

Tips for Setting Up Your First Business Website

To attract all potential customers to your business you need a presence on the web. The problem is that if you haven't set up a website before, you p ...

What's Good about LISP?

LISP is a general-purpose programming language and is the second-oldest programming language still in use, but how much do you know about it? Did you ...

Open Source Tools for Developers: Why They Matter

From a developer's point of view use of open-source tools has advantages beyond the obvious economic ones. With the open-source database MySQL in mind ...

Unicode Character Chooser

  • Does your keyboard have a symbol for the Euro currency?
  • Have you ever wanted to use the proper degrees sign for a Fahrenheit temperature?
  • Would you like the facility to enter x2 or use other mathematical symbols?

Well, now, by using this component, you can easily add this functionality to your Java applications!

For example, here is the demonstrator application showing the kinds of results that you can achieve

And here is the dialog that you use to enter the unicode characters:

The jar file that you download is an executable Jar file that contains, but also demonstrates, the Unicode Chooser. The demonstration is basically a JTextArea wrapped in a JFrame - it shows character insertion into a text component. From your application you could call the UnicodeChooser as follows:

JFrame frame;
JTextArea textArea;

UnicodeChooser chooser = UnicodeChooser.instance(frame);
...
chooser.addPropertyChangeListener(new PropertyChangeListener() {
  public void propertyChange(PropertyChangeEvent evt) {
    if (UnicodeChooser.INSERT_CHARACTER_PROPERTY.equals(evt.getPropertyName())) {
      Character symbol = (Character) evt.getNewValue();
      if (symbol != null) {
        textArea.insert(symbol.toString(),textArea.getCaretPosition());
      }
    }
  }
});
chooser.setVisible(true);

It's as easy as that!

Note that the Unicode Character chooser is modeless, so the user can leave the unicode chooser dialog open while working in a main text component. It also means that you can use the unicode character chooser to input words - or even sentences - of characters rather than just single characters


Simon White