applet mywindow applet

menu
the code below utilizes a menubar. experiment with the applet below to see what it does. then proceed to understand the code that generates the applet. you would see an applet here if your browser supported java. the init method begins by creating an instance of mywindow . (menubars can not be added to the display window of an applet.) this instance is then sized to be 500 pixels wide and 500 pixels high. its background color is set to white, its foreground color is set to black, the layout manager is set to the flow layout manager , and it is then displayed with the setvisible(true) command. notice that mywindow extends the built-in class frame . the constructor for this class adds a menubar across the top of the frame. this is a somewhat laborious process and works as follows. first, a new menubar is created. then, one or more menu s can be added to the menubar . in the example below, a single menu (named colormenu ) is added to the menubar . to build up a menu , one can add either menuitem s or separators to it. a menuitem is a choice that a user can select from the menu . a separator is a line that can be used to group logically related choices in the menu together. notice that there are three things that must be done to use a menuitem . first, an instance must be instantiated. second, an action listener must be added for the individual menuitem so that activity with that instance (such as selecting it) can be detected. third, the menuitem must be added to the menu . after the menu is complete, the menu is added to the menubar . when the menubar is complete, it is added to the frame via the setmenubar method at the very bottom of the constructor. make sure that you understand how the menubar has been constructed before proceeding. the final method in the mywindow class is actionperformed . since the class implements actionlistener , this method must be defined according to the event handling summary . the method begins by calling the getactioncommand method. this method returns the string label of the menu item selected. if the person chose red , white , or blue , the background is set accordingly. if the person chose the exit option, a call to setvisible(false); is made to hide the frame. import java.awt. ; import java.awt.event. ; import java.applet. ; public class example extends applet public void init() mywindow w new mywindow(); w.setsize(500, 500); w.setbackground(color.white); w.setforeground(color.black); w.setlayout(new flowlayout()); w.setvisible(true); class mywindow extends frame implements actionlistener mywindow () menubar mainmenubar new menubar(); menu colormenu new menu( color ); menuitem reditem new menuitem( red ); reditem.addactionlistener(this); colormenu.add(reditem); menuitem whiteitem new menuitem( white ); whiteitem.addactionlistener(this); colormenu.add(whiteitem); menuitem blueitem new menuitem( blue ); blueitem.addactionlistener(this); colormenu.add(blueitem); colormenu.addseparator(); menuitem exititem new menuitem( exit ); exititem.addactionlistener(this); colormenu.add(exititem); mainmenubar.add(colormenu); setmenubar(mainmenubar); public void actionperformed (actionevent evt) string arg evt.getactioncommand(); if (arg.equals( red )) setbackground(color.red); else if (arg.equals( white )) setbackground(color.white); else if (arg.equals( blue )) setbackground(color.blue); else if (arg.equals( exit )) setvisible(false); repaint();
Fonte: http://www.cs.montana.edu/~paxton/tutorial/menu.htm




applet mywindow


