Issue
label = price * qty
I want to display price and qty multiplication in label automatically without any button click.
After enter price value and qty value to textboxes
I use netbeans and java langauge only. how to do it?
Solution
If you're using netbeanse IDE which provides user interface for using java Frames. You can easily right click on the second textfield go to the events and add a keyreleased event listerner. This will automatically direct your towards the generated method where you can write something like this
int value = Integer.parseInt(Textfield1.gettext())*Integer.parseInt(Textfield2.gettext());
Label.settext(String.valueof(value));
What it will do that if both text fields are non empty then it will set the result on the lable after releasing the key on textfield2, else it'll throw an exception.
Answered By - Asad Jivani
Answer Checked By - Marilyn (JavaFixing Volunteer)