We help IT Professionals succeed at work.
Get Started

Java thread

kimos123 asked
Last Modified: 2010-03-31

I want to add a threat to my program but i dont know how to do it:

i have time string in my program and i want the threat to start from 0, and everytime it increase by 1 and look if there is something with the time 1 and it have to do something, and then it goes to 2 and look again and so on...

the problem is that i am parsing/binding my time string from a xml file as follow:

  if(e.getSource() == menuItem1){
            int returnVal = fc2.showOpenDialog(GUI.this);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                try {
                    File file2 = fc2.getSelectedFile();
                    binder.xml.Annotations annotation = binder.xml.AnnotationsUnmarshaller.unmarshal(file2, false);
                    List annotationlist = annotation.getAnnotationList();
                    for (Iterator i = annotationlist.iterator(); i.hasNext(); ) {
                        binder.xml.Annotation annotation2 = (binder.xml.Annotation)i.next();
                            h_id = annotation2.getId();
                            h_starttime = annotation2.getStarttime();
                            h_endtime = annotation2.getEndtime();
                            List video = annotation2.getVideo_propertiesList();
                            for (Iterator j = video.iterator(); j.hasNext(); ) {
                                binder.xml.Video_properties video2 = (binder.xml.Video_properties)j.next();
                                h_is_visible = video2.getIs_visible();
                            List audio = annotation2.getAudio_propertiesList();
                            for (Iterator j = audio.iterator(); j.hasNext(); ) {
                                binder.xml.Audio_properties audio2 = (binder.xml.Audio_properties)j.next();
                                h_makes_sound = audio2.getMakes_sound();
                                h_sound_volume = audio2.getSound_volume();

so if h_starttime = 0 it will contrinue if not it goes to 1  and look for starttime 1 and so on..

Watch Question
This problem has been solved!
Unlock 2 Answers and 11 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE