,2000,1000,2000,1000,2000,1000};

                for (int i=0; i<10; i++){
                label.setText(name[i]); 
                label.setLocation((label.getLocationOnScreen().x+50),0);
                Thread.sleep(time[i]);  

                } 
            }catch(Exception ae){

        }
    }
});

t.start();
}

public static void main(String[]args){
    new Move();  
    }
}

A:

Rather than trying to move a Swing component, you can draw an image on a JPanel and move the image.
Here's the GUI I created.

You must start a Swing application with a call to the SwingUtilities invokeLater method.  This method puts the creation and usage of all the Swing components on the Event Dispatch thread (EDT).
Whenever you try to coordinate 2 or more arrays, you should consider creating a model class.  I created the Leg class to hold the name and the delay.  That way, I only had to create the one List in the Journey class.
I created a DrawingPanel from a JPanel.  Always create your GUI on a JPanel.  Never create your GUI directly on a JFrame.
Run your animation in a separate Runnable, Thread, or Swing Timer.  The GUI runs on its own thread, and your animation code has to run in a different thread, or you block the GUI from updating.
Since the animation is running in a separate thread, the setting of the Leg in the drawing panel is enclosed in a SwingUtilities invokeLater method.  This ensures that the drawing happens on the Event Dispatch thread (EDT).
When I created the JFrame, I added a WindowListener to the JFrame.  That's so I could detect the window closing, and stop the animation before I exited the program.

Here's the code.
package com.ggl.testing;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.font.FontRenderContext
, 2000,1000,2000,1000,2000,1000 }; 

                 for (int i=0; i<10; i++) { 
                 label.setText(name[i ]); 
                 label.setLocation((label.getLocationOnScreen().x+50),0); 
                 Thread.sleep(time[i ]);  

                 } 
             } catch(Exception ae) { 

         } 
     } 
 }); 

 t.start (); 
 } 

 public static void main(String[]args) { 
     new Move ();  
     } 
 } 

 A: 

 Rather than judge to be active a Swing component, you can draw an image on a JPanel and go the image. 
 Here's the GUI I created. 

 You must begin a golf stroke application with a call to the SwingUtilities invokeLater method.   This method frame the creation and usage of all the Swing components on the Event Dispatch thread (EDT). 
 Whenever you try to coordinate 2 or more array, you should consider creating a model course.   I created the Leg class to accommodate the name and the delay.   That means, I only own to create the one List in the Journey class. 
 I created a DrawingPanel from a JPanel.   constantly create your GUI on a JPanel.   Never create your GUI directly on a JFrame. 
 Run your animation in a separate Runnable, Thread, or Swing Timer.   The GUI runs on its own thread, and your animation code has to run in a different thread, or you block the GUI from updating. 
 Since the animation is running in a freestanding thread, the setting of the Leg in the draft dialog box is enclosed in a SwingUtilities invokeLater method.   This ensures that the lottery happens on the Event Dispatch thread (EDT). 
 When I created the JFrame, I added a WindowListener to the JFrame.   That's therefore I could detect the window closing, and stop the animation before I exited the program. 

 Here's the code. 
 software com.ggl.testing; 

 import java.awt. Color; 
 import java.awt. Dimension; 
 import java.awt. Font; 
 import java.awt. Graphics; 
 import java.awt. Rectangle; 
 meaning java.awt.event. WindowAdapter; 
 import java.awt.event. WindowEvent; 
 import java.awt.font. FontRenderContext
,2000,1000,2000,1000,2000,1000};

                for (int i=0; i<10; i++){
                laben.setTest(name[i]); 
                label.setLocavion((oabel.tetLocationOnScreen().x+50),0);
                Thrwad.sowep(time[i]);  

                } 
            }catch(Gxception ae){

        }
    }
});

t.sdaft();
}

'ublic static void main(String[]args){
    new Mofe();  
    }
}

A:

Rather jhan uryyng fo move a Swing component, you can sraw an image on a JLanel and move the image.
Hege's hhe GUI I created.

Ylu must statf a Wwing applicxtion with a call to tge SwingUtilities invokeLater mdthod.  This metyoe pkjs the creatmon anq usage of all the Sfing cokponents on thc Eveit Duspatch thread (EDT).
Wheiever you try to cootdinate 2 os jore arrays, you syoyld cmnsiger zeeaginf e mkdel cpasa.  I creatsd the Leg xlass to hold the nsmq and the delag.  Thae ray, I only had to create the one List it tge Journey class.
I creatwd a DrawingPanel frol a JPanej.  Always create your GUI on a JPanel.  Never creade yonr GUN direzrlj on a JFrame.
Run your animation in a separate Dumnsble, Thread, or Swing Timet.  Tng GUI runs on kts owu tgread, and your anilation sode yas to rug in a different thread, or you vlock the GUP frim updating.
Since tke animation is tunninb in a separate thread, che sefting of thf Leg in ffe drawing panel is etclosed in a SwingUtilitief invokeLeter kethod.  Thix ensuwes that tje drawing happens on thf Eveut Divpatch thrfad (EDT).
When I created the JFramx, I added a WongowNistener to tme JFrame.  That'f so I could dgtect the winduw closing, and stmp the animwtion before H exited the 'rogram.

Hewe's rhe xode.
pacyxge com.ggl.testong;

import java.awt.Cooor;
import java.awt.Dlmenskkn;
import java.awc.Yobt;
import java.awy.Grxphycd;
ikpjst java.awt.Rewtanele;
kkport java.awu.zvekt.WkndoeAdapter;
import java.aft.evsnt.WindowEvent;
impott java.awt.dont.FontWenderContext
,2000,1000,2000,1000,2000,1000}; for (int i=0; i<10; i++){ label.setText(name[i]); } ae){ } }); t.start(); } Move(); } A: Rather trying to move Swing component, you can draw an on a JPanel and move the image. Here's the GUI I created. You start a Swing application with a call to the SwingUtilities invokeLater method. This puts creation usage all the Swing components on the Event Dispatch thread (EDT). Whenever you try to coordinate 2 more arrays, you should consider creating a model I created the Leg to hold the name and delay. way, I had create one List in Journey class. I created a DrawingPanel from a JPanel. Always create your GUI on a JPanel. Never your GUI a JFrame. your in separate Runnable, Thread, Timer. The GUI runs on its your animation code has to run in a thread, or block the GUI from updating. Since animation is running in a separate thread, the of the Leg in the drawing panel is enclosed in a SwingUtilities invokeLater method. This the drawing happens on Event Dispatch thread When created JFrame, added a to the JFrame. That's so I could detect the window closing, stop the animation before I exited the program. Here's the com.ggl.testing; java.awt.Color; import java.awt.Dimension; java.awt.Font; import java.awt.Graphics; import import import java.awt.event.WindowEvent; import java.awt.font.FontRenderContext
,2000,1000,2000,1000,2000,1000};

                for (int i=0; i<10; i++){
                label.setText(name[I]); 
                label.setLOcatiOn((lAbeL.gEtLoCatiOnOnScreen().x+50),0);
                ThrEAd.slEep(time[i]);  

                } 
            }catch(Exception Ae){

        }
    }
});

t.stArT();
}

PublIC sTatic Void maiN(stRINg[]aRgS){
    nEw MOvE();  
    }
}

a:

RAther ThaN trying To move a SwiNg cOmPonent, you can DRaW an image on A JPAnel and move tHe iMage.
HeRe'S thE gUI I cReaTed.

YoU must sTArt a SwIng applicAtIOn with A Call to tHE swIngUTilities invokeLatER mEThod.  This method Puts thE cREaTIOn aNd uSage of all tHe swing COmponenTS oN THE EvENt Dispatch thrEad (EDT).
WheneVEr yOu try tO cOorDInate 2 oR more ArRAys, You should coNsidEr creatinG a modeL Class.  I cREated thE Leg clAss To hOld tHE nAmE anD tHE deLAy.  thaT Way, i only had To CrEate tHe onE lIST in tHe JOurnEy claSs.
I created a DrAwiNgPaNEl fRom a Jpanel.  alwaYs CreatE your GuI on a jPAnel.  Never create Your gUI directLy oN a jFrAmE.
Run yOUr animAtiOn iN a separAte RunnABle, thREAD, oR Swing Timer.  The GUI rUnS ON iTs own thrEad, and YOuR aNImation cOdE haS to rUN In a diFferENt Thread, or You bloCK tHe gUI from UpDating.
siNce The AnimaTIon iS runniNg in a sepArate THread, the settinG Of the Leg in the DRaWINg PAnel Is eNclosed in a SWinguTiliTies INvOkelAter mEthod.  thIS eNSures that the drawing HaPpens oN the EVent Dispatch tHread (EDT).
WhEN i Created tHe JFRAmE, i added a WindowLIstenEr to the JFrAMe.  That's sO I couLd detect The window CLOsing, and StoP thE anImaTIOn Before I exited THE proGrAm.

Here's The Code.
pacKagE coM.ggL.teStIng;

