Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.awt.*;

import java.awt.event.*;

public class Main {
    private static int keyStrokeModMac(String keyStrokeStr) {
        keyStrokeStr = keyStrokeStr.toLowerCase();
        int mod = 0;
        if (keyStrokeStr.contains("ctrl") || keyStrokeStr.contains("control")) {
            mod = mod | InputEvent.CTRL_MASK;
        }
        if (keyStrokeStr.contains("alt")) {
            mod = mod | Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
        }
        if (keyStrokeStr.contains("meta")) {
            mod = mod | InputEvent.ALT_MASK;
        }
        return mod;
    }
}