import java.util.*; import java.net.*; import java.awt.event.*; import java.awt.*; // TEAMPLAY MENU // public class menu4 implements Menu , ActionListener{ public Image image; public Image menu4; private boolean visible=true; boolean allready=false; public Global global; public String arg1=new String(""); public String arg2=new String(""); public String method=new String(""); public String retval=new String(""); public String list[]=new String[1010]; // NOT OK Screen Label Selectlabel; Button Select; Button Abort; java.awt.List lijst; public boolean isVisible(){return visible;} Color backgroundcolor=new Color(0,60,0); Color menucolor=new Color(0,60,0); Color emailforeground=Color.black; Color passwordforeground=Color.black; Color selectlabelcolor=Color.white; Color chattextforegroundcolor=new Color(0,255,0); Color chattextbackgroundcolor=new Color(0,60,0); Color chatforegroundcolor=new Color(0,200,0); Color chatbackgroundcolor=new Color(0,60,0); Color infoforegroundcolor=new Color(0,200,0); Color infobackgroundcolor=new Color(0,0,0); Color fieldlistforegroundcolor=new Color(0,200,0); public void init(Global glbl){ global=glbl; menu4=global.loadImage(global.Server, "images/menu4"+global.Extention, global.show); makemenu4(); } public void show(Graphics g){ //g.drawString("Hoi", 100,100); if(visible){ if(menu4!=null){ global.show.graphics.fillRect(0,0,1024,768); global.show.graphics.drawImage(menu4,0,0, global.show); showmenu4(g); } } } public void makemenu4(){ try{ Selectlabel=new Label(""); Selectlabel.setForeground(selectlabelcolor); // Selectlabel.setBounds(300,240,200,20); global.show.add(Selectlabel); Select=new Button("Select"); Select.setBackground(Color.white); Select.addActionListener(this); Select.setBounds(300,300,200,32); Select.setName("Select"); global.show.add(Select); lijst=new java.awt.List(); lijst.addActionListener(this); lijst.setBounds(300,100,100,130); lijst.setName("lijst"); global.show.add(lijst); Abort=new Button("Abort"); Abort.setBackground(Color.white); Abort.addActionListener(this); Abort.setBounds(300,350,200,32); Abort.setName("Abort"); global.show.add(Abort); Select.requestFocus(); allready=false; StringTokenizer sn; String result=global.execute("getonline.php?usernr="+global.usernr+"&time="+global.show.date.getTime()); lijst.clear(); if(result.length() > 0){ try{ sn=new StringTokenizer(result, ""+(char)18); while(sn.hasMoreTokens()){ lijst.add("Team"+sn.nextToken()); } }catch(Exception egge){} } }catch(Exception ee){ System.out.println("Select menu2 error: "+ee.toString()); } } public void showmenu4(Graphics g){ if(allready)return; global.showprogressionbar=false; allready=true; setVisible(true); global.show.graphics.fillRect(0,0,1024,768); global.show.graphics.drawImage(menu4,0,0, global.show); if(global.show.menu[1]!=null) global.show.menu[1].setVisible(false); try{ global.show.graphics.setColor(new Color(0,60,0)); g.drawImage(global.show.offscreen, global.show.STARTX, global.show.STARTY, global.show); }catch(Exception eggg){ System.out.println("drawing menu4(teamplay) exc: "+eggg.toString()); } } public void actionPerformed(ActionEvent ae){ if(ae.toString().indexOf("Abort") > -1){ setVisible(false); global.show.menu(true); global.State=global.NOTHING; } if(ae.toString().indexOf("Select") > -1){ if(lijst != null && lijst.getSelectedItem().length() > 0 ){ Select(); } } if(ae.toString().indexOf("lijst") > -1){ } } public void Select(){ setVisible(false); global.team=Integer.parseInt(lijst.getSelectedItem().substring(4)); // room String result=global.execute("freeroom.php?team="+global.team+"&usernr="+global.usernr+"&time="+global.show.date.getTime()); System.out.println("Exact result of free: ["+result+"]"); global.level=Integer.parseInt(result.substring(0,result.indexOf(","))); try{ // Use , seperate or different perimeter ... global.room=Integer.parseInt(result.substring(result.indexOf(",")+1)); }catch(Exception egge){global.room=0;} if(global.room < 1){ global.show.menu(true); global.State=global.NOTHING; }else{ global.show.menu(true); global.teamplay=true; global.level=global.level-1; global.State=global.CHANGE; } } public void setVisible(boolean state){ Selectlabel.setVisible(state); Select.setVisible(state); Abort.setVisible(state); lijst.setVisible(state); } }