Bladeren bron

first commit

Shubham Aggarwal 7 jaren geleden
commit
c3c920d5e7

+ 53
- 0
build.xml Bestand weergeven

@@ -0,0 +1,53 @@
1
+<?xml version="1.0" encoding="UTF-8"?><!-- You may freely edit this file. See commented blocks below for --><!-- some examples of how to customize the build. --><!-- (If you delete it and reopen the project it will be recreated.) --><!-- By default, only the Clean and Build commands use this build script. --><project name="CalculatorFX" default="default" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">
2
+    <description>Builds, tests, and runs the project CalculatorFX.</description>
3
+    <import file="nbproject/build-impl.xml"/>
4
+    <!--
5
+
6
+    There exist several targets which are by default empty and which can be 
7
+    used for execution of your tasks. These targets are usually executed 
8
+    before and after some main targets. Those of them relevant for JavaFX project are: 
9
+
10
+      -pre-init:                 called before initialization of project properties
11
+      -post-init:                called after initialization of project properties
12
+      -pre-compile:              called before javac compilation
13
+      -post-compile:             called after javac compilation
14
+      -pre-compile-test:         called before javac compilation of JUnit tests
15
+      -post-compile-test:        called after javac compilation of JUnit tests
16
+      -pre-jfx-jar:              called before FX SDK specific <fx:jar> task
17
+      -post-jfx-jar:             called after FX SDK specific <fx:jar> task
18
+      -pre-jfx-deploy:           called before FX SDK specific <fx:deploy> task
19
+      -post-jfx-deploy:          called after FX SDK specific <fx:deploy> task
20
+      -pre-jfx-native:           called just after -pre-jfx-deploy if <fx:deploy> runs in native packaging mode
21
+      -post-jfx-native:          called just after -post-jfx-deploy if <fx:deploy> runs in native packaging mode
22
+      -post-clean:               called after cleaning build products
23
+
24
+    (Targets beginning with '-' are not intended to be called on their own.)
25
+
26
+    Example of inserting a HTML postprocessor after javaFX SDK deployment:
27
+
28
+        <target name="-post-jfx-deploy">
29
+            <basename property="jfx.deployment.base" file="${jfx.deployment.jar}" suffix=".jar"/>
30
+            <property name="jfx.deployment.html" location="${jfx.deployment.dir}${file.separator}${jfx.deployment.base}.html"/>
31
+            <custompostprocess>
32
+                <fileset dir="${jfx.deployment.html}"/>
33
+            </custompostprocess>
34
+        </target>
35
+
36
+    Example of calling an Ant task from JavaFX SDK. Note that access to JavaFX SDK Ant tasks must be
37
+    initialized; to ensure this is done add the dependence on -check-jfx-sdk-version target:
38
+
39
+        <target name="-post-jfx-jar" depends="-check-jfx-sdk-version">
40
+            <echo message="Calling jar task from JavaFX SDK"/>
41
+            <fx:jar ...>
42
+                ...
43
+            </fx:jar>
44
+        </target>
45
+
46
+    For more details about JavaFX SDK Ant tasks go to
47
+    http://docs.oracle.com/javafx/2/deployment/jfxpub-deployment.htm
48
+
49
+    For list of available properties check the files
50
+    nbproject/build-impl.xml and nbproject/jfx-impl.xml.
51
+
52
+    -->
53
+</project>

+ 4
- 0
build/built-jar.properties Bestand weergeven

@@ -0,0 +1,4 @@
1
+#Sun, 30 Apr 2017 00:42:04 +0530
2
+
3
+
4
+/Users/shubham/NetBeansProjects/CalculatorFX=

BIN
build/classes/calculatorfx/CalculatorFX.class Bestand weergeven


+ 45
- 0
dist/CalculatorFX.html Bestand weergeven

