示例#1
0
  /** 键盘按下 */
  public void keyPressed(KeyEvent e) {

    int code = e.getKeyCode();
    if (e.getModifiers() == InputEvent.ALT_MASK && e.getKeyCode() == KeyEvent.VK_F4) {
      if (handler != null) {
        handler.getScene().close();
      }
    }
    try {
      this.onKey(e);
      if (!keyDown[code & 0xFF]) {
        keyDown[code & 0xFF] = true;
        keyPressed[this.pressedKey] = code;
        this.pressedKey++;
        if (keyMap.size() > 0) {
          Action action = (Action) keyMap.get(String.valueOf(code));
          if (action != null) {
            action.press();
          }
        }
      }
      e.consume();
    } catch (Exception ex) {
      pressedKey = 0;
    }
  }
示例#2
0
 /**
  * 获得Screen的画面边界
  *
  * @return
  */
 public Rectangle getBounds() {
   if (handler == null) {
     return null;
   }
   Window window = handler.getScene().getWindow();
   Rectangle bounds = window.getBounds();
   Insets insets = window.getInsets();
   return new Rectangle(
       bounds.x + insets.left,
       bounds.y + insets.top,
       bounds.width - (insets.left + insets.top),
       bounds.height - (insets.top + insets.bottom));
 }
示例#3
0
 /**
  * 设置主窗口标题
  *
  * @param title
  */
 public void setFrameTitle(String title) {
   if (handler != null) {
     handler.getScene().setTitle(title);
   }
 }
示例#4
0
 /** 设置主窗体小图标 */
 public void setFrameIcon(String fileName) {
   if (handler != null) {
     handler.getScene().setIconImage(fileName);
   }
 }
示例#5
0
 /**
  * 设置主窗体小图标
  *
  * @param image
  */
 public void setFrameIcon(Image icon) {
   if (handler != null) {
     handler.getScene().setIconImage(icon);
   }
 }
示例#6
0
 /** 还原窗体 */
 public void updateNormalScreen() {
   checkFullScreen();
   if (handler != null) {
     handler.getScene().updateNormalScreen();
   }
 }
示例#7
0
 /** 全屏窗体为指定大小 */
 public void updateFullScreen(int w, int h) {
   checkFullScreen();
   if (handler != null) {
     handler.getScene().updateFullScreen(w, h);
   }
 }