Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Query about changing the character set of keyboard input

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, first time posting on this forum, so hope this is in the right place.
Did Java in college last September and I'm still not good at it, so trying to do little projects to practise.

What i'd like to do is something like Google translate for Korean-English there is a pop out keyboard with Korean letters, I would like to make a basic version of that but using the users keyboard when a text box in my program is active.

the Korean language has an alphabet, 2-4 letters make up a syllable block
ᄒ+ᅡ+ᄂ= 한
h + a + n = han

Is there a way to remap the keys of a standard keyboard to some values of the Korean character set?
As in, Can I make it so when I press 'g' the character 'ᄒ' will appear inside the active text area of my program instead.

If the above is possible, how would I go about swapping them out? would i use the hexadecimal values like in html?

If number question 1 would not work, how efficient would would it be to have a lot of ifs,

check syllable length at the start, then keep going until you have found the right one, replace with its Korean character set.

I ask because currently I'm not too sure how else to go about it.
It seems hideous, but that's all I can come up with atm.

also how do i get j2ee libraries on drjava?
downloaded he j2ee sdk and glass fish server.

Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

i think the best would be not to hardcode everything with if...else statement.

The best would be to use a Database (either a file, mysql, or hypersonic).

In the DB you need to store every combination, like:

so that your code, will check each time some keys are typed, if that sequence is possible.

Imagine the following:

when you type the first ᄒ char, it will look it up in the DB for possible matches.
when you insert the second...then the third, matches will be less and less.

You can do everything with a couple of classes...and no need for if/then/else loops...

Posts: 72435
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

I think that question is too difficult for "beginning", so I shall move it.
It's a pleasure to see superheros taking such an interest in science. And this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
    Bookmark Topic Watch Topic
  • New Topic