JOGLのNewtでIMEを使用した日本語の入力がしたいと思っているのですがどのようにすればよいでしょうか?
ちなみにこれはIMEを使用しない方法で書いてみたんですがここからIMEを使用した方法に発展させる方法がわかりません
java
1import com.jogamp.newt.event.KeyEvent; 2import com.jogamp.newt.event.KeyListener; 3import com.jogamp.newt.event.WindowAdapter; 4import com.jogamp.newt.event.WindowEvent; 5import com.jogamp.newt.opengl.GLWindow; 6import com.jogamp.opengl.GL; 7import com.jogamp.opengl.GL4; 8import com.jogamp.opengl.GLAutoDrawable; 9import com.jogamp.opengl.GLCapabilities; 10import com.jogamp.opengl.GLEventListener; 11import com.jogamp.opengl.GLProfile; 12import com.jogamp.opengl.util.Animator; 13 14 15 16public class HelloJOGL implements GLEventListener { 17 private GL4 gl; 18 private HelloJOGL() {} 19 20 public static void main(String... args) { 21 final StringBuilder sb = new StringBuilder(); 22 HelloJOGL r= new HelloJOGL(); 23 GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL4)); 24 GLWindow glWindow = GLWindow.create(caps); 25 glWindow.setTitle("test"); 26 glWindow.setSize(300, 300); 27 glWindow.addWindowListener(new WindowAdapter() { 28 @Override 29 public void windowDestroyed(WindowEvent evt) { 30 System.exit(0); 31 } 32 }); 33 glWindow.addKeyListener(new KeyListener() { 34 @Override 35 public void keyPressed(KeyEvent ke) { 36 if(ke.getKeySymbol()==KeyEvent.VK_ENTER){ 37 sb.delete(0, sb.length()); 38 } 39 sb.append(ke.getKeyChar()); 40 } 41 42 @Override 43 public void keyReleased(KeyEvent ke) { 44 System.out.println(sb.toString()); 45 } 46 }); 47 glWindow.addGLEventListener(r); 48 49 Animator animator = new Animator(); 50 animator.add(glWindow); 51 animator.start(); 52 glWindow.setVisible(true); 53 } 54 55 @Override 56 public void init(GLAutoDrawable drawable) { 57 gl=drawable.getGL().getGL4(); 58 } 59 60 @Override 61 public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { 62 } 63 64 @Override 65 public void display(GLAutoDrawable drawable) { 66 gl.glClear(GL.GL_COLOR_BUFFER_BIT); 67 } 68 69 @Override 70 public void dispose(GLAutoDrawable drawable) { 71 } 72 73}
com.jogamp.newt.event.KeyEvent
にVK_JAPANESE_HIRAGANA
とかVK_ACCEPT
とかがあるので可能なのではないかと思っているのですがやり方がわからないです
ご教授のほどよろしくおねがいします
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。