This week's book giveaway is in the Testing forum.
We're giving away four copies of Data Structures the Fun Way: An Amusing Adventure with Coffee-Filled Examples and have Jeremy Kubica on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Timer not working correctly

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I cant find the issue why it's not counting up, but showing some random numbers.

 
Marshal
Posts: 8514
610
Mac OS X VI Editor BSD Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 732
10
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 76834
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 732
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oops - copied the wrong line. I meant line 161 which sets "jButton2" as the text for jButton3.
 
See where your hand is? Not there. It's next to this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic