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

📄 guiinput.java

📁 Java编写的蓝牙手机遥控器
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    paramGraphics.setFont(this.font);
    this.fontHeight = this.font.getHeight();
    this.fontWidth = this.font.stringWidth("Back");
    this.boxHight = (this.fontHeight + 4);
    paramGraphics.setColor(this.borderColor);
    paramGraphics.fillRect(0, this.h - this.boxHight, this.w, this.boxHight);
    paramGraphics.setColor(this.bColor);
    paramGraphics.drawString("CLICK (* help)", 2, this.h - (this.boxHight - this.fontHeight) / 2, 36);
    paramGraphics.drawString("BACK", this.w - 2, this.h - (this.boxHight - this.fontHeight) / 2, 40);
  }

  public void paint(Graphics paramGraphics)
  {
    BluetoothRemoteControl.debug("Input paint");
    try
    {
      Object localObject1;
      if (this.mode == 0)
      {
        localObject1 = "Mouse Controller";
        String str = "(* for help)";
        int i = paramGraphics.getClipX();
        int j = paramGraphics.getClipY();
        int k = paramGraphics.getClipWidth();
        int l = paramGraphics.getClipHeight();
        paramGraphics.setColor(this.bColor);
        paramGraphics.fillRect(i, j, k, l);
        this.font = Font.getFont(0, 1, 0);
        this.fontHeight = this.font.getHeight();
        this.fontWidth = this.font.stringWidth((String)localObject1);
        this.fontWidthHelp = this.font.stringWidth(str);
        paramGraphics.setFont(this.font);
        paramGraphics.setColor(this.fColor);
        paramGraphics.drawString((String)localObject1, (k - this.fontWidth) / 2, this.fontHeight, 20);
        this.font = Font.getFont(0, 0, 8);
        this.fontHeight = this.font.getHeight();
        this.fontWidth = this.font.stringWidth((String)localObject1);
        this.fontWidthHelp = this.font.stringWidth(str);
        paramGraphics.setFont(this.font);
        paramGraphics.drawString(str, (k - this.fontWidthHelp) / 2, this.fontHeight + this.fontHeight * 2, 20);
        addOptions(paramGraphics);
      }
      else
      {
        localObject1 = (this.offScreen == null) ? paramGraphics : this.offScreen.getGraphics();
        this.w = ((Graphics)localObject1).getClipWidth();
        this.h = ((Graphics)localObject1).getClipHeight();
        ((Graphics)localObject1).drawImage(this.image, 0, 0, 20);
        addOptions((Graphics)localObject1);
        if (this.offScreen != null)
          paramGraphics.drawImage(this.offScreen, 0, 0, 24);
      }
    }
  }

  public void commandAction(Command paramCommand, Displayable paramDisplayable)
  {
    if ((paramCommand == this.SCR_MAIN_BACK_CMD) && (paramDisplayable == this.helpScreen))
    {
      Display.getDisplay(this.own).setCurrent(this);
      return;
    }
    if ((paramCommand == this.SCR_MAIN_BACK_CMD) && (paramDisplayable == this.textInput))
    {
      Display.getDisplay(this.own).setCurrent(this);
      return;
    }
    if ((paramCommand == this.SCR_MAIN_OK_CMD) && (paramDisplayable == this.textInput))
    {
      String str = this.textInput.getString();
      BluetoothRemoteControl.debug("textInput: " + str);
      int i = str.length();
      byte[] arrayOfByte = new byte[4 + i];
      arrayOfByte[0] = 1;
      arrayOfByte[1] = 5;
      GUIGeneral.setLengthAtPos(arrayOfByte, 2, i);
      GUIGeneral.copyDataToPos(arrayOfByte, 4, str, i);
      write(arrayOfByte);
      Display.getDisplay(this.own).setCurrent(this);
      return;
    }
    if (paramCommand == Alert.DISMISS_COMMAND)
    {
      Display.getDisplay(this.own).setCurrent(this);
      return;
    }
  }

  private void unLoad()
  {
    byte[] arrayOfByte = new byte[4];
    arrayOfByte[0] = 1;
    arrayOfByte[1] = 3;
    arrayOfByte[2] = 0;
    arrayOfByte[3] = 0;
    write(arrayOfByte);
  }

  private void sendFIRE()
  {
    byte[] arrayOfByte = new byte[6];
    arrayOfByte[0] = 1;
    arrayOfByte[1] = 1;
    arrayOfByte[2] = 0;
    arrayOfByte[3] = 2;
    arrayOfByte[4] = NUM_FIRE;
    arrayOfByte[5] = 0;
    write(arrayOfByte);
  }

  private void sendClearKey()
  {
    byte[] arrayOfByte = new byte[4];
    arrayOfByte[0] = 1;
    arrayOfByte[1] = 6;
    arrayOfByte[2] = 0;
    arrayOfByte[3] = 0;
    write(arrayOfByte);
  }

  private void sendKeyRelease()
  {
    byte[] arrayOfByte = new byte[4];
    arrayOfByte[0] = 1;
    arrayOfByte[1] = 4;
    arrayOfByte[2] = 0;
    arrayOfByte[3] = 0;
    write(arrayOfByte);
  }

  private void write(byte[] paramArrayOfByte)
  {
    this.parent.write(paramArrayOfByte);
  }

  boolean interpretate(int paramInt, byte paramByte)
  {
    byte[] arrayOfByte = new byte[6];
    arrayOfByte[0] = 1;
    arrayOfByte[1] = 1;
    arrayOfByte[2] = 0;
    arrayOfByte[3] = 2;
    arrayOfByte[4] = 0;
    arrayOfByte[5] = paramByte;
    BluetoothRemoteControl.debug("interpretate");
    if (paramInt > 0);
    switch (paramInt)
    {
    case 48:
      BluetoothRemoteControl.debug("KEY_NUM0");
      arrayOfByte[4] = NUM0;
      break;
    case 49:
      BluetoothRemoteControl.debug("KEY_NUM1");
      arrayOfByte[4] = NUM1;
      break;
    case 50:
      BluetoothRemoteControl.debug("KEY_NUM2");
      arrayOfByte[4] = NUM2;
      break;
    case 51:
      BluetoothRemoteControl.debug("KEY_NUM3");
      arrayOfByte[4] = NUM3;
      break;
    case 52:
      BluetoothRemoteControl.debug("KEY_NUM4");
      arrayOfByte[4] = NUM4;
      break;
    case 53:
      BluetoothRemoteControl.debug("KEY_NUM5");
      arrayOfByte[4] = NUM5;
      break;
    case 54:
      BluetoothRemoteControl.debug("KEY_NUM6");
      arrayOfByte[4] = NUM6;
      break;
    case 55:
      BluetoothRemoteControl.debug("KEY_NUM7");
      arrayOfByte[4] = NUM7;
      break;
    case 56:
      BluetoothRemoteControl.debug("KEY_NUM8");
      arrayOfByte[4] = NUM8;
      break;
    case 57:
      BluetoothRemoteControl.debug("KEY_NUM9");
      arrayOfByte[4] = NUM9;
      break;
    case 35:
      BluetoothRemoteControl.debug("#");
      arrayOfByte[4] = KEY_POUND;
      showTextBox();
      break;
    case 42:
      showHelpScreen();
      return true;
    case 36:
    case 37:
    case 38:
    case 39:
    case 40:
    case 41:
    case 43:
    case 44:
    case 45:
    case 46:
    case 47:
    default:
      BluetoothRemoteControl.debug("interpretate no match keyCode > 0 !");
      return false;
      int i = getGameAction(paramInt);
      switch (i)
      {
      case 1:
        return false;
      case 6:
        return false;
      case 2:
        return false;
      case 5:
        return false;
      case 8:
        BluetoothRemoteControl.debug("Canvas.FIRE");
        arrayOfByte[4] = NUM_FIRE;
        break;
      case 3:
      case 4:
      case 7:
      default:
        BluetoothRemoteControl.debug("interpretate no match keyCode < 0 !");
        return false;
      }
    }
    write(arrayOfByte);
    return true;
  }

  private boolean isGameKey(int paramInt)
  {
    int i = getGameAction(paramInt);
    switch (i)
    {
    case 1:
      return true;
    case 6:
      return true;
    case 2:
      return true;
    case 5:
      return true;
    case 3:
    case 4:
    }
    return false;
  }

  private boolean detectGameKeyStatus()
  {
    int i = 0;
    int k = 0;
    int j = getKeyStates();
    if ((j & 0x4) != 0)
    {
      i = 1;
      this.gameKeyPack[4] = NUM_LEFT;
    }
    else if ((j & 0x20) != 0)
    {
      i = 1;
      this.gameKeyPack[4] = NUM_RIGHT;
    }
    else if ((j & 0x2) != 0)
    {
      i = 1;
      this.gameKeyPack[4] = NUM_UP;
    }
    else if ((j & 0x40) != 0)
    {
      i = 1;
      this.gameKeyPack[4] = NUM_DOWN;
    }
    if (i != 0)
    {
      k = 1;
      this.isGameKeyPressed = true;
      write(this.gameKeyPack);
    }
    if ((i == 0) && (this.isGameKeyPressed))
    {
      k = 1;
      this.isGameKeyPressed = false;
      keyIsReleased();
    }
    return k;
  }
}

⌨️ 快捷键说明

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