• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exiting java processes

 
Olivier López
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i made a java program with a java form (gui), but theres a process that never ends...(is the way i want to execute, theres nothing bad with the code)

So the question is: Is there a way to terminate the execution of the program, like a kind of System.exit, buy without exiting the java form gui?
just end the process but continue showing the gui?


Another question...
In my program, i have a lot of jlabels, and each time a process executes, a image is displayed in a jlabel, then in another jlabel, then the next and all the way to complete all the jlabels.... but the images of all the jlabels appears just when all the processes are completed, and i want the the images to appears in order...

Making tests... i used a JOptionPane.showMessageDialog after each jLabel.seticon, and when i run the program, the message of the JOptionPane apears, and after it, the image of the jLabel appears too... but... i dont want to stay clicking the JOption messages just to watch each image of the jLabels in order....

Someone knows why this happens?
Can i replace the JOptionPanes 4 something else that the user cant see? i tried System.out.print instead of the OptionPanes, but is like the beginning... the jLabels shows the images just at the end of all the processes...


Thanks in advance
All your help will be usefull
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> but theres a process that never ends...

setDefaultCloseOperation(...);


> Another question...
> ...
> Someone knows why this happens?

possibly you're blocking Swing's thread (EDT), but it's only guesswork
until you post the code so we can see what you're doing
 
Rob Spoor
Sheriff
Pie
Posts: 20750
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:> Another question...
> ...
> Someone knows why this happens?

possibly you're blocking Swing's thread (EDT), but it's only guesswork
until you post the code so we can see what you're doing

I think you're right. Olivier, please read concurrency in Swing.
 
Olivier López
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:
Michael Dunn wrote:> Another question...
> ...
> Someone knows why this happens?

possibly you're blocking Swing's thread (EDT), but it's only guesswork
until you post the code so we can see what you're doing

I think you're right. Olivier, please read concurrency in Swing.


Yea... both of you are right...

The problem is that the i have all the code inside the same class... the process is interfering with the draw in the gui, so when all the process stops, the gui can draw the images in the jLabels... the solution was to copy all the code to a thread class, and leave the gui without weird code :D
Thanks :thumbup:

Problem Solved :jumpingjoy:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic