• Post Reply Bookmark Topic Watch Topic
  • New Topic

HELP - AWT MENU ( Accesskey,Modifiers,Shortcut keys)

 
bapi dhar
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I m using jdk1.2.1 . Can u help me
1) I want to make letter f an access key (must activate by pressing alt+f )
. The letter f must also be underlined (as letter f in file menu )
Kindly Help.

public void createmenu()
{
Menubar mb=new MenuBar();
Menu f=new Menu("File);
f.add("save");
f.add("Open");
f.setShortcut(new MenuShortcut(KeyEvent.VK_F); f.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
if ((e.getModifiers() & InputEvent.ALT_MASK+InputEvent.VK_F)!=0) //alt key is down
{

}
});
mb.add(f);
add(mb);
}



Problems
---------
. The Letter f is not getting underlined and the file menu is not activating after pressing alt+f.
. I dont know how to handle the alt+f keychain.
. I do not want to use JFC.

2) How to Handle shortcut key (for suppose CTRL+S) in AWT in the above case supposing
we have a method showsave() to save.

THANX A MILLION Friend

BAPI


------------------
 
bapi dhar
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey javagurus
Help me out Please......sssss.

bapi

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!