javascript example
this is a simple applet that calls a javascript function called test()on this page. it will work with netscape 3.x and 4.x as well as msie 4.x, but not with msie 3.x. there is no way to accomplish this from msie 3.x. javascript.class import java.awt. ; import java.applet. ; import java.net. ; public final class javascript extends applet button button; public void init() button new button( press me to test java to javascript invocation. ); add(button); public boolean action(event event, object arg) if(event.target button) url url; class jsobjectclass; rather than checking the browser vendor to determine what action to take, we test for the presence of the jsobject class. try jsobjectclass class.forname( netscape.javascript.jsobject ); catch(classnotfoundexception e) jsobjectclass null; if(jsobjectclass ! null) netscape.javascript.jsobject window; window netscape.javascript.jsobject.getwindow(this); window (netscape.javascript.jsobject)window.getmember ( top ); window.eval( test(); ); else try url new url( javascript:top.test(); ); getappletcontext().showdocument(url); catch(malformedurlexception e) button.setlabel( javascript invocation is not supported ); return true; jsobject class should be found ok in the file java40.jar. java40.jar comes with your ie or netacape browser. import netscape.javascript.jsobject; import netscape.javascript.jsexception; when you click on either button it will cause the browser to display the html code in the corresponding text field as a new document. the liveconnect button does this via the livescript support, and the showdocument() button via the applet context s showdocument() method given a javascript: url. import java.awt.event; import java.awt.button; import java.awt.textfield; import java.awt.flowlayout; import java.applet.applet; import java.net.url; import java.net.malformedurlexception; import netscape.javascript.jsobject; import netscape.javascript.jsexception; public class jscriptexample extends applet private string text1 wow gimme more! ; private string text2 wowee gimme more! ; private textfield txt1, txt2; private jsobject win, doc; public void init() setlayout(new flowlayout(flowlayout.left)); txt1 new textfield(text1, 40); txt2 new textfield(text2, 40); add(txt1); add(new button( liveconnect )); add(txt2); add(new button( showdocument() )); public void start() win jsobject.getwindow(this); doc (jsobject) win.getmember( document ); public boolean action(event evt, object obj) if (obj.equals( liveconnect )) object args txt1.gettext() ; doc.call( writeln , args); return true; if (obj.equals( showdocument() )) url js; try js new url( javascript: txt2.gettext() ); catch (malformedurlexception mue) return true; getappletcontext().showdocument(js); return true; return super.action(evt, obj); using liveconnect basically what you do is get a handle on the current document (the getwindow() and getmember() methods) and then display the html with the javascript writeln function (via the doc.call() method). since this uses the netscape.javascript package you must include the java-301.zip class archive in your classpath when compiling the applet. i actually just use a javac -classpath java-301.zip:. ... . furthermore the applet tag must include the mayscript attribute: import java.applet.applet; import java.awt. ; import java.util. ; import java.net. ; import java.io. ; import netscape.javascript. ; docwriter (c) 1996 by paul a. houle (ph18 cornell.edu) docwriter, like many good things in life, is free. you can find out more about docwriter at http: www.msc.cornell.edu houle javascript docwriter.html docwriter uses liveconnect to output a table of sines, cosines, and tangents to another browser window. the user can then print the results or save them to a file. liveconnect is only available on netscape 3.0 as of the time of this writing. public class docwriter extends applet button gobutton; jsobject mozilla; public void init() setbackground(color.white); gobutton new button( go! ); add(gobutton); ; public boolean action(event evt,object what) if (evt.target gobutton) go(); return false; ; void go() double angle; mozilla jsobject.getwindow(this); mozilla.eval( mywindow window.open( , displaywindow ) ); mozilla.eval( mywindow.document.open( text html ) ); writedoc( sin cos tangent table ); writedoc( angle sin cos tan ); for(int i 0;i i ); writedoc( math.sin(angle) ); writedoc( math.cos(angle) ); writedoc( math.tan(angle) ); ; writedoc( ); if you don t call mywindow.document.close(), the user will not be able to print or save the document you wrote mozilla.eval( mywindow.document.close() ); ; void writedoc(string s) mozilla.eval( mywindow.document.write( s ) ); ; ; it is now in the jsdk: c: jdk jre lib jaws.jar
Fonte: http://ryancarlson.no-ip.com:7031/applet%20info.txt



