Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jButton Does not do all tasks

 
peter m hayward
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I have a jButton that when the action perform runs it only does part of the tasks some of the code doe not appear to run and i just can not figure out why i have tried wrapping parts of it in an if statement and it still do not run so here is the code behind the button hope some can help

in the code the parts that do not run are jTextField10.setText("Working Please Wait");
and jButton15.setVisible(false);

what i am expecting to happen is the text field has the words Working Please Wait placed in it , this does not happen

and the button should be hidden to prevent it being clicked a second time again this does not happen

the rest of the code works as expected

 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this does not happen

Have you ascertained that the code is executed at all? Like printing out something from within the button handler?

Not sure if it's related to the problem, but an empty I/O catch block is a bad idea:

} catch (IOException e) {
}

You need to handle exceptions properly, or at least print output so that you will see if something goes wrong.
 
peter m hayward
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi take you point, please note i had other code but stripped it out bit by bit to try and find out what was happening i have rearrange this every way i can think of over two days and it still not working and i just can see why

when the process competes it print all done number of files processed in the same text box so that add another twist to the tail

regards pete
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I can't tell from your post whether you have or have not ascertained that the action listener is being executed at all. Obviously, if you have not, then now would be the time to do that.
 
peter m hayward
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I assume the action listener is run because the other events take place once i click the button , or maybe i have a miss understanding can you therefore please tell me how to check this
regards pete
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just add this as a first statement inside your actionPerformed
 
peter m hayward
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that prints out fine i should have said i original had a print statement there and it printed out the message it seems the call readIN(); is some how overiding everything even though it at the bottom of the list ?
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK. The entire "try" block probably runs, but there might be an exception early on; be sure to print out the stack trace of any exception to the catch handler, like I suggested.

Line 19 and 20 should be run, obviously, but it's hard to say why their effect is not noticeable without seeing the context in which they operate.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic