📄 fullcanvas.java
字号:
/* * Nokia API for MicroEmulator * Copyright (C) 2003 Markus Heberling <markus@heberling.net> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Contributor(s): * daniel(at)angrymachine.com.ar */ package com.nokia.mid.ui; import javax.microedition.lcdui.Canvas;import javax.microedition.lcdui.Command;import javax.microedition.lcdui.CommandListener;import javax.microedition.lcdui.Displayable;import com.barteo.emulator.device.DeviceFactory;/** The Softkey Codes are not generated by normal devices. In this class they are * emulated with commands. SOFTKEY1 is mapped to Command.OK and SOFTKEY2 to * Command.BACK. You should edit your device config file, so that OK is on the * left and Back on the right. */public abstract class FullCanvas extends Canvas{ public static final int KEY_SOFTKEY1 = -6; public static final int KEY_SOFTKEY2 = -7; public static final int KEY_SEND = -10; public static final int KEY_END = -11; public static final int KEY_SOFTKEY3 = -5; public static final int KEY_UP_ARROW = -1; public static final int KEY_DOWN_ARROW = -2; public static final int KEY_LEFT_ARROW = -3; public static final int KEY_RIGHT_ARROW = -4; /** Creates a new FullCanvas. * Adds two empty commands to emulate softkey functions. */ protected FullCanvas() { super(); super.addCommand(new NokiaCommand(KEY_SOFTKEY1,Command.OK)); super.addCommand(new NokiaCommand(KEY_SOFTKEY2,Command.BACK)); super.setCommandListener(new NokiaCommandListener(this)); } /** Commands are not supported by FullCanvas * @param cmd */ public void addCommand(Command cmd) { throw new IllegalStateException(); } public int getWidth() { return DeviceFactory.getDevice().getDeviceDisplay().getFullWidth(); } public int getHeight() { return DeviceFactory.getDevice().getDeviceDisplay().getFullHeight(); } /** Commands are not supported by FullCanvas * @param l */ public void setCommandListener(CommandListener l) { throw new IllegalStateException(); } //used to simulate softbutton key events void press(int i) { keyPressed(i); keyReleased(i); } }class NokiaCommandListener implements CommandListener{ FullCanvas fc; NokiaCommandListener(FullCanvas f) { fc=f; } public void commandAction(Command c, Displayable d) { fc.press(((NokiaCommand)c).getKey()); //this.keyReleased(((NokiaCommand)c).getKey()); } }class NokiaCommand extends Command{ int key; NokiaCommand(int key, int type) { super("", type, 1); this.key=key; } int getKey() { return key; } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -