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");
        } 
       });

      }
     }

    廖世勇
  • 相关阅读:
    【shell】 for循环
    【shell】case语句
    【shell】if语句
    【shell】nmap工具的使用
    spring3 循环依赖
    spring3 DI基础
    spring3系列一
    正则表达式学习网址
    常用正则表达式
    hibernate延迟加载
  • 原文地址:https://www.cnblogs.com/liaoshiyong/p/3150969.html
Copyright © 2011-2022 走看看