@@ -0,0 +1,45 @@
1
+<html><head>
2
+  <SCRIPT src="./web-files/dtjava.js"></SCRIPT>
3
+<script>
4
+    function launchApplication(jnlpfile) {
5
+        dtjava.launch(            {
6
+                url : 'CalculatorFX.jnlp',
7
+                jnlp_content : 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPGpubHAgc3BlYz0iMS4wIiB4bWxuczpqZng9Imh0dHA6Ly9qYXZhZnguY29tIiBocmVmPSJDYWxjdWxhdG9yRlguam5scCI+CiAgPGluZm9ybWF0aW9uPgogICAgPHRpdGxlPkNhbGN1bGF0b3JGWDwvdGl0bGU+CiAgICA8dmVuZG9yPnNodWJoYW08L3ZlbmRvcj4KICAgIDxkZXNjcmlwdGlvbj5udWxsPC9kZXNjcmlwdGlvbj4KICAgIDxvZmZsaW5lLWFsbG93ZWQvPgogIDwvaW5mb3JtYXRpb24+CiAgPHJlc291cmNlcz4KICAgIDxqMnNlIHZlcnNpb249IjEuNisiIGhyZWY9Imh0dHA6Ly9qYXZhLnN1bi5jb20vcHJvZHVjdHMvYXV0b2RsL2oyc2UiLz4KICAgIDxqYXIgaHJlZj0iQ2FsY3VsYXRvckZYLmphciIgc2l6ZT0iMzA4MiIgZG93bmxvYWQ9ImVhZ2VyIiAvPgogIDwvcmVzb3VyY2VzPgogIDxhcHBsZXQtZGVzYyAgd2lkdGg9IjgwMCIgaGVpZ2h0PSI2MDAiIG1haW4tY2xhc3M9ImNvbS5qYXZhZngubWFpbi5Ob0phdmFGWEZhbGxiYWNrIiAgbmFtZT0iQ2FsY3VsYXRvckZYIiA+CiAgICA8cGFyYW0gbmFtZT0icmVxdWlyZWRGWFZlcnNpb24iIHZhbHVlPSI4LjArIi8+CiAgPC9hcHBsZXQtZGVzYz4KICA8amZ4OmphdmFmeC1kZXNjICB3aWR0aD0iODAwIiBoZWlnaHQ9IjYwMCIgbWFpbi1jbGFzcz0iY2FsY3VsYXRvcmZ4LkNhbGN1bGF0b3JGWCIgIG5hbWU9IkNhbGN1bGF0b3JGWCIgLz4KICA8dXBkYXRlIGNoZWNrPSJhbHdheXMiLz4KPC9qbmxwPgo='
8
+            },
9
+            {
10
+                javafx : '8.0+'
11
+            },
12
+            {}
13
+        );
14
+        return false;
15
+    }
16
+</script>
17
+
18
+<script>
19
+    function javafxEmbedcalculatorfx() {
20
+        dtjava.embed(
21
+            {
22
+                id : 'calculatorfx',
23
+                url : 'CalculatorFX.jnlp',
24
+                placeholder : 'javafx-app-placeholder',
25
+                width : '800',
26
+                height : '600',
27
+                jnlp_content : 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPGpubHAgc3BlYz0iMS4wIiB4bWxuczpqZng9Imh0dHA6Ly9qYXZhZnguY29tIiBocmVmPSJDYWxjdWxhdG9yRlguam5scCI+CiAgPGluZm9ybWF0aW9uPgogICAgPHRpdGxlPkNhbGN1bGF0b3JGWDwvdGl0bGU+CiAgICA8dmVuZG9yPnNodWJoYW08L3ZlbmRvcj4KICAgIDxkZXNjcmlwdGlvbj5udWxsPC9kZXNjcmlwdGlvbj4KICAgIDxvZmZsaW5lLWFsbG93ZWQvPgogIDwvaW5mb3JtYXRpb24+CiAgPHJlc291cmNlcz4KICAgIDxqMnNlIHZlcnNpb249IjEuNisiIGhyZWY9Imh0dHA6Ly9qYXZhLnN1bi5jb20vcHJvZHVjdHMvYXV0b2RsL2oyc2UiLz4KICAgIDxqYXIgaHJlZj0iQ2FsY3VsYXRvckZYLmphciIgc2l6ZT0iMzA4MiIgZG93bmxvYWQ9ImVhZ2VyIiAvPgogIDwvcmVzb3VyY2VzPgogIDxhcHBsZXQtZGVzYyAgd2lkdGg9IjgwMCIgaGVpZ2h0PSI2MDAiIG1haW4tY2xhc3M9ImNvbS5qYXZhZngubWFpbi5Ob0phdmFGWEZhbGxiYWNrIiAgbmFtZT0iQ2FsY3VsYXRvckZYIiA+CiAgICA8cGFyYW0gbmFtZT0icmVxdWlyZWRGWFZlcnNpb24iIHZhbHVlPSI4LjArIi8+CiAgPC9hcHBsZXQtZGVzYz4KICA8amZ4OmphdmFmeC1kZXNjICB3aWR0aD0iODAwIiBoZWlnaHQ9IjYwMCIgbWFpbi1jbGFzcz0iY2FsY3VsYXRvcmZ4LkNhbGN1bGF0b3JGWCIgIG5hbWU9IkNhbGN1bGF0b3JGWCIgLz4KICA8dXBkYXRlIGNoZWNrPSJhbHdheXMiLz4KPC9qbmxwPgo='
28
+            },
29
+            {
30
+                javafx : '8.0+'
31
+            },
32
+            {}
33
+        );
34
+    }
35
+    <!-- Embed FX application into web page once page is loaded -->
36
+    dtjava.addOnloadCallback(javafxEmbedcalculatorfx);
37
+</script>
38
+
39
+</head><body>
40
+<h2>Test page for <b>CalculatorFX</b></h2>
41
+  <b>Webstart:</b> <a href='CalculatorFX.jnlp' onclick="return launchApplication('CalculatorFX.jnlp');">click to launch this app as webstart</a><br><hr><br>
42
+
43
+  <!-- Applet will be inserted here -->
44
+  <div id='javafx-app-placeholder'></div>
45
+</body></html>

BIN
dist/CalculatorFX.jar Bestand weergeven


+ 18
- 0
dist/CalculatorFX.jnlp Bestand weergeven

@@ -0,0 +1,18 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<jnlp spec="1.0" xmlns:jfx="http://javafx.com" href="CalculatorFX.jnlp">
3
+  <information>
4
+    <title>CalculatorFX</title>
5
+    <vendor>shubham</vendor>
6
+    <description>null</description>
7
+    <offline-allowed/>
8
+  </information>
9
+  <resources>
10
+    <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
11
+    <jar href="CalculatorFX.jar" size="3082" download="eager" />
12
+  </resources>
13
+  <applet-desc  width="800" height="600" main-class="com.javafx.main.NoJavaFXFallback"  name="CalculatorFX" >
14
+    <param name="requiredFXVersion" value="8.0+"/>
15
+  </applet-desc>
16
+  <jfx:javafx-desc  width="800" height="600" main-class="calculatorfx.CalculatorFX"  name="CalculatorFX" />
17
+  <update check="always"/>
18
+</jnlp>

+ 3954
- 0
dist/web-files/dtjava.js
Diff onderdrukt omdat het te groot bestand
Bestand weergeven


BIN
dist/web-files/error.png Bestand weergeven


BIN
dist/web-files/get_java.png Bestand weergeven


BIN
dist/web-files/get_javafx.png Bestand weergeven


BIN
dist/web-files/javafx-chrome.png Bestand weergeven


BIN
dist/web-files/javafx-loading-100x100.gif Bestand weergeven


BIN
dist/web-files/javafx-loading-25x25.gif Bestand weergeven


BIN
dist/web-files/upgrade_java.png Bestand weergeven


BIN
dist/web-files/upgrade_javafx.png Bestand weergeven


+ 3
- 0
manifest.mf Bestand weergeven

@@ -0,0 +1,3 @@
1
+Manifest-Version: 1.0
2
+X-COMMENT: Main-Class will be added automatically by build
3
+

+ 1421
- 0
nbproject/build-impl.xml
Diff onderdrukt omdat het te groot bestand
Bestand weergeven


+ 2
- 0
nbproject/configs/Run_as_WebStart.properties Bestand weergeven

@@ -0,0 +1,2 @@
1
+# Do not modify this property in this configuration. It can be re-generated.
2
+$label=Run as WebStart

+ 2
- 0
nbproject/configs/Run_in_Browser.properties Bestand weergeven

@@ -0,0 +1,2 @@
1
+# Do not modify this property in this configuration. It can be re-generated.
2
+$label=Run in Browser

+ 8
- 0
nbproject/genfiles.properties Bestand weergeven

