|
This extension basically adds a TutorialTo add <js> to your existing tag library, say CookSwing, add the following code: CookJSLib.setupTags (CookSwing.getSwingTagLibrary ()); To enable Rhino JavaScript engine running in Java Web Start, however, requires the following two flags to be set. JSCreator.setDisablingOptimization (true); JSCreator.setUsingProxyJavaAdapter (true); As for details why these two flags are necessary, check my comment on Rhino bugzilla. The type of the object <button text="Button 1"> <js func="addActionListener"> var listener = { actionPerformed: function (e) { statusBar.setText (e.getSource ().getText () + " Pressed"); } } new java.awt.event.ActionListener (listener); </js> </button> <button text="Button 2"> <!-- calling an external Javascript code (identical to the JS code above) --> <js func="addActionListener" src="examples/cookjs/action.js"/> </button> DemoTry the Java Web Start demo for some simple demos. The frame code was also written in JavaScript. |