From 6ca45fe37b622f0ca48bb95d79c592b2479aedc9 Mon Sep 17 00:00:00 2001 From: "beard%netscape.com" Date: Sat, 12 Dec 1998 01:33:27 +0000 Subject: [PATCH] First Checked In. --- .../MRJ/testing/TrivialApplet/MyApplet.mcp | Bin 0 -> 31832 bytes .../testing/TrivialApplet/TrivialApplet.html | 68 +++++++ .../testing/TrivialApplet/TrivialApplet.java | 183 ++++++++++++++++++ .../testing/TrivialApplet/TrivialApplets.html | 77 ++++++++ 4 files changed, 328 insertions(+) create mode 100644 plugin/oji/MRJ/testing/TrivialApplet/MyApplet.mcp create mode 100644 plugin/oji/MRJ/testing/TrivialApplet/TrivialApplet.html create mode 100644 plugin/oji/MRJ/testing/TrivialApplet/TrivialApplet.java create mode 100644 plugin/oji/MRJ/testing/TrivialApplet/TrivialApplets.html diff --git a/plugin/oji/MRJ/testing/TrivialApplet/MyApplet.mcp b/plugin/oji/MRJ/testing/TrivialApplet/MyApplet.mcp new file mode 100644 index 0000000000000000000000000000000000000000..847310e56bf537c04bf47bbc3c7066ae4f808fdc GIT binary patch literal 31832 zcmeHQeQX@Zb)P-*BvK}2N~R@ScB7LNeb`ivlH)o8<0hnzq)mz^UMVURR43-~xF%1! zyS?7+$+BY9L@mTY(*i>4#z5l&PWz967=iPFRzZ_i`9R_TY170J(zFKR!e|;GM&o|L zZBv;2{bpv5x5wSPBYBNQb00Z7Z{N)P_RX8OGqbZFm$Iyk5TZp0 z$nG~n1|mf4I)GEvt zMP=GRDrFXnkwns-cPC6H3v;F&Ic3^*IydJ|8%}4;NIaR(FH1RIN@r#xLl^Br(p}`f zV<#ePlLyS4>-dxpri;m9(ag?d%)+w7v2^adhuCS;%DTjQV?8}MN;VJu+(;@34v|}? za%?ybC0xfHnTU+%?Q}MMsR~9OZ7i9aD<$VlR}q;qUb6Egd%4_8*?2NFeku|-VP#l9 zXJ%Z*63JpJnencRPV=lxA`$a6Gv&T!W}=6gDNYOxyY-?>pH7vgN8W*A)}ta5<|Xf1 zOr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(+=x^S$_ZaW5{{ioMBvy0@u^zA?Z;A(6zBx06Gsg4xZD(ISBsZ?6UT@Ml1Q1p*7y zv%sx-A{Cr5^(+;n2Nnn{@J_ctxgTsFJ#Lk9vv{S=yUOw_D!jpk`xE?n@Z#ds$jQN6 zDYND`;Jl9)NCOM3D+_R9!T&=%MY2V^>Rr}$$Xh6{I$t^;WHHEd?%HmJyjA10{B$X8 zJM%9noJx7eA>^SPIF<5SUgB51vbKCvwS2bY=RY7veml>npDW~@#EE3>BK540cRY{% zF68I;e=6iX+=o14x#b;KvA>Jo4ikGXy|9#a`-AuleZP`_jB>q3y8GjhcPRPzNyu9e zK=1z>yz+Wj$)EZz1oGoK_^GO=p~hw<|JQFouD&)TI=&CSTgfl}5%^6AppKtlvqj1O z;%DIXM-4jO0KZkqqkj#)4FPoEQ^4P(Is^jE%PEx4sTu|K>~&?f(sh^UM?AcOZZcW998n)dJX)$D1|DQu{nhEEA2kN z?nV2C4rlYlD*3TLh5XK}J(qFkj}l+w5Z9si|2epw^0*@Ob4QBfz7BpNF^1o`-TU7b z_}wb)=&!+^tup@?zc~$AM9EF~W6O3ae`@LnknK_O_x&F7?~wA?L=v*SNMeWban;dDuzgi0=P{Y`>CEk0O7Y%r9Q~Gsq4od6dUe?IL=<3jUyypN|4Z`K|cq zE07&h^4v81R^xp33S?{>P;nmll|PG579hA=ibeEQ#18(~!1pM5X9wc8Y_fVD()%pr Lb~fpLL;wE(yR4fL literal 0 HcmV?d00001 diff --git a/plugin/oji/MRJ/testing/TrivialApplet/TrivialApplet.html b/plugin/oji/MRJ/testing/TrivialApplet/TrivialApplet.html new file mode 100644 index 000000000000..452f02b9d834 --- /dev/null +++ b/plugin/oji/MRJ/testing/TrivialApplet/TrivialApplet.html @@ -0,0 +1,68 @@ + + +TrivialApplet + + + + + + +

+ + + +

+ +
+ +The source. + +
+ +

+ + + + + +

+ +
+ + + diff --git a/plugin/oji/MRJ/testing/TrivialApplet/TrivialApplet.java b/plugin/oji/MRJ/testing/TrivialApplet/TrivialApplet.java new file mode 100644 index 000000000000..9595f747e0cf --- /dev/null +++ b/plugin/oji/MRJ/testing/TrivialApplet/TrivialApplet.java @@ -0,0 +1,183 @@ +/* + Trivial applet that displays a string - 4/96 PNL +*/ + +import java.awt.*; +import java.awt.event.*; +import java.applet.Applet; +import java.net.URL; +import java.net.MalformedURLException; + +import netscape.javascript.JSObject; + +class AboutBox extends Frame { + AboutBox(Menu aboutMenu, ActionListener[] actionListeners) { + super("About This Applet"); + + addWindowListener( + new WindowAdapter() { + public void windowClosing(WindowEvent e) { + dispose(); + } + }); + + Button okButton = new Button("OK"); + okButton.addActionListener( + new ActionListener() { + public void actionPerformed(ActionEvent e) { + dispose(); + } + }); + + // Annoying use of flow layout managers. + Panel labelPanel = new Panel(); + Panel buttonPanel = new Panel(); + + labelPanel.add(new Label("This applet's about box...")); + buttonPanel.add(okButton); + + add(labelPanel, "North"); + add(buttonPanel, "Center"); + + // test menu bar stuff. + MenuBar menuBar = new MenuBar(); + aboutMenu = (Menu) cloneMenu(aboutMenu); + for (int i = 0; i < actionListeners.length; i++) + aboutMenu.getItem(i).addActionListener(actionListeners[i]); + menuBar.add(aboutMenu); + setMenuBar(menuBar); + + pack(); + show(); + } + + private MenuItem cloneMenu(MenuItem oldItem) { + if (oldItem instanceof Menu) { + Menu oldMenu = (Menu) oldItem; + Menu newMenu = new Menu(oldMenu.getLabel()); + int count = oldMenu.getItemCount(); + for (int i = 0; i < count; i++) { + newMenu.add(cloneMenu(oldMenu.getItem(i))); + } + return newMenu; + } else { + MenuItem newItem = new MenuItem(oldItem.getLabel()); + return newItem; + } + } +} + +class ExceptionThread extends Thread { + ExceptionThread() { + start(); + } + + public void run() { + throw new Error("this is an error!"); + } +} + +public class TrivialApplet extends Applet { + public Button goButton; + public Button aboutButton; + public TextField urlField; + public Menu aboutMenu; + public ActionListener[] actionListeners; + private static int appletCount; + + public void init() { + ++appletCount; + + goButton = new Button("Go"); + aboutButton = new Button("About"); + + String urlText = getParameter("URL"); + if (urlText == null) + urlText = "http://www.apple.com"; + + urlField = new TextField(urlText); + + ActionListener goListener = + new ActionListener() { + public void actionPerformed(ActionEvent e) { + try { + URL apple = new URL(urlField.getText()); + getAppletContext().showDocument(apple, "Apple!"); + } catch (MalformedURLException mfue) { + } + } + }; + + ActionListener aboutListener = + new ActionListener() { + public void actionPerformed(ActionEvent e) { + new AboutBox(aboutMenu, actionListeners); + } + }; + + goButton.addActionListener(goListener); + aboutButton.addActionListener(aboutListener); + + add(goButton); + add(aboutButton); + add(urlField); + + // Try a pop-up menu, and a menu in the menubar. + PopupMenu contextMenu = new PopupMenu(); + aboutMenu = new Menu("About"); + + contextMenu.add(newItem("About", aboutListener)); + aboutMenu.add(newItem("About", aboutListener)); + + contextMenu.add(newItem("Go", goListener)); + aboutMenu.add(newItem("Go", goListener)); + + ActionListener errorListener = new ActionListener() { + public void actionPerformed(ActionEvent e) { + new ExceptionThread(); + } + }; + contextMenu.add(newItem("Error", errorListener)); + aboutMenu.add(newItem("Error", errorListener)); + + ActionListener[] listeners = { aboutListener, goListener, errorListener }; + actionListeners = listeners; + + add(contextMenu); + } + + private MenuItem newItem(String title, ActionListener listener) { + MenuItem item = new MenuItem(title); + item.addActionListener(listener); + return item; + } + + private Frame getFrame() { + Component p = this; + while (p != null && !(p instanceof Frame)) + p = getParent(); + return (Frame)p; + } + + // public void paint( Graphics g ) {} + + public boolean mouseEnter(Event evt, int x, int y) { + showStatus("Welcome!"); + return true; + } + + public boolean mouseExit(Event evt, int x, int y) { + showStatus("See you later!"); + return true; + } + + public void print(String message) { + JSObject window = JSObject.getWindow(this); + Object[] args = { message }; + window.call("println", args); + } + + public int getAppletCount() { + return appletCount; + } +} diff --git a/plugin/oji/MRJ/testing/TrivialApplet/TrivialApplets.html b/plugin/oji/MRJ/testing/TrivialApplet/TrivialApplets.html new file mode 100644 index 000000000000..6321529d7da1 --- /dev/null +++ b/plugin/oji/MRJ/testing/TrivialApplet/TrivialApplets.html @@ -0,0 +1,77 @@ + + +TrivialApplets + + + + + + +
+ + + + + +
+ + + + + +
+ +

+The source. +

+ +
+ + + + + + + +
+ + +