counter is not shown in JTextField
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
-
1 -
-
Number of slices to send:Optional 'thank-you' note:
-
-
But let's suppose that such a MouseListener actually does what you think it will do. Your implementation of MouseListener doesn't do anything but set a boolean variable, as far as I can see. It doesn't increment anything, nor does it reset anything, nor does it change the value of any text fields.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Paul Clapham wrote:Why on earth are you using a MouseListener to cause an action to happen when a JButton is clicked? The standard way to do that is to add an ActionListener to the JButton; using a mouse listener is just confusing.
But let's suppose that such a MouseListener actually does what you think it will do. Your implementation of MouseListener doesn't do anything but set a boolean variable, as far as I can see. It doesn't increment anything, nor does it reset anything, nor does it change the value of any text fields.
Thanks I have changed it 100 times and have not noticed that I deleted that line but still it does not even show " It is " which is in while(true) loop=(
-
1 -
-
Number of slices to send:Optional 'thank-you' note:
-
-
What I've just tried to help you out that -- how your Q1 would get access to the TextField item --so that the increment can be displayed. Notice that the MyFrame object is passed to the IncrementResetListener() method.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
-
1 -
-
Number of slices to send:Optional 'thank-you' note:
-
-
Replace the mouseClicked() method, which is in the previous posting with the one given below.
The "increment", and the "reset" is handled in the mouseClicked() method. As per the code-- from my previous posting-- this event handler method is attached with both the buttons.
That being stated, when the button labeled as "increment" is clicked-- the count is creased by 1, and the text field is set with the new value of the count. On the other hand, when the button labeled as "reset" is clicked--the count is reset to 1, and the text field is reset to zero length string--a blank.
I hope you understood it.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Rod Singh wrote:
Replace the mouseClicked() method, which is in the previous posting with the one given below.
The "increment", and the "reset" is handled in the mouseClicked() method. As per the code-- from my previous posting-- this event handler method is attached with both the buttons.
That being stated, when the button labeled as "increment" is clicked-- the count is creased by 1, and the text field is set with the new value of the count. On the other hand, when the button labeled as "reset" is clicked--the count is reset to 1, and the text field is reset to zero length string--a blank.
I hope you understood it.
yeah, fair enough=) Thank you by the way!=)
| Why is the word "abbreviation" so long? And this ad is so short? The new gardening playing cards kickstarter is now live! https://www.kickstarter.com/projects/paulwheaton/garden-cards |








