久久久久久久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>

                          • 主站蜘蛛池模板: 亚洲不卡在线观看 | 亚洲在线观看视频 | 欧美不卡网站 | 久在线 | 国产精品成人一区二区 | 日本免费一区二区三区 | 国产欧美日韩一区二区三区在线观看 | 日韩精品在线观看免费 | 午夜影院操| 日本网站免费在线观看 | 久久久久成人精品免费播放动漫 | 国产精品久久久久久一区二区三区 | 日韩精品在线播放 | 欧美国产日韩一区二区三区 | 久久久久久久久久久久久9999 | 国产传媒毛片精品视频第一次 | 国产一区中文字幕 | 久草网站 | 蜜桃综合在线 | 亚洲精品福利视频 | 国产成在线观看免费视频 | 国产激情偷乱视频一区二区三区 | 天天天天操 | av在线一区二区三区 | 国产精品久久av | 免费性视频 | 国产精品一区在线观看 | 99re视频在线| 国产四区 | 久久久久国产一区二区三区 | 成人福利电影 | 日韩国产欧美一区 | 日韩 国产 在线 | 国产精品久久久久久婷婷天堂 | 久久精品国产一区二区电影 | 成人在线免费视频 | 欧洲一级毛片 | 欧美福利在线 | 亚洲一区二区三区视频 | 亚洲精品久久久久久一区二区 | 亚洲精品久久久蜜桃网站 |