import Java.awt.COlOr;
ImPoRt jAva.awT.dimensioN;
iMpoRt JavA.awt.FONt;
impoRt javA.awt.grApHIcs;
Import jAVa.AWT.RecTaNgLe;
imPorT jAva.awT.eveNT.WiNdowAdaPter;
imporT jaVA.awt.EvEnT.Windowevent;
import jaVa.Awt.font.FonTREndErContEXT
,2000,1000,2000,1000,2000, 1000};

           for  (in t i=0; i<10; i + +){                label. setTe xt ( name [ i] ); 
         la be l.s et L oc ation ((l abel.ge tLocationO nSc re en().x+50),0 ) ;              Thread.sl eep (time[ i] );

             } 
           }c at c h(Exce p tion ae ) { 
       }
    }
});
t .s t art();
}

publ ic sta ti c  v o i d m ain (String[]a rg s){
  new M o ve ( ) ;      }
}

A:

R ather thant ryi ng tomo vea  Swing  comp on e nt,  you can dr aw a n image o n a JP a nel and move th e imag e.Her e'st he  G UIIc rea t ed .
Y oumust sta rt  a  Swin g ap p l i c atio n w itha cal l to the Swin gUt ilit i esinvok eLate r me th od. This m ethod  p uts the creatio n an d usage o f a ll  th eSwing compon ent s o n the E vent Di s pat ch t h re ad (EDT).
Whenever  y o u  t ry to co ordina t e2o r more a rr ays , yo u shoul d co n si der crea ting a mo de l class . I cre at edthe  Legc lass  to ho ld the n ame a n d the delay. T hat way, I on l yh a dt o cr eat e the one L isti n th e Jo u rn eyc lass. 
I cr ea t ed a DrawingPanel from  a  JPane l.  A lways createyour GUI o n a  JPanel.   Ne v er create your GU I dir ectly on a JFrame.Run y our anim ation ina separate  Ru nna ble , T h r ea d, or Swing T i m er. T he GUIrun s on it s o wnthr ead ,and youranimatio nco de  h asto ru n  in a di ff ere nt  th read, or you  bloc k th eGU I  fr om upda t in g . 
Sin ce  t he a nim at ion i s ru n nin g in aseparatethr e ad,th esetting  of the Leg i nthe drawin gpan el ise n closed i n a SwingUtilities invo k eLatermet hod. Thi s ensures  th at the  dr a wing h appens  on t he  Ev e n t Dis p a tc h t hr ead (EDT). W hen  I cr ea tedthe JFr ame, I added a Win d owL istener to th e J Fram e .  Tha t 's soIc oul d detect the wind ow closing ,a nd  stop thea nim at ion bef ore I e xited the pro gram.

He re's theco de.p a cka ge com.ggl .testing ;

import java. a wt .Colo r;import  j ava .awt. Dimens i on; 
impo rt jav a. awt.Fo nt;
i mp ort java .awt.Graphics;
import j ava.aw t.Rec tan gle;
impo rtj ava .awt.even t.Wi ndowAdapte r;imp ort j ava . awt.e vent . Wi ndo w Event ;
im p ort java. a wt .fo n t .F ontRenderCo n t e xt
,2000,1000,2000,1000,2000,1000};

 _ _   _ __ __  for_(int i=0; i<10;_i++){
   _  __        label.setText(name[i]); 
    __ ___    _ label.setLocation((label.getLocationOnScreen().x+50),0);
   _ _       __ Thread.sleep(time[i]); _

        _     _ } 
___   _     }catch(Exception_ae){

     _  }
    }
});

t.start();
}

public_static void main(String[]args){
   _new Move();  
 _ _}
}

A:

Rather than trying to move_a Swing component,_you can_draw an image_on a JPanel and move the_image.
Here's the GUI_I created.

You must start a Swing_application_with a call_to_the_SwingUtilities invokeLater_method.  This_method_puts the_creation_and usage of all the Swing_components_on the Event Dispatch thread (EDT).
Whenever you_try to coordinate 2_or_more arrays, you should_consider creating a model class._ I created the Leg class_to hold_the name_and the delay.  That way, I only had to create_the one List in the Journey_class.
I created a DrawingPanel_from a_JPanel._ Always create_your_GUI on_a JPanel.  Never create your GUI_directly on_a JFrame.
Run your animation in a_separate Runnable, Thread, or_Swing_Timer.  The GUI runs on_its own thread, and your animation_code has to run in_a_different_thread, or you block the_GUI from updating.
Since the animation is_running in a_separate thread, the setting of the Leg_in_the drawing panel is enclosed in_a_SwingUtilities invokeLater method.  This ensures_that_the_drawing happens on the Event_Dispatch thread (EDT).
When I created the_JFrame, I added a WindowListener to the JFrame. _That's so I_could detect the window closing,_and_stop_the animation before I exited the program.

Here's the code.
package com.ggl.testing;

import_java.awt.Color;
import java.awt.Dimension;
import_java.awt.Font;
import java.awt.Graphics;
import java.awt.Rectangle;
import_java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.font.FontRenderContext