@@ -0,0 +1,8 @@
1
+build.xml.data.CRC32=c90c0466
2
+build.xml.script.CRC32=a37a7b6d
3
+build.xml.stylesheet.CRC32=8064a381@1.80.1.48
4
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6
+nbproject/build-impl.xml.data.CRC32=c90c0466
7
+nbproject/build-impl.xml.script.CRC32=a3e727cc
8
+nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48

+ 4049
- 0
nbproject/jfx-impl.xml
Diff onderdrukt omdat het te groot bestand
Bestand weergeven


+ 2
- 0
nbproject/private/configs/Run_as_WebStart.properties Bestand weergeven

@@ -0,0 +1,2 @@
1
+# Do not modify this property in this configuration. It can be re-generated.
2
+javafx.run.as=webstart

+ 2
- 0
nbproject/private/configs/Run_in_Browser.properties Bestand weergeven

@@ -0,0 +1,2 @@
1
+# Do not modify this property in this configuration. It can be re-generated.
2
+javafx.run.as=embedded

+ 6
- 0
nbproject/private/private.properties Bestand weergeven

@@ -0,0 +1,6 @@
1
+auxiliary.org-netbeans-modules-projectapi.issue214819_5f_fx_5f_enabled=true
2
+# No need to modify this property unless customizing JavaFX Ant task infrastructure
3
+endorsed.javafx.ant.classpath=.
4
+javafx.run.inbrowser=<Default System Browser>
5
+javafx.run.inbrowser.path=/usr/bin/open
6
+user.properties.file=/Users/shubham/Library/Application Support/NetBeans/8.2/build.properties

+ 113
- 0
nbproject/project.properties Bestand weergeven

@@ -0,0 +1,113 @@
1
+annotation.processing.enabled=true
2
+annotation.processing.enabled.in.editor=false
3
+annotation.processing.processor.options=
4
+annotation.processing.processors.list=
5
+annotation.processing.run.all.processors=true
6
+annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
7
+application.title=CalculatorFX
8
+application.vendor=shubham
9
+build.classes.dir=${build.dir}/classes
10
+build.classes.excludes=**/*.java,**/*.form
11
+# This directory is removed when the project is cleaned:
12
+build.dir=build
13
+build.generated.dir=${build.dir}/generated
14
+build.generated.sources.dir=${build.dir}/generated-sources
15
+# Only compile against the classpath explicitly listed here:
16
+build.sysclasspath=ignore
17
+build.test.classes.dir=${build.dir}/test/classes
18
+build.test.results.dir=${build.dir}/test/results
19
+compile.on.save=true
20
+compile.on.save.unsupported.javafx=true
21
+# Uncomment to specify the preferred debugger connection transport:
22
+#debug.transport=dt_socket
23
+debug.classpath=\
24
+    ${run.classpath}
25
+debug.test.classpath=\
26
+    ${run.test.classpath}
27
+# This directory is removed when the project is cleaned:
28
+dist.dir=dist
29
+dist.jar=${dist.dir}/CalculatorFX.jar
30
+dist.javadoc.dir=${dist.dir}/javadoc
31
+endorsed.classpath=
32
+excludes=
33
+includes=**
34
+# Non-JavaFX jar file creation is deactivated in JavaFX 2.0+ projects
35
+jar.archive.disabled=true
36
+jar.compress=false
37
+javac.classpath=\
38
+    ${javafx.classpath.extension}
39
+# Space-separated list of extra javac options
40
+javac.compilerargs=
41
+javac.deprecation=false
42
+javac.processorpath=\
43
+    ${javac.classpath}
44
+javac.source=1.8
45
+javac.target=1.8
46
+javac.test.classpath=\
47
+    ${javac.classpath}:\
48
+    ${build.classes.dir}
49
+javac.test.processorpath=\
50
+    ${javac.test.classpath}
51
+javadoc.additionalparam=
52
+javadoc.author=false
53
+javadoc.encoding=${source.encoding}
54
+javadoc.noindex=false
55
+javadoc.nonavbar=false
56
+javadoc.notree=false
57
+javadoc.private=false
58
+javadoc.splitindex=true
59
+javadoc.use=true
60
+javadoc.version=false
61
+javadoc.windowtitle=
62
+javafx.application.implementation.version=1.0
63
+javafx.binarycss=false
64
+javafx.classpath.extension=\
65
+    ${java.home}/lib/javaws.jar:\
66
+    ${java.home}/lib/deploy.jar:\
67
+    ${java.home}/lib/plugin.jar
68
+javafx.deploy.allowoffline=true
69
+# If true, application update mode is set to 'background', if false, update mode is set to 'eager'
70
+javafx.deploy.backgroundupdate=false
71
+javafx.deploy.embedJNLP=true
72
+javafx.deploy.includeDT=true
73
+# Set true to prevent creation of temporary copy of deployment artifacts before each run (disables concurrent runs)
74
+javafx.disable.concurrent.runs=false
75
+# Set true to enable multiple concurrent runs of the same WebStart or Run-in-Browser project
76
+javafx.enable.concurrent.external.runs=false
77
+# This is a JavaFX project
78
+javafx.enabled=true
79
+javafx.fallback.class=com.javafx.main.NoJavaFXFallback
80
+# Main class for JavaFX
81
+javafx.main.class=calculatorfx.CalculatorFX
82
+javafx.preloader.class=
83
+# This project does not use Preloader
84
+javafx.preloader.enabled=false
85
+javafx.preloader.jar.filename=
86
+javafx.preloader.jar.path=
87
+javafx.preloader.project.path=
88
+javafx.preloader.type=none
89
+# Set true for GlassFish only. Rebases manifest classpaths of JARs in lib dir. Not usable with signed JARs.
90
+javafx.rebase.libs=false
91
+javafx.run.height=600
92
+javafx.run.width=800
93
+# Pre-JavaFX 2.0 WebStart is deactivated in JavaFX 2.0+ projects
94
+jnlp.enabled=false
95
+# Main class for Java launcher
96
+main.class=com.javafx.main.Main
97
+# For improved security specify narrower Codebase manifest attribute to prevent RIAs from being repurposed
98
+manifest.custom.codebase=*
99
+# Specify Permissions manifest attribute to override default (choices: sandbox, all-permissions)
100
+manifest.custom.permissions=
101
+manifest.file=manifest.mf
102
+meta.inf.dir=${src.dir}/META-INF
103
+platform.active=default_platform
104
+run.classpath=\
105
+    ${dist.jar}:\
106
+    ${javac.classpath}:\
107
+    ${build.classes.dir}
108
+run.test.classpath=\
109
+    ${javac.test.classpath}:\
110
+    ${build.test.classes.dir}
111
+source.encoding=UTF-8
112
+src.dir=src
113
+test.src.dir=test

