code : import import import import import import
java.awt.*; java.awt.event.*; java.io.*; java.net.*; javax.swing.*; javax.swing.event.*;
public class tarayici extends jframe implements actionlistener,hyperlinklistener { private jeditorpane webs; private jscrollpane kay; private jmenubar menubar; private jmenu menu,hakkimda; private jmenuitem menukapa; private button kapat; private button yazdir; private button dugme; private textfield kutu; private url url; public tarayici() { super("tarayici"); setsize(950,700); container c=getcontentpane(); dugme=new button("git"); dugme.addactionlistener(this); menubar=new jmenubar(); menu=new jmenu("dosya"); hakkimda=new jmenu("hakk�mda"); hakkimda.addactionlistener(this); menukapa=new jmenuitem("��k�"); menukapa.addactionlistener(this); menu.add(menukapa); menubar.add(menu); menubar.add(hakkimda); kapat=new button("kapat"); kapat.addactionlistener(this); yazdir=new button("geri"); yazdir.addactionlistener(this); kutu=new textfield("http://www."); kutu.addactionlistener(this); webs=new jeditorpane(); webs.seteditable(false);
webs.addhyperlinklistener(this); setjmenubar(menubar); c.setlayout(null); kay=new jscrollpane(webs); kay.setbounds(10,50,940,650); kutu.setbounds(10,20,740,25); dugme.setbounds(751,20,50,25); kapat.setbounds(803,20,50,25); yazdir.setbounds(855,20,50,25); c.add(kapat); c.add(kay); c.add(dugme); c.add(yazdir); c.add(kutu); show(); } public void actionperformed(actionevent e) { settitle("kachak web tarayici - site a��l�yor..."); setcursor(cursor.getpredefinedcursor(cursor.wait_cursor)); object kaynak=e.getsource(); string satir=kutu.gettext(); if (kaynak==dugme || kaynak==kutu) { try { webs.setpage(satir); settitle("kachak web tarayici - a��ld�"); } catch (ioexception ei) { try { webs.setpage("http://www.cmaeal.com/hata/hata.html"); kutu.settext("hata: sayfayok"); } catch (ioexception se) { system.out.print("hata oldu.."); }
} } else if (kaynak==kapat) { system.exit(0); }
else if (kaynak==hakkimda) { joptionpane.showmessagedialog( this,"s�r�m 1.0","yazan: can �K�Elik",joptionpane.information_message );
} else if (kaynak==menukapa) { system.exit(0); } else if (kaynak==yazdir) { webs.setpage((string)yazdir.geteditor().getitem()); } } public void hyperlinkupdate( hyperlinkevent ea ) { if ( ea.geteventtype() == hyperlinkevent.eventtype.activated ) { try { webs.setpage( ea.geturl().tostring() ); kutu.settext(ea.geturl().tostring()); } catch (ioexception ei) { try { webs.setpage("http://www.cmaeal.com/hata/hata.html"); kutu.settext("hata: sayfayok"); } catch (ioexception se) { system.out.print("hata oldu.."); } } }
}
public static void main(string[] args) { tarayici t=new tarayici(); t.setvisible(true); } }