pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

<i id='JNKaa'><tr id='JNKaa'><dt id='JNKaa'><q id='JNKaa'><span id='JNKaa'><b id='JNKaa'><form id='JNKaa'><ins id='JNKaa'></ins><ul id='JNKaa'></ul><sub id='JNKaa'></sub></form><legend id='JNKaa'></legend><bdo id='JNKaa'><pre id='JNKaa'><center id='JNKaa'></center></pre></bdo></b><th id='JNKaa'></th></span></q></dt></tr></i><div class="oiwvxn3" id='JNKaa'><tfoot id='JNKaa'></tfoot><dl id='JNKaa'><fieldset id='JNKaa'></fieldset></dl></div>

    <legend id='JNKaa'><style id='JNKaa'><dir id='JNKaa'><q id='JNKaa'></q></dir></style></legend>

        <tfoot id='JNKaa'></tfoot>
          <bdo id='JNKaa'></bdo><ul id='JNKaa'></ul>
      1. <small id='JNKaa'></small><noframes id='JNKaa'>

      2. JTable:檢測單元格數(shù)據(jù)變化

        JTable: Detect cell data change(JTable:檢測單元格數(shù)據(jù)變化)
        <tfoot id='mPBcG'></tfoot>
      3. <i id='mPBcG'><tr id='mPBcG'><dt id='mPBcG'><q id='mPBcG'><span id='mPBcG'><b id='mPBcG'><form id='mPBcG'><ins id='mPBcG'></ins><ul id='mPBcG'></ul><sub id='mPBcG'></sub></form><legend id='mPBcG'></legend><bdo id='mPBcG'><pre id='mPBcG'><center id='mPBcG'></center></pre></bdo></b><th id='mPBcG'></th></span></q></dt></tr></i><div class="p05rtv0" id='mPBcG'><tfoot id='mPBcG'></tfoot><dl id='mPBcG'><fieldset id='mPBcG'></fieldset></dl></div>

            <legend id='mPBcG'><style id='mPBcG'><dir id='mPBcG'><q id='mPBcG'></q></dir></style></legend>
              <tbody id='mPBcG'></tbody>

          1. <small id='mPBcG'></small><noframes id='mPBcG'>

                <bdo id='mPBcG'></bdo><ul id='mPBcG'></ul>
                • 本文介紹了JTable:檢測單元格數(shù)據(jù)變化的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  在 Netbeans 中,我使用 GUI Builder 將 JTable 插入到我的應(yīng)用程序中.

                  到目前為止,我只有一個類 (CustomerDB):

                  I have just one class (CustomerDB) so far which is:

                  package CustomerDB;
                  
                  import [...];
                  
                  public class CustomerDB extends javax.swing.JFrame {
                  
                      CellEditorListener ChangeNotification = new CellEditorListener() {
                          public void editingCanceled(ChangeEvent e) {
                              System.out.println("The user canceled editing.");
                          }
                  
                          public void editingStopped(ChangeEvent e) {
                              System.out.println("The user stopped editing successfully.");
                          }
                      };
                  
                      public CustomerDB() {
                          customerTable = new javax.swing.JTable();
                          customerTable.setModel(new javax.swing.table.DefaultTableModel(
                              new Object [][] {
                                  {null, null, null, null},
                                  {null, null, null, null},
                                  {null, null, null, null},
                                  {null, null, null, null},
                                  {null, null, null, null},
                                  {null, null, null, null},
                                  {null, null, null, null},
                                  {null, null, null, null},
                                  {null, null, null, null},
                                  {null, null, null, null}
                              },
                              new String [] {
                                  "ID", "Name", "Address", "Phone"
                              }
                          ) {
                              Class[] types = new Class [] {
                                  java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
                              };
                  
                              public Class getColumnClass(int columnIndex) {
                                  return types [columnIndex];
                              }
                          });
                          customerTable.getDefaultEditor(String.class).addCellEditorListener(ChangeNotification);
                      } 
                  
                      public static void main(String args[]) {
                          java.awt.EventQueue.invokeLater(new Runnable() {
                              public void run() {
                                  new CustomerDB().setVisible(true);
                              }
                          });
                      }
                  
                      // Variables declaration - do not modify
                      [...]
                      private javax.swing.JTable customerTable;
                      [...]
                      // End of variables declaration
                  
                  }
                  

                  每當(dāng)用戶更改表格中的數(shù)據(jù)時,我都想獲取該單元格的舊值(可選)和新值.

                  為了獲取這些數(shù)據(jù),我嘗試實現(xiàn)一個事件監(jiān)聽器:

                  In order to get this data, I tried to implement an event listener:

                      CellEditorListener ChangeNotification = new CellEditorListener() {
                          public void editingCanceled(ChangeEvent e) {
                              System.out.println("The user canceled editing.");
                          }
                  
                          public void editingStopped(ChangeEvent e) {
                              System.out.println("The user stopped editing successfully.");
                          }
                      };
                  

                  然后我將這個 CellEditorListener 分配給表格(它的單元格編輯器):

                      customerTable.getDefaultEditor(String.class).addCellEditorListener(ChangeNotification);
                  

                  到目前為止有效.但它還不能讓我檢測到這個單元格的舊值和新值.我還需要做什么?

                  非常感謝您!

                  推薦答案

                  但它還不能讓我檢測到這個單元格的舊值和新值.我還需要做什么?

                  But it doesn't yet enable me to detect the old and the new value of this cell. What else do I have to do?

                  使用 TableModelListener 來監(jiān)聽變化更容易,但它仍然存在無法訪問舊值的問題.

                  It is easier to use a TableModelListener to listen for changes but it still has the problem of not being able to access the old value.

                  查看表格單元偵聽器,了解可讓您訪問的解決方案舊值"和新值".

                  Check out the Table Cell Listener for a solution that gives you access to the "old value" as well as the "new value".

                  這篇關(guān)于JTable:檢測單元格數(shù)據(jù)變化的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測 32 位 int 上的整數(shù)溢出?)
                  Local variables before return statements, does it matter?(return 語句之前的局部變量,這有關(guān)系嗎?)
                  How to convert Integer to int?(如何將整數(shù)轉(zhuǎn)換為整數(shù)?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內(nèi)創(chuàng)建一個隨機打亂數(shù)字的 int 數(shù)組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠?qū)?0xff000000 存儲為 int?)

                    <small id='JZRcW'></small><noframes id='JZRcW'>

                  1. <i id='JZRcW'><tr id='JZRcW'><dt id='JZRcW'><q id='JZRcW'><span id='JZRcW'><b id='JZRcW'><form id='JZRcW'><ins id='JZRcW'></ins><ul id='JZRcW'></ul><sub id='JZRcW'></sub></form><legend id='JZRcW'></legend><bdo id='JZRcW'><pre id='JZRcW'><center id='JZRcW'></center></pre></bdo></b><th id='JZRcW'></th></span></q></dt></tr></i><div class="rdzdvqt" id='JZRcW'><tfoot id='JZRcW'></tfoot><dl id='JZRcW'><fieldset id='JZRcW'></fieldset></dl></div>
                    <legend id='JZRcW'><style id='JZRcW'><dir id='JZRcW'><q id='JZRcW'></q></dir></style></legend>
                      <tbody id='JZRcW'></tbody>
                    <tfoot id='JZRcW'></tfoot>
                        <bdo id='JZRcW'></bdo><ul id='JZRcW'></ul>
                          • 主站蜘蛛池模板: 淄博不锈钢,淄博不锈钢管,淄博不锈钢板-山东振远合金科技有限公司 | 活性炭-蜂窝-椰壳-柱状-粉状活性炭-河南唐达净水材料有限公司 | 创富网-B2B网站|供求信息网|b2b平台|专业电子商务网站 | IP检测-检测您的IP质量 | 扒渣机厂家_扒渣机价格_矿用扒渣机_铣挖机_撬毛台车_襄阳永力通扒渣机公司 | 智能楼宇-楼宇自控系统-楼宇智能化-楼宇自动化-三水智能化 | wika威卡压力表-wika压力变送器-德国wika代理-威卡总代-北京博朗宁科技 | 密集架-密集柜厂家-智能档案密集架-自动选层柜订做-河北风顺金属制品有限公司 | 成都软件开发_OA|ERP|CRM|管理系统定制开发_成都码邻蜀科技 | 上海新光明泵业制造有限公司-电动隔膜泵,气动隔膜泵,卧式|立式离心泵厂家 | 焊管生产线_焊管机组_轧辊模具_焊管设备_焊管设备厂家_石家庄翔昱机械 | 涂层测厚仪_光泽度仪_uv能量计_紫外辐照计_太阳膜测试仪_透光率仪-林上科技 | 自动钻孔机-全自动数控钻孔机生产厂家-多米(广东)智能装备有限公司 | 视觉检测设备_自动化检测设备_CCD视觉检测机_外观缺陷检测-瑞智光电 | 东莞注册公司-代办营业执照-东莞公司注册代理记账-极刻财税 | 生物风-销售载体,基因,质粒,ATCC细胞,ATCC菌株等,欢迎购买-百风生物 | 机床导轨_导轨板_滚轮导轨-上海旻佑精密机械有限公司 | 【法利莱住人集装箱厂家】—活动集装箱房,集装箱租赁_大品牌,更放心 | 电位器_轻触开关_USB连接器_广东精密龙电子科技有限公司 | 杜甫仪器官网|实验室平行反应器|升降水浴锅|台式低温循环泵 | 废气处理设备-工业除尘器-RTO-RCO-蓄热式焚烧炉厂家-江苏天达环保设备有限公司 | 天空彩票天下彩,天空彩天空彩票免费资料,天空彩票与你同行开奖,天下彩正版资料大全 | 山东包装,山东印刷厂,济南印刷厂-济南富丽彩印刷有限公司 | 环氧树脂地坪漆_济宁市新天地漆业有限公司| 汽车整车综合环境舱_军标砂尘_盐雾试验室试验箱-无锡苏南试验设备有限公司 | 深圳湾1号房价_深圳湾1号二手房源 | 玖容气动液压设备有限公司-气液增压缸_压力机_增压机_铆接机_增压器 | 生产自动包装秤_颗粒包装秤_肥料包装秤等包装机械-郑州鑫晟重工科技有限公司 | 附着力促进剂-尼龙处理剂-PP处理剂-金属附着力处理剂-东莞市炅盛塑胶科技有限公司 | 萃取箱-萃取槽-PVC萃取箱厂家-混合澄清槽- 杭州南方化工设备 | 清水-铝合金-建筑模板厂家-木模板价格-铝模板生产「五棵松」品牌 | 威海防火彩钢板,威海岩棉复合板,威海彩钢瓦-文登区九龙岩棉复合板厂 | 全自动贴标机-套标机-工业热风机-不干胶贴标机-上海厚冉机械 | 钢木实验台-全钢实验台-化验室通风柜-实验室装修厂家-杭州博扬实验设备 | ALC墙板_ALC轻质隔墙板_隔音防火墙板_轻质隔墙材料-湖北博悦佳 | 冷热冲击试验箱_温度冲击试验箱价格_冷热冲击箱排名_林频厂家 | 洁净棚-洁净工作棚-无菌室-净化工程公司_北京卫护科技有限公司 | 铁艺,仿竹,竹节,护栏,围栏,篱笆,栅栏,栏杆,护栏网,网围栏,厂家 - 河北稳重金属丝网制品有限公司 山东太阳能路灯厂家-庭院灯生产厂家-济南晟启灯饰有限公司 | 立式_复合式_壁挂式智能化电伴热洗眼器-上海达傲洗眼器生产厂家 理化生实验室设备,吊装实验室设备,顶装实验室设备,实验室成套设备厂家,校园功能室设备,智慧书法教室方案 - 东莞市惠森教学设备有限公司 | 自清洗过滤器-全自动自清洗过反冲洗过滤器 - 中乂(北京)科技有限公司 | 光泽度计_测量显微镜_苏州压力仪_苏州扭力板手维修-苏州日升精密仪器有限公司 |