[問題] 用JFrame把多個input轉成output

看板java作者 (ArkLiu)時間17年前 (2008/10/08 16:07), 編輯推噓2(200)
留言2則, 2人參與, 最新討論串1/1
我用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

10/08 21:55, , 1F
你是希望input fields的內容在按過button後,顯示在output?
10/08 21:55, 1F

10/09 15:20, , 2F
4個 textField 都 getText() 就不就取出資料了??
10/09 15:20, 2F
文章代碼(AID): #18x6esY0 (java)