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

<tfoot id='CPffL'></tfoot>
  • <small id='CPffL'></small><noframes id='CPffL'>

      1. <i id='CPffL'><tr id='CPffL'><dt id='CPffL'><q id='CPffL'><span id='CPffL'><b id='CPffL'><form id='CPffL'><ins id='CPffL'></ins><ul id='CPffL'></ul><sub id='CPffL'></sub></form><legend id='CPffL'></legend><bdo id='CPffL'><pre id='CPffL'><center id='CPffL'></center></pre></bdo></b><th id='CPffL'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='CPffL'><tfoot id='CPffL'></tfoot><dl id='CPffL'><fieldset id='CPffL'></fieldset></dl></div>
        <legend id='CPffL'><style id='CPffL'><dir id='CPffL'><q id='CPffL'></q></dir></style></legend>

          <bdo id='CPffL'></bdo><ul id='CPffL'></ul>

        getSource() 和 getActionCommand()

        the getSource() and getActionCommand()(getSource() 和 getActionCommand())
          <bdo id='froJm'></bdo><ul id='froJm'></ul>
          <i id='froJm'><tr id='froJm'><dt id='froJm'><q id='froJm'><span id='froJm'><b id='froJm'><form id='froJm'><ins id='froJm'></ins><ul id='froJm'></ul><sub id='froJm'></sub></form><legend id='froJm'></legend><bdo id='froJm'><pre id='froJm'><center id='froJm'></center></pre></bdo></b><th id='froJm'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='froJm'><tfoot id='froJm'></tfoot><dl id='froJm'><fieldset id='froJm'></fieldset></dl></div>
        • <small id='froJm'></small><noframes id='froJm'>

              <tbody id='froJm'></tbody>

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

            • <tfoot id='froJm'></tfoot>
                  本文介紹了getSource() 和 getActionCommand()的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  什么是getSource?它返回什么?

                  What is getSource? and what does it return?

                  什么是getActionCommand(),它返回什么??

                  and what is getActionCommand() and what does it return??

                  我對這兩者感到困惑,任何人都可以給我或區分它們嗎?UI 中的 getSource 和 getActionCommand() 有什么用?具體是 TextField 還是 JTextField?

                  I am getting confused between these two can anyone give or differentiate them to me? what's the use of getSource and getActionCommand() in UI's? specifically TextField or JTextField?

                  推薦答案

                  假設你說的是 ActionEvent 類,那么這兩種方法有很大區別.

                  Assuming you are talking about the ActionEvent class, then there is a big difference between the two methods.

                  getActionCommand() 給你一個代表動作命令的字符串.該值是特定于組件的;對于 JButton 您可以選擇使用 setActionCommand(String command) 設置值,但對于 JTextField 如果您不設置此值,它會自動為您提供文本字段的值.根據 javadoc,這是為了與 java.awt.TextField 兼容.

                  getActionCommand() gives you a String representing the action command. The value is component specific; for a JButton you have the option to set the value with setActionCommand(String command) but for a JTextField if you don't set this, it will automatically give you the value of the text field. According to the javadoc this is for compatability with java.awt.TextField.

                  getSource()ActionEvent 是子級的 EventObject 類指定(通過 java.awt.AWTEvent).這為您提供了對事件來自的對象的引用.

                  getSource() is specified by the EventObject class that ActionEvent is a child of (via java.awt.AWTEvent). This gives you a reference to the object that the event came from.

                  這是一個例子.有兩個字段,一個具有明確設置的操作命令,另一個沒有.在每個中輸入一些文本,然后按 Enter.

                  Here is a example. There are two fields, one has an action command explicitly set, the other doesn't. Type some text into each then press enter.

                  public class Events implements ActionListener {
                  
                    private static JFrame frame; 
                  
                    public static void main(String[] args) {
                  
                      frame = new JFrame("JTextField events");
                      frame.getContentPane().setLayout(new FlowLayout());
                  
                      JTextField field1 = new JTextField(10);
                      field1.addActionListener(new Events());
                      frame.getContentPane().add(new JLabel("Field with no action command set"));
                      frame.getContentPane().add(field1);
                  
                      JTextField field2 = new JTextField(10);
                      field2.addActionListener(new Events());
                      field2.setActionCommand("my action command");
                      frame.getContentPane().add(new JLabel("Field with an action command set"));
                      frame.getContentPane().add(field2);
                  
                  
                      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                      frame.setSize(220, 150);
                      frame.setResizable(false);
                      frame.setVisible(true);
                    }
                  
                    @Override
                    public void actionPerformed(ActionEvent evt) {
                      String cmd = evt.getActionCommand();
                      JOptionPane.showMessageDialog(frame, "Command: " + cmd);
                    }
                  
                  }
                  

                  這篇關于getSource() 和 getActionCommand()的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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='Otf9v'></small><noframes id='Otf9v'>

                  <legend id='Otf9v'><style id='Otf9v'><dir id='Otf9v'><q id='Otf9v'></q></dir></style></legend>
                  <tfoot id='Otf9v'></tfoot>
                    <tbody id='Otf9v'></tbody>
                  • <bdo id='Otf9v'></bdo><ul id='Otf9v'></ul>

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

                          • 主站蜘蛛池模板: 91香蕉 | 在线观看中文视频 | 欧美性生活一区二区三区 | 风间由美一区二区三区在线观看 | 在线看片国产 | 91高清在线观看 | 国产一区二区三区四区五区3d | 夜夜爆操 | 国产精品国产三级国产aⅴ原创 | 天天干.com| 国产一级电影在线 | 特a毛片| 亚洲精品第一 | 日韩一区二区三区在线视频 | 欧美黄色网 | 91久久综合 | 成人免费在线播放 | 国产最新视频在线 | 免费看a| 无码一区二区三区视频 | 久久久久久久综合色一本 | 一级大黄色片 | 国产黄色大片在线免费观看 | 日韩二区 | 一区二区三区亚洲 | 欧美成人h版在线观看 | 亚洲巨乳自拍在线视频 | 欧美精品网站 | 在线a视频网站 | 欧美在线a | 国产亚洲精品精品国产亚洲综合 | 亚洲在线免费 | 久久精品欧美一区二区三区不卡 | 欧美一区二区三区视频 | 天天操夜夜操 | 欧美久操网 | 中文字幕在线观看一区 | 免费的网站www | 久久精品亚洲国产奇米99 | 欧美精品久久久 | 亭亭五月激情 |