[問題] 用JFrame把多個input轉成output
我用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
10/08 21:55, 1F
推
10/09 15:20, , 2F
10/09 15:20, 2F