• Post Reply Bookmark Topic Watch Topic
  • New Topic

Timer not working correctly

 
Kristers Drozds
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I cant find the issue why it's not counting up, but showing some random numbers.

 
Liutauras Vilda
Marshal
Posts: 3201
127
BSD
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please provide relevant part of code which is responsible for particular task you're failing to accomplish.
You should not be expecting: that someone will go and read more than 500 lines of code; will try to understand what this code is doing in general; will copy this code to their own IDE's and will try to debug.

Please provide more details
1. Given inputs if there were some;
2. Expected outputs;
3. Actual outputs;
4. Error messages (copied and pasted exactly as they appear) in case those appear on particular inputs;
5. Other important details which could help someone to give you an insight on what could be wrong;

And let's hope someone will be able to help.

I shall copy this topic to our other relevant forum, so the probability to get an accurate answer would get increased
 
Fred Kleinschmidt
Bartender
Posts: 459
3
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jButton2.setText("jButton2");

Why jButton2 as the text?

In your constructor you have this (indentation fixed):


But you haven't set jButton3 to be selected, so the timer is never started.
 
Campbell Ritchie
Marshal
Posts: 52581
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another thing: line 440. Why are you setting those fields visible or invisible? That does not look right. There are ways to make components come to the top; this tutorial suggests one solution.
There is also something wrong with the multiple ifs; there must be an elegant way to express what you want. Maybe a List or an array?
 
Dave Tolls
Ranch Hand
Posts: 2284
25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fred Kleinschmidt wrote:
jButton2.setText("jButton2");

Why jButton2 as the text?


That's the default value used in Netbeans GUI builder.
 
Fred Kleinschmidt
Bartender
Posts: 459
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops - copied the wrong line. I meant line 161 which sets "jButton2" as the text for jButton3.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!