api - Keyboard Layout library to find Neighboring Keys given an input key (java preferable) -


Does anyone know the address of a library (preferably Java) which is a valuable input for the US_ENGLISH standard keyboard, Can the key give?

Example If I input character 'D', then I get the following characters: [w, e, r, s, f, x, c, v]

Alternatively a grid manipulation API will also work (so that I can install a grid with the keyboard layout and use it to find my neighbors). Note 1: I am using the word 'character' and 'key' to refer to letters.

Note 2: I know that I am 50 for my neighbors -It can harden a method to map the primary key. I am looking for a better solution.

Thank you.

I agree with BlueNovember but if you want another "mathematical" solution, check it out. First you make a grid of letters and then you return all those who have a short distance compared to the pass key with 2 ... is a bit useless but this is a good exercise :)

 < Code> test of the public class {static string character = "quartiopasdfggeil; xxcvbm."; Public Stable Zero Main (string [] Args) {System.out.println (getNeighboringKeys ('f')); Println (getNeighboringKeys ('U')); Println (getNeighboringKeys ('M')); Println (getNeighboringKeys ('Q')); } Public Stabilized String MatchEboboring Keys (Four Keys) {StringBuffer Results = New StringBuffer (); (Four c: chars.toCharArray ()) {if (c! = Key & distance (c, key) & lt; 2) {result.append (c); }} Return result. String (); } Public static double gap (four c1, four c2) {return mathematics. Ctrate (callup (c2) -colOf (c1), 2) + monastery pow (rowoff (c2) -oof (C1), 2)); } Public stable int rowOf (char c) {return chars.indexOf (c) / 10; } Public static int colOf (char c) {return chars.indexOf (c)% 10; }}  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -