0

私のコードは次のとおりです。

if(mBooleanLoginDone==true)
{
    mMenuItemProdType.setAccelerator(new KeyCodeCombination(KeyCode.T, KeyCombination.CONTROL_DOWN, KeyCodeCombination.SHORTCUT_DOWN));
}
else
{
   System.out.println("Not Loggged In");
} 

上記のコードの mBooleanLoginDone は、ユーザーがログインしたかどうかを示すブール変数です。ユーザーが正常にログインした場合にのみショートカットキーCtrl+Tを機能させたいのですが、現在はログインしておらず、ショートカットキーも機能しています。どうすれば解決できますか?

4

1 に答える 1

0

試す

if(mBooleanLoginDone==true)
{
    mMenuItemProdType.setAccelerator(new KeyCodeCombination(KeyCode.T, KeyCombination.CONTROL_DOWN, KeyCodeCombination.SHORTCUT_DOWN));
}
else
{
   mMenuItemProdType.setAccelerator(null);
   System.out.println("Not Loggged In");
}
于 2013-01-23T10:26:21.143 に答える