+ 25
- 0
nbproject/project.xml Bestand weergeven

@@ -0,0 +1,25 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project xmlns="http://www.netbeans.org/ns/project/1">
3
+    <type>org.netbeans.modules.java.j2seproject</type>
4
+    <configuration>
5
+        <buildExtensions xmlns="http://www.netbeans.org/ns/ant-build-extender/1">
6
+            <extension file="jfx-impl.xml" id="jfx3">
7
+                <dependency dependsOn="-jfx-copylibs" target="-post-jar"/>
8
+                <dependency dependsOn="-rebase-libs" target="-post-jar"/>
9
+                <dependency dependsOn="jfx-deployment" target="-post-jar"/>
10
+                <dependency dependsOn="jar" target="debug"/>
11
+                <dependency dependsOn="jar" target="profile"/>
12
+                <dependency dependsOn="jar" target="run"/>
13
+            </extension>
14
+        </buildExtensions>
15
+        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
16
+            <name>CalculatorFX</name>
17
+            <source-roots>
18
+                <root id="src.dir"/>
19
+            </source-roots>
20
+            <test-roots>
21
+                <root id="test.src.dir"/>
22
+            </test-roots>
23
+        </data>
24
+    </configuration>
25
+</project>

+ 127
- 0
src/calculatorfx/CalculatorFX.java Bestand weergeven

@@ -0,0 +1,127 @@
1
+/*
2
+ * To change this license header, choose License Headers in Project Properties.
3
+ * To change this template file, choose Tools | Templates
4
+ * and open the template in the editor.
5
+ */
6
+package calculatorfx;
7
+
8
+import javafx.application.Application;
9
+import javafx.event.ActionEvent;
10
+import javafx.geometry.Pos;
11
+import javafx.scene.Scene;
12
+import javafx.scene.control.Button;
13
+import javafx.scene.control.Label;
14
+import javafx.scene.control.TextField;
15
+import javafx.scene.layout.GridPane;
16
+import javafx.stage.Stage;
17
+
18
+/**
19
+ *
20
+ * @author shubham
21
+ */
22
+public class CalculatorFX extends Application {
23
+    
24
+    TextField tfNum1;
25
+    TextField tfNum2;
26
+    Button btnDivide;
27
+    Button btnMultiply;
28
+    Button btnAddition;
29
+    Button btnSubtraction;
30
+    Button btnClear;
31
+    Label lblAnswer;
32
+    
33
+    @Override
34
+    public void start(Stage primaryStage) {
35
+        
36
+        tfNum1 = new TextField();
37
+        tfNum2 = new TextField();
38
+        btnDivide = new Button("/");
39
+        btnMultiply = new Button("*");
40
+        btnAddition = new Button("+");
41
+        btnSubtraction = new Button("-");
42
+        btnClear = new Button("Clear");
43
+        lblAnswer = new Label("?");
44
+        
45
+        lblAnswer.setAlignment(Pos.CENTER);
46
+        lblAnswer.setStyle("-fx-border-color: #000; -fx-padding: 5px;");
47
+        
48
+        GridPane root = new GridPane();
49
+        root.setAlignment(Pos.CENTER);
50
+        
51
+        root.setHgap(10);
52
+        root.setVgap(10);
53
+        
54
+        root.add(btnDivide, 0, 0);
55
+        root.add(btnMultiply, 1, 0);
56
+        root.add(btnAddition, 0, 1);
57
+        root.add(btnSubtraction, 1, 1);
58
+        root.add(btnClear, 0, 4, 2, 1);
59
+        
60
+        root.add(tfNum1, 0, 2);
61
+        root.add(tfNum2, 1, 2);
62
+        root.add(lblAnswer, 0, 3, 2, 1);
63
+        
64
+        setWidths();
65
+        attachCode();
66
+        
67
+        Scene scene = new Scene(root, 300, 250);
68
+        primaryStage.setTitle("CalculatorFX 1.0");
69
+        primaryStage.setScene(scene);
70
+        primaryStage.show();
71
+    }
72
+
73
+    private void setWidths() {
74
+        tfNum1.setPrefWidth(70);
75
+        tfNum2.setPrefWidth(70);
76
+        btnDivide.setPrefWidth(70);
77
+        btnMultiply.setPrefWidth(70);
78
+        btnAddition.setPrefWidth(70);
79
+        btnSubtraction.setPrefWidth(70);
80
+        btnClear.setPrefWidth(150);
81
+        lblAnswer.setPrefWidth(150);
82
+    }
83
+
84
+    public void attachCode() {
85
+        //have each button run BTNCODE when clicked
86
+        btnAddition.setOnAction(e -> btncode(e));
87
+        btnSubtraction.setOnAction(e -> btncode(e));
88
+        btnMultiply.setOnAction(e -> btncode(e));
89
+        btnDivide.setOnAction(e -> btncode(e));
90
+        btnClear.setOnAction(e -> btncode(e));
91
+    }
92
+
93
+    public void btncode(ActionEvent e) {
94
+        int num1, num2, answer;
95
+        char symbol;
96
+        //e tells us which button was clicked
97
+        if (e.getSource() == btnClear) {
98
+            tfNum1.setText("");
99
+            tfNum2.setText("");
100
+            lblAnswer.setText("?");
101
+            tfNum1.requestFocus();
102
+            return;
103
+        }
104
+        //read numbers in from textfields
105
+        num1 = Integer.parseInt(tfNum1.getText());
106
+        num2 = Integer.parseInt(tfNum2.getText());
107
+        if (e.getSource() == btnAddition) {
108
+            symbol = '+';
109
+            answer = num1 + num2;
110
+        } else if (e.getSource() == btnSubtraction) {
111
+            symbol = '-';
112
+            answer = num1 - num2;
113
+        } else if (e.getSource() == btnMultiply) {
114
+            symbol = 'x';
115
+            answer = num1 * num2;
116
+        } else {
117
+            symbol = '/';
118
+            answer = num1 / num2;
119
+        }
120
+        //display answer
121
+        lblAnswer.setText("" + num1 + symbol + num2 + "=" + answer);
122
+    }
123
+    
124
+    public static void main(String[] args) {
125
+        launch(args);
126
+    }
127
+}