if you use the swing library you can just use the :
setMnemonic()
but how? suppose you have an JMenu in swing, look at the below:
JMenu setting = new JMenu("setting");
setting.setMnemonic('s');
it makes the first letter underline. hope this useful for you.