看板 java 關於我們 聯絡資訊
我用JFrame先設計出了一個視窗 然後用JTextField 規劃出了 4個inputField 4個outField 2個JButton 一個是執行 一個是清除 我的格式大概都寫好了 但是我發現我卡住了 因為我的event.getSource()是選擇 執行 或者 清除 請問我要怎樣 可以讀取input 然後全部輸出到output裡面 input code label = new JLabel( "Name " ); add( label ); // add label to JFrame // construct textfield with 15 columns textField_Name = new JTextField( 15 ); add( textField_Name ); // add textField1 to JFrame output code // Create Label "Gross Pay" label = new JLabel( "Gross Pay " ); add( label ); // add label to JFrame // construct textfield with default text and 15 columns textField_GrossPay = new JTextField( 15 ); textField_GrossPay.setEditable( false ); // disable editing add( textField_GrossPay ); // add textField3 to JFrame 後面的getSource() code public void actionPerformed( ActionEvent event ) { if ( event.getSource() == leftButton ) { ooxxooxxoxxoxoxoxo; } 請諸君題點一下方向 多謝:) -- "Ask not what your country can do for you; ask what you can do for your country." By John F.Kennedy -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 71.105.240.111
stukk:你是希望input fields的內容在按過button後,顯示在output? 10/08 21:55
linsung:4個 textField 都 getText() 就不就取出資料了?? 10/09 15:20