我和以下內容類似: 值爲KeyEvent.VK_G
的對象。 如何從該對象獲取關鍵字(如String
)?Object(KeyEvent key)to String(Java)
0
A
回答
0
這是你想要做的嗎?
int someKeyCode = KeyEvent.VK_G;
Object someKeyCodeObject = new Integer(someKeyCode);
String keyString = KeyEvent.getKeyText((Integer)someKeyCodeObject);
在這種情況下,會給出「G」。
6
通過使用KeyEvent.getKeyChar()
(參見http://download.oracle.com/javase/6/docs/api/java/awt/event/KeyEvent.html#getKeyChar())。
相關問題
- 1. java String to a object
- 2. Java | Json String to Object without Library
- 3. javascript [object Object] to string
- 4. Casting object [,] to string []
- 5. object to string []
- 6. std :: string xml string to object
- 7. Android ClassCastException Object [] to String []
- 8. Java String to unicode
- 9. Java HashMap key to jQuery
- 10. com.loopj.android.http.RequestParams不能使用put(String key,Object value)
- 11. java bean \ object to android json object
- 12. java String to class
- 13. Java String to Array
- 14. Java String to JS
- 15. Java Casting Object to Type?
- 16. Java string to xml to list
- 17. Javascript string to object reference(without eval()or indexes)
- 18. Java String to Date,ParseException
- 19. Java Stream to String [] Array
- 20. java string to utc date
- 21. Java HashMap KeyEvent
- 22. Java - Casting ArrayList <Object[]> to Object [] []?
- 23. Object to Object Mapping
- 24. String string =「」+ childDataSnapshot.child(key).getValue())
- 25. 關於Object to double java
- 26. java soap webservice xml to object
- 27. 演員表<Object> to List <Map <String,Object >>
- 28. BigInteger to Key
- 29. JSON:Object to JsonString - JsonString to X.class Object
- 30. Java - KeyEvent變量
KeyEvent.VK_G是一個int。對象如何保存這個值?它是一個整數嗎? –