import java.util.Calendar; import java.util.TimeZone; import javax.swing.JLabel; public class runningTime { private int i=0; JLabel l1 = new JLabel(); public void setI(int s){ i = s; } public void getS(){ Thread tr = new Thread(){ public void run(){ try{ for(;;){ TimeZone tz = Calendar.getInstance().getTimeZone(); Calendar c = Calendar.getInstance(tz); if(i==1){ c.setTimeZone(TimeZone.getTimeZone("America/Los_Angeles")); }else if(i==2){ c.setTimeZone(TimeZone.getTimeZone("America/New_York")); }else if(i==3){ c.setTimeZone(TimeZone.getTimeZone("Europe/Moscow")); }else if(i==4){ c.setTimeZone(TimeZone.getTimeZone("Europe/London")); }else if(i==5){ c.setTimeZone(TimeZone.getTimeZone("Europe/Paris")); }else if(i==6){ c.setTimeZone(TimeZone.getTimeZone("Australia/Sydney")); }else if(i==7){ c.setTimeZone(TimeZone.getTimeZone("Asia/Tokyo")); }else if(i==8){ c.setTimeZone(TimeZone.getTimeZone("America/Santiago")); }else if(i==9){ c.setTimeZone(TimeZone.getTimeZone("Egypt")); } String hour = String.format("%02d",c.get(Calendar.HOUR_OF_DAY) ); String min = String.format("%02d", c.get(Calendar.MINUTE)); String sec = String.format("%02d", c.get(Calendar.SECOND)); String s1 = hour +":"+min+":"+sec; l1.setText(s1); sleep(1000); } }catch(Exception e){ //нуб не знает исключений, простите } } }; tr.start(); } }