Right click in text field



  • Why, in my annex, nothing happens when a mouse is right in the text field.JTextField? You need to hang your listener? If so, can I see an example? I'd like the right click to call a standard floating menu (copy, insert, etc.).



  • Somehow:

    textField.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
          if (e.getButton() == MouseEvent.BUTTON3){
            //если нажата правая кнопка--тут выполнить действие ее нажатия
            //P.S. BUTTON1--Левая кнопка, BUTTON2--колесо мыши                      
           }
        }
    }
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2