the admin zone forums - where to install chat room
forum management - community cooperative - phpbb - vbulletin - invision forum set-up - servers & hosting - server configuration - search engine optimization increasing traffic - forum advertising - forum software - graphics - security - forum layout html php mysql - forum insiders - forum review - forum showcase - featured forums articles & interviews - forum classifieds - forum staff - launch team - ezboard where to install chat room the admin zone forums bulletin board layout custo [..] let td tr table !--end code for conferenceroom applet-- noppid 07-11-2004, 03:23 pm you need something like this hack to integrate it nicely... http: www.vbhacks.us forum showthread.php?t 48 squirly61 07-11-2004, 04:18 pm can you tell me where to put it? thanks for that part but i have no idea where to put it... san-deep 07-12-2004, 02:46 am i would recommend you going for vbxirc by zachery from vbulletin.org :) its available for free and it is installed by maximum number of people running vbulletin. regards, noppid 07-12-2004, 09:38 am can you tell me where to put it? thanks for that part but i have no idea where to put it... the html you posted goes in a template and you need a php page to drive it. stylevar htmldoctype html id moooo dir stylevar textdirection lang stylevar languagecode head title vboptions bbtitle - pagetitle title headinclude head body header navbar table border 2 width 100 cellspacing 1 cellpadding 1 tr td class tcat align center strong welcome! strong br br td tr tr td class alt1 align center br br !--begin code for conferenceroom applet-- table border 0 width 500 align center tr td applet archive http: www.freejavachat.com java cr.zip codebase http: www.freejavachat.com java name cr code conferenceroom.class width 500 height 300 param name channel value hunt fsih trap param name showbuttonpanel value true param name bg value ffffff param name fg value 000000 param name roomswidth value 0 param name lurk value true param name simple value true param name restricted value true param name showjoins value true param name showserverwindow value true param name nicklock value true param name playsounds value true param name onlyshowchat value true param name showcolorpanel value true param name floatnewwindows value true param name timestamp value true param name listtime value 0 param name guicolors1 value youcolor 000000;opercolor ff0000;voicecolor 006600 ;userscolor 000099 param name guicolors2 value inputcolor ffffff;inputtextcolor 000099;sessioncol or ffffff;systemcolor 0000ff param name guicolors3 value titlecolor ffffff;titletextcolor 000099;sessiontex tcolor 000000 param name guicolors4 value joincolor 009900;partcolor 009900;talkcolor 000099 param name nick value center this application requires java suport. br this server also available via irc at: br a href irc: irc.ircstorm.net:6667 irc: irc.ircstorm.net:6667 a center applet td tr table !--end code for conferenceroom applet-- br br br td tr table footer body html ?php standard stuff set php environment error-reporting(e-all e-notice); define important constants define( no-register-globals , 1); define( this-script , irc ); pre-cache templates used by all actions globaltemplates array( irc ); require-once( . global.php ); navname array( parent live chat ); navbits construct-navbits( navname); eval( navbar . fetch-template( navbar ) . ; ); eval( print-output( . fetch-template( irc ) . ); ); ? name the new template irc and the new php page irc.php that should work, but i did not test it. floris 07-14-2004, 03:51 am i would recommend you going for vbxirc by zachery from vbulletin.org :) its available for free and it is installed by maximum number of people running vbulletin. regards, i second that, we use vbxirc on our site here (http: www.vbulletin.nl community chat.php) and it is just simple code you throw in every page you can think off of coding. works great ! squirly61 07-14-2004, 02:22 pm how do i make a php page? noppid 07-14-2004, 06:45 pm copy and paste the php code into an editor and save the file as irc.php. it s that easy. unfortunatly the xirc app won t work with the java client you ve chosen. you have to switch java apps. squirly61 07-15-2004, 09:36 am what about para chat? would that work? http: www.parachat.com squirly61 07-15-2004, 09:47 am what about this code? !-- -- begin java chat server software http: www.12planet.com -------------- center a href http: www.12planet.com script language javascript src http: www.myinfochat.com myinfochat profile myinfochat.js script param name sessionfilterwords value fuck;shit;asshole param name sessionlanguage value english param name sessiongroupvalue value computers-internet param name sessiononloginsound value ring.au param name sessiononpagersound value beeper.au param name guifontstyle value 1 param name guifontsize value 10 param name guifonttype value arial param name guibackcolor value 333300 param name ifinputwhisperfontcolor value ccff66 param name roomvalue value htf param name roomtopics value hunting, fishing and trapping param name tabchatbordercolor value 330099 param name tabchattabcolor value cc0066 param name panelrightshow value y param name tabroomsshow value y param name btfloat value y param name btlogout value y applet a br br center !-- -- end free java chat room h a href http: www.infochat.com -------------- script language javascript function dojoin(a,b) top.frames.infochatapplet.document.applets.chatapplet.dojoin(a,b); function openwindow(page,target,a-width,a-height) window.open(page,target, toolbar no,location no,directories no,status no,menubar no,resizable yes,copyhistory no,scrollbars yes,width a-width,height a-height ); function btsave() mywindow window.open( , displaywindow ); mywindow.document.write( 1- type ctrl a ); mywindow.document.write( br ); mywindow.document.write( 2- type ctrl c ); mywindow.document.write( br ); mywindow.document.write( 3- paste into your document ); mywindow.document.write( br ); mywindow.document.write( br ); mywindow.document.write(document.applets.chatapplet.getchatlog()); script form input type button name bticons value icons onclick openwindow( http: www.infochat.com www icons.html , win1 ,500,200) input type button name btsave value save chat-transcript onclick btsave() form squirly61 07-15-2004, 09:49 am and what kind of editor do i use? :help: squirly61 07-15-2004, 11:04 am ok, i have the code...: !-- -- begin java chat server software http: www.12planet.com -------------- center a href http: www.12planet.com script language javascript src http: www.myinfochat.com myinfochat profile myinfochat.js script param name sessionfilterwords value fuck;shit;asshole param name sessionlanguage value english param name sessiongroupvalue value computers-internet param name sessiononloginsound value ring.au param name sessiononpagersound value beeper.au param name guifontstyle value 1 param name guifontsize value 10 param name guifonttype value arial param name guibackcolor value 333300 param name ifinputwhisperfontcolor value ccff66 param name roomvalue value htf param name roomtopics value hunting, fishing and trapping param name tabchatbordercolor value 330099 param name tabchattabcolor value cc0066 param name panelrightshow value y param name tabroomsshow value y param name btfloat value y param name btlogout value y applet a br br center !-- -- end free java chat room h a href http: www.infochat.com -------------- script language javascript function dojoin(a,b) top.frames.infochatapplet.document.applets.chatapplet.dojoin(a,b); function openwindow(page,target,a-width,a-height) window.open(page,target, toolbar no,location no,directories no,status no,menubar no,resizable yes,copyhistory no,scrollbars yes,width a-width,height a-height ); function btsave() mywindow window.open( , displaywindow ); mywindow.document.write( 1- type ctrl a ); mywindow.document.write( br ); mywindow.document.write( 2- type ctrl c ); mywindow.document.write( br ); mywindow.document.write( 3- paste into your document ); mywindow.document.write( br ); mywindow.document.write( br ); mywindow.document.write(document.applets.chatapplet.getchatlog()); script form input type button name bticons value icons onclick openwindow( http: www.infochat.com www icons.html , win1 ,500,200) input type button name btsave value save chat-transcript onclick btsave() form i need to know exactly where to put it. where at in vb to i put it? i need step by step instructions if you would please. im not familiar with this. the only thing i installed on my site was a site counter, and i thought that was tuff. thanks in advance. squirly noppid 07-15-2004, 01:59 pm i m sure ya could make any chat app work with vb. the issue here seems to be experience on your part. i think, as suggested, you d be better off using an existing hack that offers java chat and follow the instructions for install. if you stilll have a problem with what is a php file or how to template, you may want to hire someone to install one for you. squirly61 07-15-2004, 04:45 pm well, i guess i ll hire someone. anyone willing to do this? how much? squirly :banana: squirly61 07-19-2004, 10:00 am figured it out...all i did was added it to the header and it works fine. wish someone could have told me how to do this earlier. :cookoo: vbulletin v3.0.3, copyright ©2000-2005, jelsoft enterprises ltd.
SEGUE
Fonte: http://www.theadminzone.com/forums/archive/index.php/t-2957.html



appletmywindow