zoukankan      html  css  js  c++  java
  • GUI 中监听 文本框实时改变的实例

    GUI 中监听 文本框实时改变的实例

    以下是一个关于GUI 中监听JTextField 发生改变时的代码段, 

    private JTextField getGuestPayTextField() {
      if (guestPayTextField == null) {
       guestPayTextField = new JTextField();
       guestPayTextField.setBounds(new java.awt.Rectangle(90, 240,124, 25));
       guestPayTextField.getDocument().addDocumentListener(newDocumentListener() { //这是个内部类

        public void insertUpdate(DocumentEvente) {
             System.out.println("insertUpdate");
        }

        public voidremoveUpdate(DocumentEvent e) {     

             System.out.println("removeUpdate");
        }

        public voidchangedUpdate(DocumentEvent e) {    

             System.out.println("changedUpdate");
        } 
       });

      }
     }

    廖世勇
  • 相关阅读:
    《我曾》火了:人这辈子,最怕突然听懂这首歌
    SpringMVC的运行流程
    Directive 自定义指令
    Vue 过滤器
    MVC 和 MVVM的区别
    vue指令
    async
    Generator
    单词搜索
    Promise
  • 原文地址:https://www.cnblogs.com/liaoshiyong/p/3150969.html
Copyright © 2011-2022 走看看