hi
i have a client server program.. i am sending data variable 'msgFromClient' through PrintWriter object as follwoing
pwOut.println(msgFromClient);
in the program.. i am reading 'msgFromClient' from the following two functions. Now i want to trigger the above statement only when user has given his input through one of the following fucntions. i can trigger directly by keeping the statement in both the function. but my statement is outside the both functions and now i want to trigger the statment only when input is given by user ( ie. when user clicks one of the 2 buttons)
Please help me out to solve this situation

private payoff_oneActionPerformed(ActionEvent ae) {
msgFromClient = payoff_one.getText();
payoff_one.setEnabled(false);
payoff_two.setEnabled(false);
game_status.setText("Please wait for your Opponent to Choose");
}
private payoff_twoActionPerformed(ActionEvent ae) {
msgFromClient = payoff_two.getText();
payoff_one.setEnabled(false);
payoff_two.setEnabled(false);
game_status.setText("Please wait for your Opponent to Choose");
}