Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javafx.application.Application;
- import javafx.scene.Scene;
- import javafx.scene.layout.StackPane;
- import javafx.scene.web.*;
- import javafx.stage.Stage;
- public class JQERYUILauncher extends Application {
- Scene createScene() {
- final WebView webView = new WebView();
- webView.getEngine().loadContent(getInlineHtml(Theme.excitebike, "minDate: '-0d', maxDate: '+0m +2w'", null, null));
- Scene scene = new Scene(new StackPane(webView), 400, 350);
- return scene;
- }
- @Override
- public void start(Stage stage) {
- stage.setScene(createScene());
- stage.sizeToScene();
- stage.show();
- }
- //JQueryUI Themes
- enum Theme {
- base("base"), blacktie("black-tie"), blitzer("blitzer"), cupertino("cupertino"), dotluv("dot-luv"),
- excitebike("excite-bike"), hotsneaks("hot-sneaks"), humanity("humanity"), mintchoc("mint-choc"),
- redmond("redmond"), smoothness("smoothness"), southstreet("south-street"), start("start"), swankypurse("swanky-purse"),
- trontastic("trontastic"), uidarkness("ui-darkness"), uilightness("ui-lightness"), vader("vader");
- final private String themeName;
- Theme(String themeName) {
- this.themeName = themeName;
- }
- @Override
- public String toString() {
- return themeName;
- }
- }
- //Basic Design
- private String getInlineHtml(Theme theme, String initJavaScript, String customCSS, String googleCdnApiKey) {
- return "<!DOCTYPE html>"
- + "<html lang=\"en\">"
- + "<head>"
- + "<meta charset=\"utf-8\">"
- + "<title>jQuery UI Datepicker - Display inline</title>"
- + (googleCdnApiKey != null ? ("<script type=\"text/javascript\" src=\"https://www.google.com/jsapi?key=" + googleCdnApiKey + "\"></script>") : "")
- + "<link rel=\"stylesheet\" href=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/" + theme + "/jquery-ui.css\">"
- + "<link rel=\"stylesheet\" type=\"text/css\" href=\"http://yui.yahooapis.com/3.4.1/build/cssreset/cssreset-min.css\">"
- + "<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\"></script>"
- + "<script src=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js\"></script>"
- + "<style type=\"text/css\">#ui-datepicker-div {display: none;} " + (customCSS != null ? customCSS : "") + "</style>"
- + "<script>"
- + "$(function() {"
- + "$(\"#datepicker\").datepicker({"
- + "onSelect: function(dateText, inst) { alert(dateText); }"
- + (initJavaScript != null ? ("," + initJavaScript) : "")
- + "});"
- + "});"
- + "</script>"
- + "</head>"
- + "<body><span id=\"datepicker\"></span></body>"
- + "</html>";
- }
- public static void main(String[] args) {
- Application.launch(args);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment