我在创建菜单项的标题时遇到了一些问题。
我试过这个:
MenuItem nativeItem = new MenuItem(nativeTitle);
nativeItem.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
if(menuItemEnable.isSelected()){
nativeItem.setTitle("Enable Native Hook"); //This is not working
}else{
nativeItem.setTitle("Disable Native Hook"); //This is not working
}
}
});
menu.add(nativeItem);
答案 0 :(得分:0)
Thx gla3dr
Use this
setLabel("Hello");