⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 keyinputscreen.java

📁 這程式是用J2ME撰寫而成
💻 JAVA
字号:
/*wiseremote - a client/server remote control system for wireless devicesCopyright (C) 2005 Martin ProfittlichThis program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of 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 ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.*/import java.lang.*;import javax.microedition.lcdui.*;import javax.microedition.lcdui.game.*;class KeyInputScreen extends Canvas implements CommandListener{  private Image image;  public KeyInputScreen ()    {      super ();      String fix = WiseremoteMIDlet.instance.getAppProperty ("fix6230");      if (fix != null)        {          addCommand (new Command ("Select", Command.CANCEL, 1));          addCommand (new Command ("Back", Command.BACK, 1));        }      else        {          addCommand (new Command ("Select", Command.OK, 1));          addCommand (new Command ("Back", Command.BACK, 1));        }      setCommandListener (this);    }  public void setImage (Image i)    {      image = i;    }  protected void keyRepeated (int keyCode)    {      keyEvent (keyCode, "REP_");    }  protected void keyReleased (int keyCode)    {      keyEvent (keyCode, "REL_");    }  protected void keyPressed (int keyCode)    {      keyEvent (keyCode, "");    }       private void keyEvent (int keyCode, String prefix)    {      switch (keyCode)        {          case KEY_NUM1:              WiseremoteMIDlet.instance.protocol.exec (prefix + "1");              break;          case KEY_NUM2:              WiseremoteMIDlet.instance.protocol.exec (prefix + "2");              break;          case KEY_NUM3:              WiseremoteMIDlet.instance.protocol.exec (prefix + "3");              break;          case KEY_NUM4:              WiseremoteMIDlet.instance.protocol.exec (prefix + "4");              break;          case KEY_NUM5:              WiseremoteMIDlet.instance.protocol.exec (prefix + "5");              break;          case KEY_NUM6:              WiseremoteMIDlet.instance.protocol.exec (prefix + "6");              break;          case KEY_NUM7:              WiseremoteMIDlet.instance.protocol.exec (prefix + "7");              break;          case KEY_NUM8:              WiseremoteMIDlet.instance.protocol.exec (prefix + "8");              break;          case KEY_NUM9:              WiseremoteMIDlet.instance.protocol.exec (prefix + "9");              break;          case KEY_NUM0:              WiseremoteMIDlet.instance.protocol.exec (prefix + "0");              break;          case KEY_POUND:              WiseremoteMIDlet.instance.protocol.exec (prefix + "#");              break;          case KEY_STAR:              WiseremoteMIDlet.instance.protocol.exec (prefix + "*");              break;          default:              if (getGameAction (keyCode) == Canvas.UP)                 {                  WiseremoteMIDlet.instance.protocol.exec (prefix + "UP");                }              if (getGameAction (keyCode) == Canvas.DOWN)                {                  WiseremoteMIDlet.instance.protocol.exec (prefix + "DOWN");                }              if (getGameAction (keyCode) == Canvas.LEFT)                {                  WiseremoteMIDlet.instance.protocol.exec (prefix + "LEFT");                }              if (getGameAction (keyCode) == Canvas.RIGHT)                {                  WiseremoteMIDlet.instance.protocol.exec (prefix + "RIGHT");                }              break;        }      repaint ();    }  public void commandAction (Command c, Displayable d)    {      if (c.getLabel () == "Select")        {          WiseremoteMIDlet.instance.protocol.exec ("SELECT");        }      if (c.getLabel () == "Back")        {          WiseremoteMIDlet.instance.protocol.exec ("BACK");        }    }  protected void paint (Graphics g)    {      if (image == null)        {          g.setColor (255, 255, 255);          g.fillRect (0, 0, getWidth (), getHeight ());          g.setColor (0, 0, 0);          g.drawString ("No Image", 2, 2, Graphics.TOP|Graphics.LEFT);        }      else        {          g.drawImage (image,                   getWidth () / 2 - image.getWidth () / 2,                   getHeight () / 2 - image.getHeight () / 2,                   Graphics.TOP|Graphics.LEFT);        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -