words/src/main/java/org/apidesign/demo/words/Main.java
author Jaroslav Tulach <jtulach@netbeans.org>
Thu, 15 Aug 2013 13:17:54 +0200
changeset 46 009537e6ce80
parent 45 spinningcube/src/main/java/org/apidesign/demo/spinningcube/Main.java@3f85884ca049
permissions -rw-r--r--
Simpler animation demo that works on JDK7
jtulach@39
     1
/**
jtulach@39
     2
 * The MIT License (MIT)
jtulach@39
     3
 *
jtulach@39
     4
 * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
jtulach@39
     5
 *
jtulach@39
     6
 * Permission is hereby granted, free of charge, to any person obtaining a copy
jtulach@39
     7
 * of this software and associated documentation files (the "Software"), to deal
jtulach@39
     8
 * in the Software without restriction, including without limitation the rights
jtulach@39
     9
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
jtulach@39
    10
 * copies of the Software, and to permit persons to whom the Software is
jtulach@39
    11
 * furnished to do so, subject to the following conditions:
jtulach@39
    12
 *
jtulach@39
    13
 * The above copyright notice and this permission notice shall be included in
jtulach@39
    14
 * all copies or substantial portions of the Software.
jtulach@39
    15
 *
jtulach@39
    16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
jtulach@39
    17
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
jtulach@39
    18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
jtulach@39
    19
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
jtulach@39
    20
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
jtulach@39
    21
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
jtulach@39
    22
 * THE SOFTWARE.
jtulach@39
    23
 */
jtulach@46
    24
package org.apidesign.demo.words;
jtulach@39
    25
jtulach@39
    26
import net.java.html.boot.BrowserBuilder;
jtulach@39
    27
jtulach@39
    28
jtulach@39
    29
/** Bootstrap and initialization.
jtulach@39
    30
 * 
jtulach@39
    31
 * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
jtulach@39
    32
 */
jtulach@39
    33
public final class Main {
jtulach@39
    34
    private Main() {
jtulach@39
    35
    }
jtulach@39
    36
    
jtulach@39
    37
    /** Launches the browser */
jtulach@39
    38
    public static void main(String... args) throws Exception {
jtulach@39
    39
        BrowserBuilder.newBrowser().
jtulach@39
    40
            loadPage("pages/index.html").
jtulach@39
    41
            loadClass(Main.class).
jtulach@46
    42
            invoke("onPageLoad", args).
jtulach@39
    43
            showAndWait();
jtulach@39
    44
        System.exit(0);
jtulach@39
    45
    }
jtulach@39
    46
    
jtulach@39
    47
    /** Called when page is ready */
jtulach@46
    48
    public static void onPageLoad(String... args) throws Exception {
jtulach@39
    49
        Data d = new Data();
jtulach@42
    50
        d.setMessage("Hello World from HTML and Java!");
jtulach@39
    51
        d.applyBindings();
jtulach@39
    52
    }
jtulach@39
    53
}