71 lines
3.2 KiB
HTML
71 lines
3.2 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
<html>
|
|
<head>
|
|
<title>JavaFX_CalebFontenot.java</title>
|
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
|
<style type="text/css">
|
|
<!--
|
|
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
|
|
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
|
|
table {color: #888888; background-color: #313335; font-family: monospace}
|
|
.string {color: #6a8759}
|
|
.number {color: #6897bb}
|
|
.whitespace {color: #505050}
|
|
.comment {color: #808080}
|
|
.ST0 {color: #808080; font-family: monospace; font-weight: bold}
|
|
.literal {color: #cc7832}
|
|
-->
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/JavaFX_CalebFontenot/src/javafx_calebfontenot/JavaFX_CalebFontenot.java</td></tr></table>
|
|
<pre>
|
|
<span class="literal">package</span> javafx_calebfontenot;
|
|
<span class="literal">import</span> javafx.application.Application;
|
|
<span class="literal">import</span> javafx.event.ActionEvent;
|
|
<span class="literal">import</span> javafx.event.EventHandler;
|
|
<span class="literal">import</span> javafx.scene.Scene;
|
|
<span class="literal">import</span> javafx.scene.control.Button;
|
|
<span class="literal">import</span> javafx.scene.layout.StackPane;
|
|
<span class="literal">import</span> javafx.stage.Stage;
|
|
|
|
<span class="literal">public</span> <span class="literal">class</span> JavaFX_CalebFontenot <span class="literal">extends</span> Application {
|
|
|
|
@Override
|
|
<span class="literal">public</span> <span class="literal">void</span> start(Stage primaryStage)
|
|
{
|
|
Button btn = <span class="literal">new</span> Button();
|
|
btn.setText(<span class="string">"</span><span class="string">Say 'Hello World'</span><span class="string">"</span>);
|
|
btn.setOnAction(<span class="literal">new</span> EventHandler<ActionEvent>() {
|
|
|
|
@Override
|
|
<span class="literal">public</span> <span class="literal">void</span> handle(ActionEvent event)
|
|
{
|
|
System.out.println(<span class="string">"</span><span class="string">Hello World!</span><span class="string">"</span>);
|
|
}
|
|
});
|
|
|
|
|
|
StackPane root = <span class="literal">new</span> StackPane();
|
|
root.getChildren().add(btn);
|
|
|
|
Scene scene = <span class="literal">new</span> Scene(root, <span class="number">300</span>, <span class="number">250</span>);
|
|
|
|
primaryStage.setTitle(<span class="string">"</span><span class="string">Hello World!</span><span class="string">"</span>);
|
|
primaryStage.setScene(scene);
|
|
primaryStage.show();
|
|
}
|
|
|
|
<span class="comment">/**</span>
|
|
<span class="comment"> * </span><span class="ST0">@param</span> <span class="comment">args</span> <span class="comment">the</span> <span class="comment">command</span> <span class="comment">line</span> <span class="comment">arguments</span>
|
|
<span class="comment">*/</span>
|
|
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> main(String[] args)
|
|
{
|
|
launch(args);
|
|
}
|
|
|
|
}
|
|
|
|
</pre></body>
|
|
</html>
|