Seversintabi.com Türkiye'nin En Büyük Forumu Bence Seversin Tabi
 

Go Back   Seversintabi.com Türkiye'nin En Büyük Forumu Bence Seversin Tabi > Webmaster Dünyası > Web Programlama (Diller, Metodlar) > C++ VB Delphi Java
Yardım Topluluk Takvim Bugünki Mesajlar Arama

gaziantep escort gaziantep escort
youtube beğeni hilesi
Cevapla

 

LinkBack Seçenekler Stil
  #1  
Alt 8 January 2009, 15:06
Senior Member
 
Kayıt Tarihi: 21 September 2008
Mesajlar: 15,180
Konular:
Aldığı Beğeni: 0 xx
Beğendiği Mesajlar: 0 xx
Standart java ile cep tel. için chat örneği

Kod:
import javax.microedition.midlet.*;import javax.microedition.lcdui.*;import javax.microedition.io.*;import java.util.*;import java.io.*;public class ChatMIDlet extends javax.microedition.midlet.MIDlet{ChatForm form;public void startApp(){NickForm nickForm=new NickForm(this,"Chat Form");Display.getDisplay(this).setCurrent(nickForm);}public void pauseApp(){}public void destroyApp(boolean unconditional){}public void setNick(String nick){ChatForm form=new ChatForm("Chat Form",nick);Display.getDisplay(this).setCurrent(form); }}class ChatForm extends Form implements CommandListener{String url="[Link'i Görebilmeniz İçin Kayıt Olunuz.! Kayıt OL]";Command sendCommand=new Command("Send",Command.SCREEN,2);Command getCommand=new Command("Get",Command.SCREEN,1);TextField messageField;MessagesBox messagesBox;String nick="";public ChatForm(String title,String nick){super(title); this.nick=nick;messagesBox=new MessagesBox("","");messageField=new TextField("","",100,TextField.ANY);append(messageField);append(messagesBox);addCommand(sendCommand);addCommand(getCommand);setCommandListener(this);}public void commandAction(Command c, Displayable d){if(c==sendCommand){try{String s=messageField.getString();if(s!=null){ String result=send(s);messagesBox.append(nick+">"+s);messageField.setString("");}else{messagesBox.append("String null"); } }catch(Exception e){messagesBox.append("Exception"+e.getMessage()); }}else if(c==getCommand){try{String s=get();if(s!=null){messagesBox.append(s.trim());}else{messagesBox.append("String null");} }catch(Exception e){messagesBox.append("Exception"+e.getMessage()); } }}private String send(String message) throws Exception{HttpConnection connecton=(HttpConnection)Connector.open(url+"?mes sage="+message+"&nick="+nick+"&req=SEND");InputStream is=connecton.openInputStream();StringBuffer buffer=new StringBuffer();int ch; while ((ch=is.read())!=-1) {buffer.append((char)ch);}is.close();connecton.close();return buffer.toString();}private String get() throws Exception{StringBuffer sb=new StringBuffer();InputStream is=Connector.openInputStream(url+"?req=GET");int ch;while((ch = is.read())!=-1) {sb.append((char) ch);}return sb.toString();} }class MessagesBox extends StringItem{Vector messages=new Vector(); public MessagesBox(String label, String text){super(label,text);}public void append(String message){messages.addElement(message);refresh();}public void refresh(){StringBuffer buffer=new StringBuffer();for(int i=(messages.size()-1);i>-1;i--){String message=(String)messages.elementAt(i);buffer.append(message+"\n");}setText(buffer.toString());}}class NickForm extends Form implements CommandListener{Command okCommand=new Command("Ok",Command.SCREEN,1);TextField field; ChatMIDlet midlet;public NickForm(ChatMIDlet midlet,String title){super(title);this.midlet=midlet;field=new TextField("Nick:","",100,TextField.ANY);append(field);addCommand(okCommand);setCommandListener(this);}public void commandAction(Command c, Displayable d){if(c==okCommand){String nick=field.getString();midlet.setNick(nick);}} }
[Link'i Görebilmeniz İçin Kayıt Olunuz.! Kayıt OL]
Alıntı ile Cevapla
Cevapla




Saat: 09:36


Telif Hakları vBulletin® v3.8.9 Copyright ©2000 - 2024, ve
Jelsoft Enterprises Ltd.'e Aittir.
gaziantep escort bayan gaziantep escort
antalya haber sex hikayeleri Antalya Seo tesbih aresbet giriş vegasslotguncel.com herabetguncel.com ikili opsiyon bahis vegasslotyeniadresi.com vegasslotadresi.com vegasslotcanli.com getirbett.com getirbetgir.com
ankara escort ankara escort ankara escort bayan escort ankara ankara escort çankaya escort ankara otele gelen escort eryaman escort eryaman escort eryaman escort kızılay escort çankaya escort kızılay escort ankara eskort
mecidiyeköy escort

Search Engine Friendly URLs by vBSEO 3.6.0 PL2