當前位置: 首頁>>代碼示例>>Java>>正文


Java KeyEvent.VK_SLASH屬性代碼示例

本文整理匯總了Java中java.awt.event.KeyEvent.VK_SLASH屬性的典型用法代碼示例。如果您正苦於以下問題:Java KeyEvent.VK_SLASH屬性的具體用法?Java KeyEvent.VK_SLASH怎麽用?Java KeyEvent.VK_SLASH使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.awt.event.KeyEvent的用法示例。


在下文中一共展示了KeyEvent.VK_SLASH屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: enter

public void enter()
{
	if (ChatString.length() > 0)
	{
		if (ChatString.charAt(0) == KeyEvent.VK_SLASH) // Command
		{
			try
			{
				processCommand();
			}
			catch (Exception e)
			{
				System.err.println("Bad command - " + ChatString);
			}
		}
		else if (ChatString.charAt(0) == KeyEvent.VK_SEMICOLON) // Team Chat
		{
			if (ChatString.length() > 1)
			{
				ChatString = ChatString.substring(1);
				AddMessage(game.gamePlayer.Name + " (TO TEAM) > "
						+ ChatString, getColor(game.gamePlayer.Team));
				if (game.gameNetCode != null)
					game.gameNetCode.SendTCP("teamchat " + ChatString);
			}
			ChatString = "";
		}
		else
		{
			AddMessage(game.gamePlayer.Name + " > " + ChatString,
					getColor(game.gamePlayer.Team));
			if (game.gameNetCode != null)
				game.gameNetCode.SendTCP("broadcast " + ChatString);
			ChatString = "";
		}
	}
}
 
開發者ID:TheRemote,項目名稱:Spark,代碼行數:37,代碼來源:Chat.java

示例2: setKeyInput

private static boolean setKeyInput(int iCount) {
    boolean inputSet = true;

    switch(iCount) {
        case 0:
            // Input Korean q (#12610) /(#47)
            expectedResults = new int[]{ 12610, 47 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH}
                                    };
            break;

        case 1:
            // Input Korean q (#12610) /(#47) gh (#54840) \(#92)
            expectedResults = new int[]{ 12610, 47, 54840, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        case 2:
            // Input Korean q (#12610) /(#47) ghq (#54857) \(#92)
            expectedResults = new int[]{ 12610, 47, 54857, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_Q},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        case 3:
            // Input Korean q (#12610) /(#47) gh (#54840) \(#92)
            expectedResults = new int[]{ 12610, 47, 54840, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_Q},
                                        {KeyEvent.VK_BACK_SPACE},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        case 4:
            // Input Korean q (#12610) /(#47) g (#12622) \(#92)
            expectedResults = new int[]{ 12610, 47, 12622, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_Q},
                                        {KeyEvent.VK_BACK_SPACE},
                                        {KeyEvent.VK_BACK_SPACE},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        default:
            inputSet = false;
            break;
    }

    return inputSet;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:69,代碼來源:MissingCharsKorean.java


注:本文中的java.awt.event.KeyEvent.VK_SLASH屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。