Esempio n. 1
0
 public InputManager(Component component) {
   this.component = component;
   mouseLocation = new Point();
   centerLocation = new Point();
   component.addKeyListener(this);
   component.addMouseListener(this);
   component.addMouseMotionListener(this);
   component.addMouseWheelListener(this);
   component.setFocusTraversalKeysEnabled(false);
 }
  public InputManager(Component comp) {
    this.comp = comp;
    mousePosition = new Point();
    centerLocation = new Point();

    // register Listeners
    comp.addKeyListener(this);
    comp.addMouseListener(this);
    comp.addMouseMotionListener(this);
    comp.addMouseWheelListener(this);

    // tell focus traversal to take a hike!
    comp.setFocusTraversalKeysEnabled(false);
  }
Esempio n. 3
0
  /** Prepare the window that shall show the openGL content. */
  private void initWindow() {
    IllarionLookAndFeel.setupLookAndFeel();
    // create canvas that shall show the openGL content
    display = Graphics.getInstance().getRenderDisplay();
    display.getRenderArea().setBackground(Color.red);

    configChanged(IllaClient.getCfg(), CFG_RESOLUTION);

    final Component displayParent = display.getRenderArea();
    displayParent.setBackground(Color.green);
    displayParent.setVisible(true);

    // set up the window settings
    displayFrame = new Frame();
    displayFrame.setLayout(new BorderLayout(0, 0));
    displayFrame.setTitle(IllaClient.getVersionText());
    displayFrame.setBackground(Color.black);

    setIcon(displayFrame);

    displayFrame.addWindowListener(new ClientWindowListener());
    displayFrame.setResizable(false);
    displayFrame.setFocusable(false);
    displayFrame.setFocusableWindowState(true);
    displayFrame.setFocusTraversalKeysEnabled(false);
    displayParent.setFocusable(true);
    displayParent.setFocusTraversalKeysEnabled(false);

    // add the canvas to the window and make the canvas the openGL render
    // target.
    displayFrame.add(displayParent, BorderLayout.CENTER);
    displayFrame.pack();

    displayFrame.setLocationRelativeTo(null);
    displayFrame.setVisible(true);

    displayParent.requestFocusInWindow();

    final RenderDisplay usedDisplay = display;
    Graphics.getInstance()
        .getRenderManager()
        .addTask(
            new RenderTask() {
              @Override
              public boolean render(final int delta) {
                usedDisplay.startRendering();
                return false;
              }
            });
  }
Esempio n. 4
0
  /** Creates a new InputManager that listens to input from the specified component. */
  public InputManager(Component comp) {
    this.comp = comp;
    mouseLocation = new Point();
    centerLocation = new Point();

    // register key and mouse listeners
    comp.addKeyListener(this);
    comp.addMouseListener(this);
    comp.addMouseMotionListener(this);
    comp.addMouseWheelListener(this);

    // allow input of the TAB key and other keys normally
    // used for focus traversal
    comp.setFocusTraversalKeysEnabled(false);
  }
Esempio n. 5
0
 public void setFocusTraversalKeysEnabled(boolean enabled) {
   c.setFocusTraversalKeysEnabled(enabled);
 }