Пример #1
0
    public void keyPressed(KeyEvent ke) {

      if (ke.getKeyCode() == ke.VK_TAB) {
        int x = ((JTable) ke.getSource()).getSelectedColumn();
        int y = ((JTable) ke.getSource()).getSelectedRow();
        int maxX = ((JTable) ke.getSource()).getColumnCount();
        int maxY = ((JTable) ke.getSource()).getRowCount();
        TableModel tm = ((JTable) ke.getSource()).getModel();
        if (x == maxX - 1 && y == maxY - 1) {
          ((DefaultTableModel) tm).addRow(new Object[maxX]);
        }
      }
    }
Пример #2
0
 public void keyPressed(KeyEvent e) {
   if (this.pan.getGameState() != null && this.pan.getGameState()) {
     if (e.getKeyCode() == KeyEvent.VK_UP) {
       // this.pan.moveUp();
     }
     if (e.getKeyCode() == KeyEvent.VK_DOWN) {
       // this.pan.moveDown();
     }
     if (e.getKeyCode() == KeyEvent.VK_LEFT) {
       this.pan.moveLeft();
     }
     if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
       this.pan.moveRight();
     }
     if (e.getKeyCode() == KeyEvent.VK_A) {
       this.pan.rCCW();
     }
     if (e.getKeyCode() == KeyEvent.VK_D) {
       this.pan.rCW();
     }
     if (e.getKeyCode() == KeyEvent.VK_SPACE) { // set piece in place
       this.pan.placeElectromino();
     }
     if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
       this.pan.setMenuState(new Boolean(true));
       this.pan.setGameState(new Boolean(false));
     }
   }
 }
Пример #3
0
 static void handleKeyTyped(KeyEvent e) {
   if (e.getKeyChar() == ' ') {
     currentSequenceNumDisplay++;
     scribbles = Collections.synchronizedList(new ArrayList<DrawObject>());
     currentScribbleNum = 0;
   }
   drawArea.repaint();
 }