vc podera com uma combinacao de KeyDown e KeyUp habilitar variaveis booleanas globais
 
tente isso:
 
//construtor
    caixa_de_texto.addKeyListener(new KeyListener(){
      public void keyTyped(KeyEvent e){}
      public void keyPressed(KeyEvent e){
        down(e);
      }
      public void keyReleased(KeyEvent e){
        up(e);
      }
    });
//variaveis
  boolean sft = false;
  boolean del = false;
 
//métodos
  public void down(KeyEvent e){
    System.out.println(e.getKeyCode());
        if (e.getKeyCode() == 16){//shift
          sft = true;
        } else if (e.getKeyCode() == 127){//del
          if (sft == true){
            if (del == false){
//              chamarEvento();
              System.out.println("teste");
              del = true;
            }
          }
        }
 
  }
  public void up(KeyEvent e){
        if (e.getKeyCode() == 16){//shift
          sft = false;
        } else if (e.getKeyCode() == 127){//del
          del = false;
        }
  }
 
 
 
 
----- Original Message -----
Sent: Wednesday, December 04, 2002 4:57 PM
Subject: [java-list] Tecla shift+del

Olá,
alguém sabe como faço para identificar que foram pressiona as teclas "shift+delete"?
Meu objetivo é habilitar no evento keyPressed se a combinação de teclas for acinada, os objetos de um editor sejam excluídos.
 
Ps: consegui excluir identificando somente a tecla delete:
 
public void keyPressed(KeyEvent key){
//Permite excluir elementos c/ delete
    if (key.getKeyCode()==KeyEvent.VK_DELETE)
        _diagrama.excluiSelecionados();
}
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.422 / Virus Database: 237 - Release Date: 20/11/2002

Responder a