久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<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="qwawimqqmiuu" 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:檢測單元格數據變化

        JTable: Detect cell data change(JTable:檢測單元格數據變化)
        <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="qwawimqqmiuu" 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:檢測單元格數據變化的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  在 Netbeans 中,我使用 GUI Builder 將 JTable 插入到我的應用程序中.

                  到目前為止,我只有一個類 (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
                  
                  }
                  

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

                  為了獲取這些數據,我嘗試實現一個事件監聽器:

                  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 來監聽變化更容易,但它仍然存在無法訪問舊值的問題.

                  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".

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

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

                  相關文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測 32 位 int 上的整數溢出?)
                  Local variables before return statements, does it matter?(return 語句之前的局部變量,這有關系嗎?)
                  How to convert Integer to int?(如何將整數轉換為整數?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內創建一個隨機打亂數字的 int 數組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠將 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="qwawimqqmiuu" 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>
                          • 主站蜘蛛池模板: 国产一区二区三区在线 | 亚洲精品综合 | 精品一二区 | 欧美精品久久久久 | 日韩欧美大片在线观看 | 亚洲顶级毛片 | 三级特黄特色视频 | 久久久久久久av麻豆果冻 | 日本在线免费 | 久久中文高清 | 久草资源网站 | 欧美成人一级 | 特级毛片 | 亚洲精品在线视频 | 国产成人精品久久二区二区 | 久久久男人的天堂 | 一区二区免费在线视频 | 日本不卡一区二区三区 | 五月激情综合 | 欧美午夜精品久久久久久浪潮 | 日韩精品在线一区 | 欧美日韩在线一区二区三区 | 看av网 | 91免费版在线 | 久久国产精品精品国产色婷婷 | 日本不卡一区 | 精品久久99| 一区二区三区在线观看视频 | av中文在线观看 | 亚洲精品视频导航 | 国产精品久久影院 | 欧美一区二区三区在线观看 | 韩日av在线 | 不卡的av在线 | 高清av电影| 亚洲国产精品网站 | 久久久成人网 | 水蜜桃久久夜色精品一区 | 久久精品日产第一区二区三区 | 不卡av电影在线播放 | 一区二区三区视频在线观看 |