sundar@1241: #// Usage: jjs -fx showsysprops.js sundar@1241: sundar@1241: /* sundar@1241: * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. sundar@1241: * sundar@1241: * Redistribution and use in source and binary forms, with or without sundar@1241: * modification, are permitted provided that the following conditions sundar@1241: * are met: sundar@1241: * sundar@1241: * - Redistributions of source code must retain the above copyright sundar@1241: * notice, this list of conditions and the following disclaimer. sundar@1241: * sundar@1241: * - Redistributions in binary form must reproduce the above copyright sundar@1241: * notice, this list of conditions and the following disclaimer in the sundar@1241: * documentation and/or other materials provided with the distribution. sundar@1241: * sundar@1241: * - Neither the name of Oracle nor the names of its sundar@1241: * contributors may be used to endorse or promote products derived sundar@1241: * from this software without specific prior written permission. sundar@1241: * sundar@1241: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS sundar@1241: * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, sundar@1241: * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR sundar@1241: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR sundar@1241: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, sundar@1241: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, sundar@1241: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR sundar@1241: * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF sundar@1241: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING sundar@1241: * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS sundar@1241: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. sundar@1241: */ sundar@1241: sundar@1241: if (!$OPTIONS._fx) { sundar@1241: print("Usage: jjs -fx showsysprops.js"); sundar@1241: exit(1); sundar@1241: } sundar@1241: sundar@1241: // This script displays System properties as a HTML table. sundar@1241: // Demonstrates heredoc to generate HTML content and display sundar@1241: // using JavaFX WebView. sundar@1241: sundar@1241: // JavaFX, Java classes used sundar@1241: var Scene = Java.type("javafx.scene.Scene"); sundar@1241: var System = Java.type("java.lang.System"); sundar@1241: var WebView = Java.type("javafx.scene.web.WebView"); sundar@1241: sundar@1241: // JavaFX start method sundar@1241: function start(stage) { sundar@1241: start.title = "Your System Properties"; sundar@1241: var wv = new WebView(); sundar@1241: var sysproprows = ""; sundar@1241: var sysprops = System.properties; sundar@1241: for (var i in sysprops) { sundar@1241: sysproprows += < sundar@1241: sundar@1241: ${i} sundar@1241: sundar@1241: sundar@1241: ${sysprops[i]} sundar@1241: sundar@1241: sundar@1241: TBL sundar@1241: } sundar@1241: sundar@1241: wv.engine.loadContent(< sundar@1241: sundar@1241: sundar@1241: Your System Properties sundar@1241: sundar@1241: sundar@1241: sundar@1241:

Your System Properties

sundar@1241: sundar@1241: ${sysproprows} sundar@1241:
sundar@1241: sundar@1241: sundar@1241: EOF, "text/html"); sundar@1241: stage.scene = new Scene(wv, 750, 500); sundar@1241: stage.show(); sundar@1241: }