import java.awt.*; import java.util.*; import java.applet.*; // // 'Canvas' to draw everything on (Applet) // public class begin extends Applet implements Runnable{ Image buffer; Show st; int runningspeed=0; int drawtime=0; // miliseconds need to draw a full screen image int framecounter=0; int oldframecounter=0; long frametime=0; int storedcounter=0; Graphics canvas; int MAXHEIGHT=(int)(Toolkit.getDefaultToolkit().getScreenSize().height); int MAXWIDTH=(int)(Toolkit.getDefaultToolkit().getScreenSize().width); ProgressionBar thread; boolean loaded=false; boolean showprogress=true; int slider=0; public void init(){ setLayout(null); setBackground(new Color(0,60,0)); buffer=createImage(MAXWIDTH, MAXHEIGHT); canvas=buffer.getGraphics(); } public void start(){ // Progressionbar thread > writes to the applet paintcanvas // While load of rest of classes! try{ thread=new ProgressionBar(this); thread.setPriority(Thread.MIN_PRIORITY); thread.start(); }catch(Exception exception){ System.out.println("(begin-start-ProgressionBar): "+exception.toString()); } // seperate thread to start loadpanel try{ Thread thr=new Thread(this); thr.start(); }catch(Exception exception){ System.out.println("(begin-start-thr): "+exception.toString()); } } public void stop(){ if(thread!=null) thread.stop(); if(st.global!=null){ String result=st.global.execute("disconnect.php?usernr="+st.global.usernr+"&time=asdf2332"); } } public void trun(){ // Start the loader (panel that loads main panel!) st=new Show(this); st.setVisible(false); add(st); st.setBounds(0,0,MAXWIDTH,MAXHEIGHT); validate(); } public void run(){ int ij=0; while(!loaded){ // progression bar repaint(); if(ij++==2){ trun(); } try{ Thread.sleep(10); }catch(Exception e){ } } validate(); } public void paint(Graphics g){ update(g); } public void update(Graphics g){ // Progressionbar thread is going to paint on this //System.out.println("update in begin"); g.drawImage(buffer, 0, 0, this); } }