Simple windowed application: Difference between revisions

Undo revision 338228 by Mellington (talk)
(Undo revision 338229 by Mellington (talk))
(Undo revision 338228 by Mellington (talk))
Line 1,811:
}</lang>
 
=={{header|JavaFX Script}}==
<html>
{{libheader|JavaFX 1.2}}
<head>
<lang javafx>import javafx.stage.*;
<title>Simple Window Application</title>
import javafx.scene.*;
</head>
import javafx.scene.layout.*;
import javafx.scene.control.*;
 
Stage {
<body>
scene: Scene {
<br> &nbsp &nbsp &nbsp &nbsp
width: 300 height: 200
content: VBox {
var clicks: = 0Integer;
 
spacing: 10
<script type="text/javascript">
}; content: [
var box = document.createElement('input')
box.style.position = 'absolute'; //Label position it{
def varText = bind if (clicks == 0) then "no clicks yet" else "{clicks} clicks"
box.style.left = '10px';
text : bind "There have been {varText}"
box.style.top = '60px';
}
document.body.appendChild(box).style.border="3px solid white";
Button {
document.body.appendChild(box).value = "There have been no clicks yet";
text: "click me"
document.body.appendChild(box).style['width'] = '220px';
onMouseClicked: function(e) { clicks++; }
var clicks = 0;
function count_clicks() { }
]
document.body.appendChild(box).remove()
clicks += 1;}
}
document.getElementById("clicks").innerHTML = clicks;
}</lang>
};
</script>
 
<button type="button" onclick="count_clicks()"> Click me</button>
<pre><p> Clicks: <a id="clicks">0</a> </p></pre>
</body>
 
</html>
 
=={{header|Julia}}==
7,804

edits