I am very inexperienced with java and therefore not very good at it. I am attemp
ID: 670271 • Letter: I
Question
I am very inexperienced with java and therefore not very good at it. I am attempting to write the code based on the following source code and I am struggling a great deal. Please help me.
/**
* clear()
*
* Called when the Clear button is clicked. Clears all of the text fields by setting the contents to the empty string.
* After clear() returns, no student information is being edited or displayed.
*
* PSEUDOCODE:
* Set the mSearchText text field to ""
* Set each of the homework text fields to ""
* Set each of the exam text fields to ""
* Set the mStudent reference to null
*/
??????
Explanation / Answer
We have to write click event for clear button..where inside that event method , we have to made explicityly text fields empty..and whatever you need. Here is the code
ClearButton.addSelectionListener(new SelectionAdapter() /*Clear button click event*/
{
@Override
public void widgetSelected(SelectionEvent e)
{
/*here we can make fields empty */
mSearchText.setText("");
homework.setText("");
exam.setText("");
this.mStudent = null; /*making reference null */
}
});
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.