Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 * DosBoxMenuUtility.java
 *
 * Written by
 *  Locnet <android.locnet@gmail.com>
 *
 * This file is part of VICE, the Versatile Commodore Emulator.
 * See README for copyright notice.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 *  02111-1307  USA.
 *
 */

import android.view.Menu;

import android.view.SubMenu;

public class Main {
    private final static int MENU_FIT = 3;
    private final static int MENU_KEYBOARD_SPECIAL = 6;
    private final static int MENU_KEYBOARD = 7;
    private final static int MENU_SETTINGS_SCALE_FILTER = 13;
    private final static int MENU_SETTINGS_FRAMESKIP = 17;
    private final static int MENU_SETTINGS_SHOW_INFO = 19;
    private final static int MENU_SETTINGS_HELP = 21;
    private final static int MENU_SETTINGS_LICENSE = 22;
    private final static int MENU_SETTINGS_KEY_MAPPER = 23;
    private final static int MENU_SETTINGS_SCALE_FACTOR = 24;
    private final static int MENU_SETTINGS_MOUSE_SENSITIVITY = 26;
    private final static int MENU_SETTINGS_JOYKEY_SET = 27;
    private final static int MENU_SETTINGS_FAST_MOUSE = 28;
    private final static int MENU_SETTINGS_TRUE_DRIVE = 29;
    private final static int MENU_SETTINGS_BETTER_VIDEO = 30;
    private final static int MENU_INPUT_MOUSE = 41;
    private final static int MENU_INPUT_JOYSTICK = 42;
    private final static int MENU_INPUT_SCROLL = 43;
    private final static int MENU_INPUT_HARDKEY = 44;
    private final static int MENU_INPUT_INPUT_METHOD = 45;
    private final static int MENU_INPUT_TAP_CLICK = 46;
    private final static int MENU_INPUT_FORCE_KEYBOARD = 47;
    private final static int MENU_INPUT_USE_LEFT_ALT = 48;
    private final static int MENU_INPUT_KEYUP_DELAY = 50;
    private final static int MENU_INPUT_SWAP_JOYPORT = 55;
    private final static int MENU_BUTTON_SHOW = 91;
    private final static int MENU_BUTTON_HIDE = 92;
    private final static int MENU_BUTTON_OFF = 93;
    private final static int MENU_BUTTON_ALWAYS_SHOW_JOYSTICK = 94;
    private final static int MENU_BUTTON_LARGE_JOYSTICK = 95;

    static public boolean doCreateOptionsMenu(Menu menu) {
        menu.add(0, MENU_KEYBOARD_SPECIAL, 0, "Special Keys");

        menu.add(0, MENU_FIT, 0, "Resize");
        SubMenu inputModeMenu = menu.addSubMenu("Input Mode");
        inputModeMenu.add(1, MENU_INPUT_MOUSE, 0, "Trackpad").setChecked(true);
        inputModeMenu.add(1, MENU_INPUT_JOYSTICK, 0, "Joystick");
        inputModeMenu.add(1, MENU_INPUT_SCROLL, 0, "Scroll Screen");
        inputModeMenu.setGroupCheckable(1, true, true);

        inputModeMenu.add(0, MENU_INPUT_SWAP_JOYPORT, 0, "Swap Joystick Ports");

        inputModeMenu.add(0, MENU_INPUT_HARDKEY, 0, "Vol. Up/Down as button").setCheckable(true);
        inputModeMenu.add(0, MENU_INPUT_USE_LEFT_ALT, 0, "Map Left-Alt Key").setCheckable(true);
        inputModeMenu.add(0, MENU_INPUT_TAP_CLICK, 0, "Tap Screen as click").setCheckable(true);
        inputModeMenu.add(0, MENU_INPUT_INPUT_METHOD, 0, "Input Method");
        inputModeMenu.add(0, MENU_INPUT_FORCE_KEYBOARD, 0, "Show Keyboard Fix").setCheckable(true);
        inputModeMenu.add(0, MENU_INPUT_KEYUP_DELAY, 0, "Keypress Fix").setCheckable(true);

        SubMenu buttonMenu = menu.addSubMenu("Buttons");
        buttonMenu.add(1, MENU_BUTTON_HIDE, 0, "Hide Buttons");
        buttonMenu.add(1, MENU_BUTTON_SHOW, 0, "Show Buttons (Slower)").setChecked(true);
        buttonMenu.add(1, MENU_BUTTON_OFF, 0, "Disable Buttons");
        buttonMenu.setGroupCheckable(1, true, true);
        buttonMenu.add(0, MENU_BUTTON_ALWAYS_SHOW_JOYSTICK, 0, "Always Show Joystick").setCheckable(true);
        buttonMenu.add(0, MENU_BUTTON_LARGE_JOYSTICK, 0, "Large Joystick").setCheckable(true);

        SubMenu settingMenu = menu.addSubMenu("Settings");
        settingMenu.add(0, MENU_SETTINGS_FRAMESKIP, 0, "Frameskip");
        settingMenu.add(0, MENU_SETTINGS_BETTER_VIDEO, 0, "Better Video").setCheckable(true);
        settingMenu.add(0, MENU_SETTINGS_SHOW_INFO, 0, "Show Info").setCheckable(true);
        settingMenu.add(0, MENU_SETTINGS_TRUE_DRIVE, 0, "True Drive Emulation").setCheckable(true);
        settingMenu.add(0, MENU_SETTINGS_SCALE_FILTER, 0, "Smooth Resize (Slower)").setCheckable(true);
        settingMenu.add(0, MENU_SETTINGS_SCALE_FACTOR, 0, "Resize Mode");
        settingMenu.add(0, MENU_SETTINGS_FAST_MOUSE, 0, "Better Mouse (Slower)").setCheckable(true);
        settingMenu.add(0, MENU_SETTINGS_MOUSE_SENSITIVITY, 0, "Mouse Sensitivity");
        settingMenu.add(0, MENU_SETTINGS_JOYKEY_SET, 0, "Joystick Keys");
        settingMenu.add(0, MENU_SETTINGS_KEY_MAPPER, 0, "Button Mapper");
        settingMenu.add(0, MENU_SETTINGS_HELP, 0, "Help");
        settingMenu.add(0, MENU_SETTINGS_LICENSE, 0, "Save license to /sdcard/gpl.txt");

        menu.add(0, MENU_KEYBOARD, 0, "Keyboard");
        return true;
    }
}