From 55fcd3bdd450ccd19fb280f56467da1521934a86 Mon Sep 17 00:00:00 2001 From: ivyrodriguez Date: Sat, 2 Jul 2016 09:28:41 -0700 Subject: [PATCH 01/33] JavaFX tutorials 1 through 3, branch teamwork --- ivyrodriguez/.idea/compiler.xml | 23 + .../.idea/copyright/profiles_settings.xml | 3 + ivyrodriguez/.idea/description.html | 2 + ivyrodriguez/.idea/encodings.xml | 5 + ivyrodriguez/.idea/gradle.xml | 7 + ivyrodriguez/.idea/misc.xml | 12 + ivyrodriguez/.idea/modules.xml | 8 + ivyrodriguez/.idea/uiDesigner.xml | 125 ++++ ivyrodriguez/.idea/workspace.xml | 676 ++++++++++++++++++ ivyrodriguez/ivyrodriguez.iml | 12 + .../ivyrodriguez/JavaFXDemo/Controller.class | Bin 0 -> 269 bytes .../ivyrodriguez/JavaFXDemo/JavaFXDemo.fxml | 8 + .../ivyrodriguez/JavaFXDemo/Main1.class | Bin 0 -> 1351 bytes .../ivyrodriguez/JavaFXDemo/Main2.class | Bin 0 -> 2089 bytes .../ivyrodriguez/JavaFXDemo/Main3.class | Bin 0 -> 2218 bytes ivyrodriguez/src/JavaFXDemo/Controller.java | 4 + ivyrodriguez/src/JavaFXDemo/Main1.java | 48 ++ ivyrodriguez/src/JavaFXDemo/Main2.java | 53 ++ ivyrodriguez/src/JavaFXDemo/Main3.java | 46 ++ ivyrodriguez/src/JavaFXDemo/sample.fxml | 8 + 20 files changed, 1040 insertions(+) create mode 100644 ivyrodriguez/.idea/compiler.xml create mode 100644 ivyrodriguez/.idea/copyright/profiles_settings.xml create mode 100644 ivyrodriguez/.idea/description.html create mode 100644 ivyrodriguez/.idea/encodings.xml create mode 100644 ivyrodriguez/.idea/gradle.xml create mode 100644 ivyrodriguez/.idea/misc.xml create mode 100644 ivyrodriguez/.idea/modules.xml create mode 100644 ivyrodriguez/.idea/uiDesigner.xml create mode 100644 ivyrodriguez/.idea/workspace.xml create mode 100644 ivyrodriguez/ivyrodriguez.iml create mode 100644 ivyrodriguez/out/production/ivyrodriguez/JavaFXDemo/Controller.class create mode 100644 ivyrodriguez/out/production/ivyrodriguez/JavaFXDemo/JavaFXDemo.fxml create mode 100644 ivyrodriguez/out/production/ivyrodriguez/JavaFXDemo/Main1.class create mode 100644 ivyrodriguez/out/production/ivyrodriguez/JavaFXDemo/Main2.class create mode 100644 ivyrodriguez/out/production/ivyrodriguez/JavaFXDemo/Main3.class create mode 100644 ivyrodriguez/src/JavaFXDemo/Controller.java create mode 100644 ivyrodriguez/src/JavaFXDemo/Main1.java create mode 100644 ivyrodriguez/src/JavaFXDemo/Main2.java create mode 100644 ivyrodriguez/src/JavaFXDemo/Main3.java create mode 100644 ivyrodriguez/src/JavaFXDemo/sample.fxml diff --git a/ivyrodriguez/.idea/compiler.xml b/ivyrodriguez/.idea/compiler.xml new file mode 100644 index 0000000..217af47 --- /dev/null +++ b/ivyrodriguez/.idea/compiler.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/ivyrodriguez/.idea/copyright/profiles_settings.xml b/ivyrodriguez/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/ivyrodriguez/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/ivyrodriguez/.idea/description.html b/ivyrodriguez/.idea/description.html new file mode 100644 index 0000000..cc10d56 --- /dev/null +++ b/ivyrodriguez/.idea/description.html @@ -0,0 +1,2 @@ +Simple JavaFX 2.0 application that includes simple .fxml file with attached controller and Main class to quick start. Artifact to build JavaFX application is provided. + \ No newline at end of file diff --git a/ivyrodriguez/.idea/encodings.xml b/ivyrodriguez/.idea/encodings.xml new file mode 100644 index 0000000..e206d70 --- /dev/null +++ b/ivyrodriguez/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ivyrodriguez/.idea/gradle.xml b/ivyrodriguez/.idea/gradle.xml new file mode 100644 index 0000000..157a0c1 --- /dev/null +++ b/ivyrodriguez/.idea/gradle.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/ivyrodriguez/.idea/misc.xml b/ivyrodriguez/.idea/misc.xml new file mode 100644 index 0000000..2404a4c --- /dev/null +++ b/ivyrodriguez/.idea/misc.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/ivyrodriguez/.idea/modules.xml b/ivyrodriguez/.idea/modules.xml new file mode 100644 index 0000000..116e16b --- /dev/null +++ b/ivyrodriguez/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/ivyrodriguez/.idea/uiDesigner.xml b/ivyrodriguez/.idea/uiDesigner.xml new file mode 100644 index 0000000..3b00020 --- /dev/null +++ b/ivyrodriguez/.idea/uiDesigner.xml @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ivyrodriguez/.idea/workspace.xml b/ivyrodriguez/.idea/workspace.xml new file mode 100644 index 0000000..8d6d8ee --- /dev/null +++ b/ivyrodriguez/.idea/workspace.xml @@ -0,0 +1,676 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + localhost + 5050 + + + + + + + + 1359379246138 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ivyrodriguez/ivyrodriguez.iml b/ivyrodriguez/ivyrodriguez.iml new file mode 100644 index 0000000..d5c0743 --- /dev/null +++ b/ivyrodriguez/ivyrodriguez.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/ivyrodriguez/out/production/ivyrodriguez/JavaFXDemo/Controller.class b/ivyrodriguez/out/production/ivyrodriguez/JavaFXDemo/Controller.class new file mode 100644 index 0000000000000000000000000000000000000000..1a0efd475a3846ad55573e2c70260ef39678d3f4 GIT binary patch literal 269 zcmZXO&5FW65QM8^el$kou20}iJ(!C(#f#u6=wTP{lQ`(en2|C1UVB>b-~;SKi5(I4 zU^f(9ReaEY_v;P77@ZI`v;wpP!~}n;3RTVswf + + + + + + \ No newline at end of file diff --git a/ivyrodriguez/out/production/ivyrodriguez/JavaFXDemo/Main1.class b/ivyrodriguez/out/production/ivyrodriguez/JavaFXDemo/Main1.class new file mode 100644 index 0000000000000000000000000000000000000000..10534e25b8a8cc68a70a205f3e602d69db15fa45 GIT binary patch literal 1351 zcmaJ>Yje{^6g`{RR-%Y7goMzf0h1Q+BOp?s4@^lQfkJT}5C#VLw3ZiJAWI%ehVZkP zDGqIBI(+6wb$WIkVu#lUUERHV?!D(eq!0i7^Dlr)*s?K=MH|QP(+Dowv|P6EvyChk zM``?J1i$LTZx*iDur<;~WeivGyM=4H<@i0L0J-I8*(f%~v81CcYjNGe4GSv*xmqVp zqflV3`dq%0&$ivfQ=xLbC`{uhaBrCF3V~Ps&`+-k3>S(I1u`p9T?rhn`k`9yv}!7T zAZr0F6V=F*!9yAQ`n+e%q)k5&7_TO>)ee-qCjD@cK{G8X0>=tZO?EesVZ+@@V?S(E zOcoh8=y&uB*8hlQU?hXw(vsKq&23M$Q$Gq53#&YDMV;7Fw|w0g+Z26XciF)VW*ywb zJZpR4r-8~x&+=(gwTRSX+Uq3`~5Io z?u1@*AZ348EFw{tXgeX-2Pbil6T^KT5%eBcvRr&Xu72o+p=YeU~lmK)j(cggMHbF^=N|b*BfwN#uDN zWypD2wDU#2d(Q7L)OWTS1eijG83zOWfFEgR7jcFN9pDWtqJTT)iQz6XrCnqn?;!UU zR_QNT6C+)W?!u;NY;Bll#rWfeNgSTUksTaeFQ4mTvfRZ~pTrq51sUha z_Xru!F!?-FU%*)`p@3BsaT{eru+$^5S0U*TQy|fKzKbZ4>=J)?Wh}6H=NL7^yYqZp I>O;8jKSW74w*UYD literal 0 HcmV?d00001 diff --git a/ivyrodriguez/out/production/ivyrodriguez/JavaFXDemo/Main2.class b/ivyrodriguez/out/production/ivyrodriguez/JavaFXDemo/Main2.class new file mode 100644 index 0000000000000000000000000000000000000000..7bc32f52fd76728b0f595f5512fc15c70fbaecd9 GIT binary patch literal 2089 zcmaJ?Yg-#d6n+O1mTb0w5NH9xfL237yIQ^LJT|j zsvo;L_VBfaeQEKjhG!bS(eN!pU$G&C?=ei}4y|MB;MAY&iS_G?plE(&n;m@RGd1)K(208Yc4l8 zEyue@pphzV7{*f1ly%d!ys}vkf#a34%8C_~>D|ant{I|rVFiNWX6llepWGAL7*6!|gtgt=l%rFFSiM59W~Fmb`)x*Ed`#bnc}wSwCAJJfE&#R^W@ zvqU2x(|Z??R;}hbwj~XlEA4&u;=Tjqk)j)q8n88|>$L&boDLn_EFWtA$)@W_CRssT@O^-2{J)wHq&U zv08E5QoyN|Z>Q!is>b$Rm#adroB3j$2ghb%jNRZjN zr_?K##KMWSZ4m*HU0aibLprQd-8CLMnpI7gdc{9sh>-(fDN|#&=!fBHSz{P#$GmV> z7raX3)W{fB&YF&IZqv{bG`hG|CHKN4b&DA^nn#{+Jttx?)j}T5a;5My&N;rVGX>WuIcn2vu#W067N#x@N`i75xM^F2)P9VS-A{g%i z$Y7r240mvsG$g=Z&`1k-k{Rx8B9eZN=>9qSeuI|&720rr6EV3-H=#dAoUV+``6g~i z*&i6_!QOKW?$0MMl)&&g5?h%&O^jxm7;BSBLni|>B@NIyb%AJUKdk5=i_KIzB+B#6jO zN%behf5ENc@g^oDuU-}50s4Xv*eC`jvTk_^ehW;gCmfcWa) zq(_66b3FR1$G^$ro!OKm1$+Eq=W*xWJKz28y|aJ)^Xzv3Gk9uX6n720hWDaK8@Pw} zb=)`5jk`T0{2+>1xtSXv?GNQ@QOA-2Q`(sLs29t~>R5@)`hSoH5SjI6)xtmwtJ2?^ z9M*gAF+Pc6!@wpUMX{x0TgRswBDty%o~vOryT=aL?vWMbxy!A*=L+9*ta){uCdGTU zYm56DI+GJy8oDxGfotf`+Ad$MmUG?=*tGITyeOy z!fbb%oOYFIq2WUEiMri#m|L_qgm1gWw7P})MY0<_=U78`Aeb*STuh!q7p%z1oHtCFLur{{`-P%Pc$_t%-r32(O|r`40v+>j$3_c^SbE3k0| zZ2S(9dJ2sna93D!d0~6*1G!cJH6m=}`K@PFG#DFR)z9;XwxrfjwB43@GLgWTi5(<~ zolRRfJmKvoM2RQ1ZMWbZ>UeD82|m+s`6X#JaRpa3L^F<^-%pgeiO;1;Y~J%kAbeI? z;iBXfg8m4;h~Z0`zKUVS1Vhe59t8@p&HIatnc&#fQ8ZD4O{LMMtVok_?3vhyW1@^P z9j*xv6%Fx4UQ4*%VIt>yhi)P-L;Bi;FY)y+C0IGZ2rv^l<~SP6*1FPgrEw9fR46hg zIk)DTYnAe&%uu zQH>pxyhExq38g`9EfBm+H>*}0Ry0|*XRXs?Am~ZptW4Mkl|j2$gHCW!Jt#DG(V8A88n4mLqFJ7Gr;efhNQ(}0pfJiP@97Zq)4t|5>pKae?liM;L+qjXB}Os z6Ljw!Bk~LM)X&fdqILAh#WNT{9la+o>G+kEsXF?k{5SM>VEY8Iov9(jhcI}I;nm4o zbzGRN<6;v~O4<_<5uzeaG>i}tHwfBois>H3vrG}KV}gFalL~Mu1l5R`;NceOYV_SC z!tPLb%jEG5yot`3A?vvjPKHh-AMu~?>cFKsM&x{%<|dRrbdo{>QOZD!NNf@u$6I)t i&N}f9jU9Lw-_UH3!y|l$8ZKd;_A(h6(pkU*Jp30ud^D{9 literal 0 HcmV?d00001 diff --git a/ivyrodriguez/src/JavaFXDemo/Controller.java b/ivyrodriguez/src/JavaFXDemo/Controller.java new file mode 100644 index 0000000..54e5bd1 --- /dev/null +++ b/ivyrodriguez/src/JavaFXDemo/Controller.java @@ -0,0 +1,4 @@ +package sample; + +public class Controller { +} diff --git a/ivyrodriguez/src/JavaFXDemo/Main1.java b/ivyrodriguez/src/JavaFXDemo/Main1.java new file mode 100644 index 0000000..4713c77 --- /dev/null +++ b/ivyrodriguez/src/JavaFXDemo/Main1.java @@ -0,0 +1,48 @@ +package sample; + +import javafx.application.Application; +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.layout.StackPane; +import javafx.stage.Stage; + +/** + * Created by ivelisse on 6/27/2016. + */ +public class Main1 extends Application { + //Application is the class that inherits all the functionality + + + Button button; + + public static void main(String[] args) { + launch(args); + //launch(args) is a method that is called once the main program starts and goes inside the application class + //it sets ups your javafx application + } + + @Override + public void start(Stage primaryStage) throws Exception { + //the application will call a method called start, start is actually overridden because you are inheriting + //it from the application class. The start method passes in the primaryStage which is the main window for + //the application. + + primaryStage.setTitle("Title of the Window"); //sets the title of the window + button = new Button(); + button.setText("Click me"); + + StackPane layout = new StackPane(); //create layout object of the StackPane class + layout.getChildren().add(button); //add button to the layout + + Scene scene = new Scene(layout, 300, 250); //Create scene of the Scene class, pass in layout object and hw + primaryStage.setScene(scene); //pass in scene object to set Scene of window + primaryStage.show(); //show the window + + } + +} + + + diff --git a/ivyrodriguez/src/JavaFXDemo/Main2.java b/ivyrodriguez/src/JavaFXDemo/Main2.java new file mode 100644 index 0000000..23f5f86 --- /dev/null +++ b/ivyrodriguez/src/JavaFXDemo/Main2.java @@ -0,0 +1,53 @@ +package sample; + +import javafx.application.Application; +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.layout.StackPane; +import javafx.stage.Stage; + +/** + * Created by ivelisse on 6/27/2016. + */ +public class Main2 extends Application implements EventHandler { + //Application is the class that inherits all the functionality, implements the EventHandler interface for executing + //handle method when action occurs on an event..ie a button is clicked. + + + Button button; + + public static void main(String[] args) { + launch(args); + //launch(args) is a method that is called once the main program starts and goes inside the application class + //it sets ups your javafx application + } + + @Override + public void start(Stage primaryStage) throws Exception { + //the application will call a method called start, start is actually overridden because you are inheriting + //it from the application class. The start method passes in the primaryStage which is the main window for + //the application. + + primaryStage.setTitle("Title of the Window"); //sets the title of the window + button = new Button(); + button.setText("Click me"); + button.setOnAction(this);//whenever this button is clicked look for handle method below in this class + + StackPane layout = new StackPane(); //create layout object of the StackPane class + layout.getChildren().add(button); //add button to the layout + + Scene scene = new Scene(layout, 300, 250); //Create scene of the Scene class, pass in layout object and hw + primaryStage.setScene(scene); //pass in scene object to set Scene of window + primaryStage.show(); //show the window + + } + + @Override + public void handle(ActionEvent event) { + if (event.getSource() == button) { + System.out.println("OOoooh I love it when you touch me there"); + } + } +} diff --git a/ivyrodriguez/src/JavaFXDemo/Main3.java b/ivyrodriguez/src/JavaFXDemo/Main3.java new file mode 100644 index 0000000..5c0d0b8 --- /dev/null +++ b/ivyrodriguez/src/JavaFXDemo/Main3.java @@ -0,0 +1,46 @@ +package sample; + +import javafx.application.Application; +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.layout.StackPane; +import javafx.stage.Stage; + +public class Main3 extends Application { + //Application is the class that inherits all the functionality + + Button button; + + public static void main(String[] args) { + launch(args); + //launch(args) is a method that is called once the main program starts and goes inside the application class + //it sets ups your javafx application + } + + @Override + public void start(Stage primaryStage) { + //the application will call a method called start, start is actually overridden because you are inheriting + //it from the application class. The start method passes in the primaryStage which is the main window for + //the application. + + primaryStage.setTitle("Title of the Window"); //sets the title of the window + button = new Button(); + button.setText("Click me"); + button.setOnAction(e -> { //e stands for the event handler + System.out.println("Hey now brown cow"); + System.out.println("I am a meatball"); + }); + + StackPane layout = new StackPane(); //create layout object of the StackPane class + layout.getChildren().add(button); //add button to the layout + + Scene scene = new Scene(layout, 300, 250); //Create scene of the Scene class, pass in layout object and hw + primaryStage.setScene(scene); //pass in scene object to set Scene of window + primaryStage.show(); //show the window + + } + +} + diff --git a/ivyrodriguez/src/JavaFXDemo/sample.fxml b/ivyrodriguez/src/JavaFXDemo/sample.fxml new file mode 100644 index 0000000..363237a --- /dev/null +++ b/ivyrodriguez/src/JavaFXDemo/sample.fxml @@ -0,0 +1,8 @@ + + + + + + + \ No newline at end of file From cfc3fe355006246877512dff38f66dc82fe31aa8 Mon Sep 17 00:00:00 2001 From: ivyrodriguez Date: Sat, 2 Jul 2016 09:43:08 -0700 Subject: [PATCH 02/33] JavaFX tutorials 1 through 3, branch teamwork --- ivyrodriguez/.idea/compiler.xml | 23 - .../.idea/copyright/profiles_settings.xml | 3 - ivyrodriguez/.idea/description.html | 2 - ivyrodriguez/.idea/encodings.xml | 5 - ivyrodriguez/.idea/gradle.xml | 7 - ivyrodriguez/.idea/misc.xml | 12 - ivyrodriguez/.idea/modules.xml | 8 - ivyrodriguez/.idea/uiDesigner.xml | 125 ---- ivyrodriguez/.idea/workspace.xml | 676 ------------------ ivyrodriguez/{src/JavaFXDemo => }/Main1.java | 6 +- ivyrodriguez/{src/JavaFXDemo => }/Main2.java | 2 +- ivyrodriguez/{src/JavaFXDemo => }/Main3.java | 6 +- ivyrodriguez/ivyrodriguez.iml | 12 - .../ivyrodriguez/JavaFXDemo/Controller.class | Bin 269 -> 0 bytes .../ivyrodriguez/JavaFXDemo/JavaFXDemo.fxml | 8 - .../ivyrodriguez/JavaFXDemo/Main1.class | Bin 1351 -> 0 bytes .../ivyrodriguez/JavaFXDemo/Main2.class | Bin 2089 -> 0 bytes .../ivyrodriguez/JavaFXDemo/Main3.class | Bin 2218 -> 0 bytes ivyrodriguez/src/JavaFXDemo/Controller.java | 4 - ivyrodriguez/src/JavaFXDemo/sample.fxml | 8 - 20 files changed, 4 insertions(+), 903 deletions(-) delete mode 100644 ivyrodriguez/.idea/compiler.xml delete mode 100644 ivyrodriguez/.idea/copyright/profiles_settings.xml delete mode 100644 ivyrodriguez/.idea/description.html delete mode 100644 ivyrodriguez/.idea/encodings.xml delete mode 100644 ivyrodriguez/.idea/gradle.xml delete mode 100644 ivyrodriguez/.idea/misc.xml delete mode 100644 ivyrodriguez/.idea/modules.xml delete mode 100644 ivyrodriguez/.idea/uiDesigner.xml delete mode 100644 ivyrodriguez/.idea/workspace.xml rename ivyrodriguez/{src/JavaFXDemo => }/Main1.java (94%) rename ivyrodriguez/{src/JavaFXDemo => }/Main2.java (99%) rename ivyrodriguez/{src/JavaFXDemo => }/Main3.java (95%) delete mode 100644 ivyrodriguez/ivyrodriguez.iml delete mode 100644 ivyrodriguez/out/production/ivyrodriguez/JavaFXDemo/Controller.class delete mode 100644 ivyrodriguez/out/production/ivyrodriguez/JavaFXDemo/JavaFXDemo.fxml delete mode 100644 ivyrodriguez/out/production/ivyrodriguez/JavaFXDemo/Main1.class delete mode 100644 ivyrodriguez/out/production/ivyrodriguez/JavaFXDemo/Main2.class delete mode 100644 ivyrodriguez/out/production/ivyrodriguez/JavaFXDemo/Main3.class delete mode 100644 ivyrodriguez/src/JavaFXDemo/Controller.java delete mode 100644 ivyrodriguez/src/JavaFXDemo/sample.fxml diff --git a/ivyrodriguez/.idea/compiler.xml b/ivyrodriguez/.idea/compiler.xml deleted file mode 100644 index 217af47..0000000 --- a/ivyrodriguez/.idea/compiler.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - diff --git a/ivyrodriguez/.idea/copyright/profiles_settings.xml b/ivyrodriguez/.idea/copyright/profiles_settings.xml deleted file mode 100644 index e7bedf3..0000000 --- a/ivyrodriguez/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/ivyrodriguez/.idea/description.html b/ivyrodriguez/.idea/description.html deleted file mode 100644 index cc10d56..0000000 --- a/ivyrodriguez/.idea/description.html +++ /dev/null @@ -1,2 +0,0 @@ -Simple JavaFX 2.0 application that includes simple .fxml file with attached controller and Main class to quick start. Artifact to build JavaFX application is provided. - \ No newline at end of file diff --git a/ivyrodriguez/.idea/encodings.xml b/ivyrodriguez/.idea/encodings.xml deleted file mode 100644 index e206d70..0000000 --- a/ivyrodriguez/.idea/encodings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/ivyrodriguez/.idea/gradle.xml b/ivyrodriguez/.idea/gradle.xml deleted file mode 100644 index 157a0c1..0000000 --- a/ivyrodriguez/.idea/gradle.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - diff --git a/ivyrodriguez/.idea/misc.xml b/ivyrodriguez/.idea/misc.xml deleted file mode 100644 index 2404a4c..0000000 --- a/ivyrodriguez/.idea/misc.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/ivyrodriguez/.idea/modules.xml b/ivyrodriguez/.idea/modules.xml deleted file mode 100644 index 116e16b..0000000 --- a/ivyrodriguez/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/ivyrodriguez/.idea/uiDesigner.xml b/ivyrodriguez/.idea/uiDesigner.xml deleted file mode 100644 index 3b00020..0000000 --- a/ivyrodriguez/.idea/uiDesigner.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ivyrodriguez/.idea/workspace.xml b/ivyrodriguez/.idea/workspace.xml deleted file mode 100644 index 8d6d8ee..0000000 --- a/ivyrodriguez/.idea/workspace.xml +++ /dev/null @@ -1,676 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - localhost - 5050 - - - - - - - - 1359379246138 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ivyrodriguez/src/JavaFXDemo/Main1.java b/ivyrodriguez/Main1.java similarity index 94% rename from ivyrodriguez/src/JavaFXDemo/Main1.java rename to ivyrodriguez/Main1.java index 4713c77..7093e67 100644 --- a/ivyrodriguez/src/JavaFXDemo/Main1.java +++ b/ivyrodriguez/Main1.java @@ -1,8 +1,6 @@ -package sample; +package JavaFXDemo; import javafx.application.Application; -import javafx.event.ActionEvent; -import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.StackPane; @@ -44,5 +42,3 @@ public void start(Stage primaryStage) throws Exception { } - - diff --git a/ivyrodriguez/src/JavaFXDemo/Main2.java b/ivyrodriguez/Main2.java similarity index 99% rename from ivyrodriguez/src/JavaFXDemo/Main2.java rename to ivyrodriguez/Main2.java index 23f5f86..b325e2a 100644 --- a/ivyrodriguez/src/JavaFXDemo/Main2.java +++ b/ivyrodriguez/Main2.java @@ -1,4 +1,4 @@ -package sample; +package JavaFXDemo; import javafx.application.Application; import javafx.event.ActionEvent; diff --git a/ivyrodriguez/src/JavaFXDemo/Main3.java b/ivyrodriguez/Main3.java similarity index 95% rename from ivyrodriguez/src/JavaFXDemo/Main3.java rename to ivyrodriguez/Main3.java index 5c0d0b8..65fb3c4 100644 --- a/ivyrodriguez/src/JavaFXDemo/Main3.java +++ b/ivyrodriguez/Main3.java @@ -1,8 +1,7 @@ -package sample; + +package JavaFXDemo; import javafx.application.Application; -import javafx.event.ActionEvent; -import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.StackPane; @@ -43,4 +42,3 @@ public void start(Stage primaryStage) { } } - diff --git a/ivyrodriguez/ivyrodriguez.iml b/ivyrodriguez/ivyrodriguez.iml deleted file mode 100644 index d5c0743..0000000 --- a/ivyrodriguez/ivyrodriguez.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/ivyrodriguez/out/production/ivyrodriguez/JavaFXDemo/Controller.class b/ivyrodriguez/out/production/ivyrodriguez/JavaFXDemo/Controller.class deleted file mode 100644 index 1a0efd475a3846ad55573e2c70260ef39678d3f4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 269 zcmZXO&5FW65QM8^el$kou20}iJ(!C(#f#u6=wTP{lQ`(en2|C1UVB>b-~;SKi5(I4 zU^f(9ReaEY_v;P77@ZI`v;wpP!~}n;3RTVswf - - - - - - \ No newline at end of file diff --git a/ivyrodriguez/out/production/ivyrodriguez/JavaFXDemo/Main1.class b/ivyrodriguez/out/production/ivyrodriguez/JavaFXDemo/Main1.class deleted file mode 100644 index 10534e25b8a8cc68a70a205f3e602d69db15fa45..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1351 zcmaJ>Yje{^6g`{RR-%Y7goMzf0h1Q+BOp?s4@^lQfkJT}5C#VLw3ZiJAWI%ehVZkP zDGqIBI(+6wb$WIkVu#lUUERHV?!D(eq!0i7^Dlr)*s?K=MH|QP(+Dowv|P6EvyChk zM``?J1i$LTZx*iDur<;~WeivGyM=4H<@i0L0J-I8*(f%~v81CcYjNGe4GSv*xmqVp zqflV3`dq%0&$ivfQ=xLbC`{uhaBrCF3V~Ps&`+-k3>S(I1u`p9T?rhn`k`9yv}!7T zAZr0F6V=F*!9yAQ`n+e%q)k5&7_TO>)ee-qCjD@cK{G8X0>=tZO?EesVZ+@@V?S(E zOcoh8=y&uB*8hlQU?hXw(vsKq&23M$Q$Gq53#&YDMV;7Fw|w0g+Z26XciF)VW*ywb zJZpR4r-8~x&+=(gwTRSX+Uq3`~5Io z?u1@*AZ348EFw{tXgeX-2Pbil6T^KT5%eBcvRr&Xu72o+p=YeU~lmK)j(cggMHbF^=N|b*BfwN#uDN zWypD2wDU#2d(Q7L)OWTS1eijG83zOWfFEgR7jcFN9pDWtqJTT)iQz6XrCnqn?;!UU zR_QNT6C+)W?!u;NY;Bll#rWfeNgSTUksTaeFQ4mTvfRZ~pTrq51sUha z_Xru!F!?-FU%*)`p@3BsaT{eru+$^5S0U*TQy|fKzKbZ4>=J)?Wh}6H=NL7^yYqZp I>O;8jKSW74w*UYD diff --git a/ivyrodriguez/out/production/ivyrodriguez/JavaFXDemo/Main2.class b/ivyrodriguez/out/production/ivyrodriguez/JavaFXDemo/Main2.class deleted file mode 100644 index 7bc32f52fd76728b0f595f5512fc15c70fbaecd9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2089 zcmaJ?Yg-#d6n+O1mTb0w5NH9xfL237yIQ^LJT|j zsvo;L_VBfaeQEKjhG!bS(eN!pU$G&C?=ei}4y|MB;MAY&iS_G?plE(&n;m@RGd1)K(208Yc4l8 zEyue@pphzV7{*f1ly%d!ys}vkf#a34%8C_~>D|ant{I|rVFiNWX6llepWGAL7*6!|gtgt=l%rFFSiM59W~Fmb`)x*Ed`#bnc}wSwCAJJfE&#R^W@ zvqU2x(|Z??R;}hbwj~XlEA4&u;=Tjqk)j)q8n88|>$L&boDLn_EFWtA$)@W_CRssT@O^-2{J)wHq&U zv08E5QoyN|Z>Q!is>b$Rm#adroB3j$2ghb%jNRZjN zr_?K##KMWSZ4m*HU0aibLprQd-8CLMnpI7gdc{9sh>-(fDN|#&=!fBHSz{P#$GmV> z7raX3)W{fB&YF&IZqv{bG`hG|CHKN4b&DA^nn#{+Jttx?)j}T5a;5My&N;rVGX>WuIcn2vu#W067N#x@N`i75xM^F2)P9VS-A{g%i z$Y7r240mvsG$g=Z&`1k-k{Rx8B9eZN=>9qSeuI|&720rr6EV3-H=#dAoUV+``6g~i z*&i6_!QOKW?$0MMl)&&g5?h%&O^jxm7;BSBLni|>B@NIyb%AJUKdk5=i_KIzB+B#6jO zN%behf5ENc@g^oDuU-}50s4Xv*eC`jvTk_^ehW;gCmfcWa) zq(_66b3FR1$G^$ro!OKm1$+Eq=W*xWJKz28y|aJ)^Xzv3Gk9uX6n720hWDaK8@Pw} zb=)`5jk`T0{2+>1xtSXv?GNQ@QOA-2Q`(sLs29t~>R5@)`hSoH5SjI6)xtmwtJ2?^ z9M*gAF+Pc6!@wpUMX{x0TgRswBDty%o~vOryT=aL?vWMbxy!A*=L+9*ta){uCdGTU zYm56DI+GJy8oDxGfotf`+Ad$MmUG?=*tGITyeOy z!fbb%oOYFIq2WUEiMri#m|L_qgm1gWw7P})MY0<_=U78`Aeb*STuh!q7p%z1oHtCFLur{{`-P%Pc$_t%-r32(O|r`40v+>j$3_c^SbE3k0| zZ2S(9dJ2sna93D!d0~6*1G!cJH6m=}`K@PFG#DFR)z9;XwxrfjwB43@GLgWTi5(<~ zolRRfJmKvoM2RQ1ZMWbZ>UeD82|m+s`6X#JaRpa3L^F<^-%pgeiO;1;Y~J%kAbeI? z;iBXfg8m4;h~Z0`zKUVS1Vhe59t8@p&HIatnc&#fQ8ZD4O{LMMtVok_?3vhyW1@^P z9j*xv6%Fx4UQ4*%VIt>yhi)P-L;Bi;FY)y+C0IGZ2rv^l<~SP6*1FPgrEw9fR46hg zIk)DTYnAe&%uu zQH>pxyhExq38g`9EfBm+H>*}0Ry0|*XRXs?Am~ZptW4Mkl|j2$gHCW!Jt#DG(V8A88n4mLqFJ7Gr;efhNQ(}0pfJiP@97Zq)4t|5>pKae?liM;L+qjXB}Os z6Ljw!Bk~LM)X&fdqILAh#WNT{9la+o>G+kEsXF?k{5SM>VEY8Iov9(jhcI}I;nm4o zbzGRN<6;v~O4<_<5uzeaG>i}tHwfBois>H3vrG}KV}gFalL~Mu1l5R`;NceOYV_SC z!tPLb%jEG5yot`3A?vvjPKHh-AMu~?>cFKsM&x{%<|dRrbdo{>QOZD!NNf@u$6I)t i&N}f9jU9Lw-_UH3!y|l$8ZKd;_A(h6(pkU*Jp30ud^D{9 diff --git a/ivyrodriguez/src/JavaFXDemo/Controller.java b/ivyrodriguez/src/JavaFXDemo/Controller.java deleted file mode 100644 index 54e5bd1..0000000 --- a/ivyrodriguez/src/JavaFXDemo/Controller.java +++ /dev/null @@ -1,4 +0,0 @@ -package sample; - -public class Controller { -} diff --git a/ivyrodriguez/src/JavaFXDemo/sample.fxml b/ivyrodriguez/src/JavaFXDemo/sample.fxml deleted file mode 100644 index 363237a..0000000 --- a/ivyrodriguez/src/JavaFXDemo/sample.fxml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file From 3985bb0b63581e78e9c186498123b2ead531cee5 Mon Sep 17 00:00:00 2001 From: Rony Alvarez Date: Sun, 3 Jul 2016 02:46:32 -0400 Subject: [PATCH 03/33] Tutorial 1, creating a basic window added --- .../1_creatingABasicWindow/Main.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 ronyalvarez/MyJavaFXStudies/1_creatingABasicWindow/Main.java diff --git a/ronyalvarez/MyJavaFXStudies/1_creatingABasicWindow/Main.java b/ronyalvarez/MyJavaFXStudies/1_creatingABasicWindow/Main.java new file mode 100644 index 0000000..243a523 --- /dev/null +++ b/ronyalvarez/MyJavaFXStudies/1_creatingABasicWindow/Main.java @@ -0,0 +1,27 @@ +import javafx.application.Application; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.layout.StackPane; +import javafx.stage.Stage; + +public class Main extends Application { + + Button button; + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws Exception { + primaryStage.setTitle("JavaFX - Rony Alvarez"); + button = new Button("Click me!"); + + StackPane layout = new StackPane(); + layout.getChildren().add(button); + + Scene scene = new Scene(layout, 300, 250); + primaryStage.setScene(scene); + primaryStage.show(); + } +} From 895b8414122fcb303c7aba5fd2438bf64cd11458 Mon Sep 17 00:00:00 2001 From: Rony Alvarez Date: Sun, 3 Jul 2016 03:02:25 -0400 Subject: [PATCH 04/33] Tutorial 2, handling user events added --- .../2_handleUserEvents/Main.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 ronyalvarez/MyJavaFXStudies/2_handleUserEvents/Main.java diff --git a/ronyalvarez/MyJavaFXStudies/2_handleUserEvents/Main.java b/ronyalvarez/MyJavaFXStudies/2_handleUserEvents/Main.java new file mode 100644 index 0000000..94a3361 --- /dev/null +++ b/ronyalvarez/MyJavaFXStudies/2_handleUserEvents/Main.java @@ -0,0 +1,39 @@ +import javafx.application.Application; +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.layout.StackPane; +import javafx.stage.Stage; + +public class Main extends Application implements EventHandler { + + Button button; + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws Exception { + primaryStage.setTitle("JavaFX - Rony Alvarez"); + button = new Button("Click me!"); + button.setOnAction(this); + + StackPane layout = new StackPane(); + layout.getChildren().add(button); + + Scene scene = new Scene(layout, 300, 250); + primaryStage.setScene(scene); + primaryStage.show(); + } + + @Override + public void handle(ActionEvent event) { + + if(event.getSource() == button) { + System.out.println("Button Clicked!"); + } + + } +} From 449aac1b0c6bad56e93fc1f1ec92cee5465f8928 Mon Sep 17 00:00:00 2001 From: Eric Schmitt Date: Mon, 4 Jul 2016 13:06:11 -0400 Subject: [PATCH 05/33] JavaFX Tutorials --- .../Tutorial10/JavaFXDemo10.java | 0 .../Tutorial11-12/JavaFXDemo11.java | 0 .../Tutorial13/JavaFXDemo13.java | 0 .../Tutorial14/JavaFXDemo14.java | 0 .../Tutorial15/JavaFXDemo15.java | 0 .../Tutorial17-20/JavaFXDemo17.java | 119 ++++++++++++++++++ .../Tutorial17-20/Product.java | 50 ++++++++ 7 files changed, 169 insertions(+) rename ericaschmitt/JavaFXTutorials/{Tutorials 10-19 => Tutorials 10-20}/Tutorial10/JavaFXDemo10.java (100%) rename ericaschmitt/JavaFXTutorials/{Tutorials 10-19 => Tutorials 10-20}/Tutorial11-12/JavaFXDemo11.java (100%) rename ericaschmitt/JavaFXTutorials/{Tutorials 10-19 => Tutorials 10-20}/Tutorial13/JavaFXDemo13.java (100%) rename ericaschmitt/JavaFXTutorials/{Tutorials 10-19 => Tutorials 10-20}/Tutorial14/JavaFXDemo14.java (100%) rename ericaschmitt/JavaFXTutorials/{Tutorials 10-19 => Tutorials 10-20}/Tutorial15/JavaFXDemo15.java (100%) create mode 100644 ericaschmitt/JavaFXTutorials/Tutorials 10-20/Tutorial17-20/JavaFXDemo17.java create mode 100644 ericaschmitt/JavaFXTutorials/Tutorials 10-20/Tutorial17-20/Product.java diff --git a/ericaschmitt/JavaFXTutorials/Tutorials 10-19/Tutorial10/JavaFXDemo10.java b/ericaschmitt/JavaFXTutorials/Tutorials 10-20/Tutorial10/JavaFXDemo10.java similarity index 100% rename from ericaschmitt/JavaFXTutorials/Tutorials 10-19/Tutorial10/JavaFXDemo10.java rename to ericaschmitt/JavaFXTutorials/Tutorials 10-20/Tutorial10/JavaFXDemo10.java diff --git a/ericaschmitt/JavaFXTutorials/Tutorials 10-19/Tutorial11-12/JavaFXDemo11.java b/ericaschmitt/JavaFXTutorials/Tutorials 10-20/Tutorial11-12/JavaFXDemo11.java similarity index 100% rename from ericaschmitt/JavaFXTutorials/Tutorials 10-19/Tutorial11-12/JavaFXDemo11.java rename to ericaschmitt/JavaFXTutorials/Tutorials 10-20/Tutorial11-12/JavaFXDemo11.java diff --git a/ericaschmitt/JavaFXTutorials/Tutorials 10-19/Tutorial13/JavaFXDemo13.java b/ericaschmitt/JavaFXTutorials/Tutorials 10-20/Tutorial13/JavaFXDemo13.java similarity index 100% rename from ericaschmitt/JavaFXTutorials/Tutorials 10-19/Tutorial13/JavaFXDemo13.java rename to ericaschmitt/JavaFXTutorials/Tutorials 10-20/Tutorial13/JavaFXDemo13.java diff --git a/ericaschmitt/JavaFXTutorials/Tutorials 10-19/Tutorial14/JavaFXDemo14.java b/ericaschmitt/JavaFXTutorials/Tutorials 10-20/Tutorial14/JavaFXDemo14.java similarity index 100% rename from ericaschmitt/JavaFXTutorials/Tutorials 10-19/Tutorial14/JavaFXDemo14.java rename to ericaschmitt/JavaFXTutorials/Tutorials 10-20/Tutorial14/JavaFXDemo14.java diff --git a/ericaschmitt/JavaFXTutorials/Tutorials 10-19/Tutorial15/JavaFXDemo15.java b/ericaschmitt/JavaFXTutorials/Tutorials 10-20/Tutorial15/JavaFXDemo15.java similarity index 100% rename from ericaschmitt/JavaFXTutorials/Tutorials 10-19/Tutorial15/JavaFXDemo15.java rename to ericaschmitt/JavaFXTutorials/Tutorials 10-20/Tutorial15/JavaFXDemo15.java diff --git a/ericaschmitt/JavaFXTutorials/Tutorials 10-20/Tutorial17-20/JavaFXDemo17.java b/ericaschmitt/JavaFXTutorials/Tutorials 10-20/Tutorial17-20/JavaFXDemo17.java new file mode 100644 index 0000000..82bc389 --- /dev/null +++ b/ericaschmitt/JavaFXTutorials/Tutorials 10-20/Tutorial17-20/JavaFXDemo17.java @@ -0,0 +1,119 @@ +package javafxdemo17; + +import javafx.application.Application; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.TableColumn; +import javafx.scene.control.TableView; +import javafx.scene.control.TextField; +import javafx.scene.control.cell.PropertyValueFactory; +import javafx.scene.layout.HBox; +import javafx.scene.layout.VBox; +import javafx.stage.Stage; + +public class JavaFXDemo17 extends Application{ + + Stage window; + TableView table; + TextField nameInput, priceInput, quantityInput; + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws Exception{ + window = primaryStage; + window.setTitle("thenewboston - JavaFX"); + + //NameColum + TableColumn nameColumn = new TableColumn("Name"); + nameColumn.setMinWidth(200); + nameColumn.setCellValueFactory(new PropertyValueFactory<>("name")); + + //NameColum + TableColumn priceColumn = new TableColumn("Price"); + priceColumn.setMinWidth(100); + priceColumn.setCellValueFactory(new PropertyValueFactory<>("Price")); + + //NameColum + TableColumn quantityColumn = new TableColumn("Quantity"); + quantityColumn.setMinWidth(100); + quantityColumn.setCellValueFactory(new PropertyValueFactory<>("Quantity")); + + //inputs + //nameInput + nameInput = new TextField(); + nameInput.setPromptText("Name"); + nameInput.setMinWidth(100); + + //priceInput + priceInput = new TextField(); + priceInput.setPromptText("Price"); + + //quantityInput + quantityInput = new TextField(); + quantityInput.setPromptText("Quantity"); + + //Button + Button add = new Button("Add"); + add.setOnAction(e -> addButtonClicked()); + Button delete = new Button("Delete"); + delete.setOnAction(e -> deleteButtonClicked()); + + //HBox + HBox hBox = new HBox(); + hBox.setPadding(new Insets(10, 10, 10, 10)); + hBox.setSpacing(10); + hBox.getChildren().addAll(nameInput, priceInput, quantityInput, add, delete); + + //table + table = new TableView<>(); + table.setItems(getProduct()); + table.getColumns().addAll(nameColumn, priceColumn, quantityColumn); + + VBox vBox = new VBox(); + vBox.getChildren().addAll(table, hBox); + + Scene scene = new Scene(vBox); + window.setScene(scene); + window.show(); + } + + //get all of the products + public ObservableList getProduct(){ + ObservableList products = FXCollections.observableArrayList(); + products.add(new Product("Laptop", 859.00, 20)); + products.add(new Product("Bouncy Ball", 2.49, 198)); + products.add(new Product("Toilet", 99.00, 74)); + products.add(new Product("The Notebook DVD", 19.99, 12)); + products.add(new Product("Corn", 1.49, 846)); + + return products; + } + + public void addButtonClicked(){ + Product product = new Product(); + product.setName(nameInput.getText()); + product.setPrice(Double.parseDouble(priceInput.getText())); + product.setQuantity(Integer.parseInt(quantityInput.getText())); + + table.getItems().add(product); + nameInput.clear(); + priceInput.clear(); + quantityInput.clear(); + } + + public void deleteButtonClicked(){ + ObservableList productSelected, allProducts; + allProducts = table.getItems(); + productSelected = table.getSelectionModel().getSelectedItems(); + + productSelected.forEach(allProducts::remove); + } +} + + diff --git a/ericaschmitt/JavaFXTutorials/Tutorials 10-20/Tutorial17-20/Product.java b/ericaschmitt/JavaFXTutorials/Tutorials 10-20/Tutorial17-20/Product.java new file mode 100644 index 0000000..9647201 --- /dev/null +++ b/ericaschmitt/JavaFXTutorials/Tutorials 10-20/Tutorial17-20/Product.java @@ -0,0 +1,50 @@ +package javafxdemo17; + +public class Product { + private String name; + private double price; + private int quantity; + + public Product(){ + this.name = ""; + this.price = 0; + this.quantity = 0; + } + + public Product(String name, double price, int quantity){ + this.name = name; + this.price = price; + this.quantity = quantity; + + } + + //getters + public String getName() { + return name; + } + + public double getPrice() { + return price; + } + + public int getQuantity() { + return quantity; + } + + //setters + public void setName(String name) { + this.name = name; + } + + public void setPrice(double price) { + this.price = price; + } + + public void setQuantity(int quantity) { + this.quantity = quantity; + } + + + + +} From bc886feccfded0e7a7c206e0c592f6204b470fe3 Mon Sep 17 00:00:00 2001 From: Mark Caruso Date: Tue, 5 Jul 2016 12:14:18 -0400 Subject: [PATCH 06/33] Added 4 FX Tutorials - Clossing Windows Properly, Communication Between Windows, Embedding Layouts and GridPane Layout --- .../f_FXClosingProperly/src/ConfirmBox.java | 45 ++++++++++++++ .../f_FXClosingProperly/src/Main.java | 45 ++++++++++++++ .../src/ConfirmBox.java | 45 ++++++++++++++ .../g_FXCommBetweenWindows/src/Main.java | 37 ++++++++++++ .../src/EmbeddingLayouts.java | 45 ++++++++++++++ .../mc_FXStudies/i_FXGridPane/src/Main.java | 59 +++++++++++++++++++ 6 files changed, 276 insertions(+) create mode 100644 mcaruso/mc_FXStudies/f_FXClosingProperly/src/ConfirmBox.java create mode 100644 mcaruso/mc_FXStudies/f_FXClosingProperly/src/Main.java create mode 100644 mcaruso/mc_FXStudies/g_FXCommBetweenWindows/src/ConfirmBox.java create mode 100644 mcaruso/mc_FXStudies/g_FXCommBetweenWindows/src/Main.java create mode 100644 mcaruso/mc_FXStudies/h_FXEmbeddingLayouts/src/EmbeddingLayouts.java create mode 100644 mcaruso/mc_FXStudies/i_FXGridPane/src/Main.java diff --git a/mcaruso/mc_FXStudies/f_FXClosingProperly/src/ConfirmBox.java b/mcaruso/mc_FXStudies/f_FXClosingProperly/src/ConfirmBox.java new file mode 100644 index 0000000..c515d77 --- /dev/null +++ b/mcaruso/mc_FXStudies/f_FXClosingProperly/src/ConfirmBox.java @@ -0,0 +1,45 @@ +import javafx.geometry.Pos; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.layout.VBox; +import javafx.stage.Modality; +import javafx.stage.Stage; + +public class ConfirmBox { + static boolean answer; + + public static boolean display(String title, String msg){ + Stage window = new Stage(); + window.initModality(Modality.APPLICATION_MODAL); + window.setTitle(title); + window.setMinWidth(250); + Label label = new Label(); + label.setText(msg); + + //create two buttons + Button yesButton = new Button("Yes"); + Button noButton = new Button("No"); + + yesButton.setOnAction( e -> { + answer = true; + window.close(); + }); + + noButton.setOnAction( e -> { + answer = false; + window.close(); + }); + + VBox layout = new VBox(20); + layout.getChildren().addAll(label, yesButton, noButton); + layout.setAlignment(Pos.CENTER); + + Scene scene = new Scene(layout, 300, 400); + window.setScene(scene); + window.showAndWait(); + + return answer; + + } +} diff --git a/mcaruso/mc_FXStudies/f_FXClosingProperly/src/Main.java b/mcaruso/mc_FXStudies/f_FXClosingProperly/src/Main.java new file mode 100644 index 0000000..22c697b --- /dev/null +++ b/mcaruso/mc_FXStudies/f_FXClosingProperly/src/Main.java @@ -0,0 +1,45 @@ +import javafx.application.Application; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.layout.StackPane; +import javafx.stage.Stage; + +public class Main extends Application{ + Stage window; + Button btn; + public static void main(String[] args) { + launch(args); + + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("Closing Properly"); + window.setOnCloseRequest( e -> { + //prevent default close event + e.consume(); + //implement our own close logic + closeProgram(); + }); + + btn = new Button("Close Program"); + btn.setOnAction(e -> closeProgram()); + + StackPane layout = new StackPane(); + layout.getChildren().add(btn); + + Scene scene = new Scene(layout, 300, 260); + + window.setScene(scene); + window.show(); + + } + + private void closeProgram(){ + boolean answer = ConfirmBox.display("Confirm", "Are you sure you want to exit?"); + if(answer) + window.close(); + } + +} diff --git a/mcaruso/mc_FXStudies/g_FXCommBetweenWindows/src/ConfirmBox.java b/mcaruso/mc_FXStudies/g_FXCommBetweenWindows/src/ConfirmBox.java new file mode 100644 index 0000000..c515d77 --- /dev/null +++ b/mcaruso/mc_FXStudies/g_FXCommBetweenWindows/src/ConfirmBox.java @@ -0,0 +1,45 @@ +import javafx.geometry.Pos; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.layout.VBox; +import javafx.stage.Modality; +import javafx.stage.Stage; + +public class ConfirmBox { + static boolean answer; + + public static boolean display(String title, String msg){ + Stage window = new Stage(); + window.initModality(Modality.APPLICATION_MODAL); + window.setTitle(title); + window.setMinWidth(250); + Label label = new Label(); + label.setText(msg); + + //create two buttons + Button yesButton = new Button("Yes"); + Button noButton = new Button("No"); + + yesButton.setOnAction( e -> { + answer = true; + window.close(); + }); + + noButton.setOnAction( e -> { + answer = false; + window.close(); + }); + + VBox layout = new VBox(20); + layout.getChildren().addAll(label, yesButton, noButton); + layout.setAlignment(Pos.CENTER); + + Scene scene = new Scene(layout, 300, 400); + window.setScene(scene); + window.showAndWait(); + + return answer; + + } +} diff --git a/mcaruso/mc_FXStudies/g_FXCommBetweenWindows/src/Main.java b/mcaruso/mc_FXStudies/g_FXCommBetweenWindows/src/Main.java new file mode 100644 index 0000000..c0fb88d --- /dev/null +++ b/mcaruso/mc_FXStudies/g_FXCommBetweenWindows/src/Main.java @@ -0,0 +1,37 @@ +import javafx.application.Application; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.layout.StackPane; +import javafx.stage.Stage; + +public class Main extends Application{ + Stage window; + Button btn; + public static void main(String[] args) { + launch(args); + + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("Window 1"); + + btn = new Button(); + btn.setText("Click Here"); + btn.setOnAction( e -> { + boolean result = ConfirmBox.display("Confirm Box","Are you sure you want a Burger?"); + System.out.println("The result from Confirm Box is : " + result ); + }); + + + StackPane layout = new StackPane(); + layout.getChildren().add(btn); + + Scene scene = new Scene(layout, 400, 300); + window.setScene(scene); + window.show(); + + } + +} diff --git a/mcaruso/mc_FXStudies/h_FXEmbeddingLayouts/src/EmbeddingLayouts.java b/mcaruso/mc_FXStudies/h_FXEmbeddingLayouts/src/EmbeddingLayouts.java new file mode 100644 index 0000000..de37cbd --- /dev/null +++ b/mcaruso/mc_FXStudies/h_FXEmbeddingLayouts/src/EmbeddingLayouts.java @@ -0,0 +1,45 @@ +import javafx.application.Application; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.layout.BorderPane; +import javafx.scene.layout.HBox; +import javafx.scene.layout.VBox; +import javafx.stage.Stage; + +public class EmbeddingLayouts extends Application{ + + Stage window; + public static void main(String[] args) { + launch(args); + + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("Main Window"); + + HBox topMenu = new HBox(); + Button btn1 = new Button("Title"); + Button btn2 = new Button("Edit"); + Button btn3 = new Button("View"); + topMenu.getChildren().addAll(btn1, btn2, btn3); + + VBox leftMenu = new VBox(); + Button btn4 = new Button("Project1"); + Button btn5 = new Button("Project2"); + Button btn6 = new Button("Project3"); + leftMenu.getChildren().addAll(btn4, btn5, btn6); + + BorderPane borderPane = new BorderPane(); + borderPane.setTop(topMenu); + borderPane.setLeft(leftMenu); + + Scene scene = new Scene(borderPane, 300,200); + + window.setScene(scene); + window.show(); + + } + +}//End of Class diff --git a/mcaruso/mc_FXStudies/i_FXGridPane/src/Main.java b/mcaruso/mc_FXStudies/i_FXGridPane/src/Main.java new file mode 100644 index 0000000..cb2dcb4 --- /dev/null +++ b/mcaruso/mc_FXStudies/i_FXGridPane/src/Main.java @@ -0,0 +1,59 @@ +import javafx.application.Application; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import javafx.scene.layout.GridPane; +import javafx.stage.Stage; + +public class Main extends Application{ + + Stage window; + public static void main(String[] args) { + launch(args); + + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("GridPane Sample"); + + GridPane grid = new GridPane(); + //padding between window and grid + grid.setPadding(new Insets(10)); + //padding in between cells + grid.setVgap(8); + grid.setHgap(10); + + Label titleLabel = new Label("Log In Form"); + GridPane.setConstraints(titleLabel, 1, 0); + Label userLabel = new Label("User:"); + GridPane.setConstraints(userLabel, 0, 1); + TextField userText = new TextField("Bobby"); + GridPane.setConstraints(userText, 1, 1); + + + + Label passLabel = new Label("Password:"); + GridPane.setConstraints(passLabel, 0, 2); + TextField passText = new TextField(); + passText.setPromptText("Enter Password"); + GridPane.setConstraints(passText, 1, 2); + + Button login = new Button("Log in"); + GridPane.setConstraints(login, 1, 3); + + grid.getChildren().addAll(titleLabel, userLabel, userText, passLabel, + passText, login); + Scene scene = new Scene(grid, 300, 200); + window.setScene(scene); + window.show(); + + + + + } + +}// EndofClass From 3b1309c5e60131c03888605a7d3e5b3cf37cc6e5 Mon Sep 17 00:00:00 2001 From: ivyrodriguez Date: Tue, 5 Jul 2016 18:43:12 -0700 Subject: [PATCH 07/33] Tutorials 4 through 6 --- ivyrodriguez/AlertBox.java | 36 ++++++++++++++++++++++ ivyrodriguez/ConfirmBox.java | 47 ++++++++++++++++++++++++++++ ivyrodriguez/Main4.java | 59 ++++++++++++++++++++++++++++++++++++ ivyrodriguez/Main5.java | 46 ++++++++++++++++++++++++++++ ivyrodriguez/Main6.java | 50 ++++++++++++++++++++++++++++++ 5 files changed, 238 insertions(+) create mode 100644 ivyrodriguez/AlertBox.java create mode 100644 ivyrodriguez/ConfirmBox.java create mode 100644 ivyrodriguez/Main4.java create mode 100644 ivyrodriguez/Main5.java create mode 100644 ivyrodriguez/Main6.java diff --git a/ivyrodriguez/AlertBox.java b/ivyrodriguez/AlertBox.java new file mode 100644 index 0000000..0eb2020 --- /dev/null +++ b/ivyrodriguez/AlertBox.java @@ -0,0 +1,36 @@ +package JavaFXDemo; + +import javafx.stage.*; +import javafx.scene.*; +import javafx.scene.layout.*; +import javafx.scene.control.*; +import javafx.geometry.*; + +//AlertBox displays message to the user +public class AlertBox { + + public static void display(String title, String message){ + Stage window = new Stage(); + + window.initModality(Modality.APPLICATION_MODAL);//doesn't allow user to interact with other window until + //finished with this one + window.setTitle(title); + window.setMinWidth(250); + + Label label = new Label(); + label.setText(message);//will set the message to the message you pass in + Button closeButton = new Button("Close the window"); + closeButton.setOnAction(e -> window.close()); + + VBox layout = new VBox(10); + layout.getChildren().addAll(label, closeButton); + layout.setAlignment(Pos.CENTER); + + Scene scene = new Scene(layout); + window.setScene(scene); + window.showAndWait();//goes together with Modality, doesn't let user interact with other window until this one + //is closed + } + + +} diff --git a/ivyrodriguez/ConfirmBox.java b/ivyrodriguez/ConfirmBox.java new file mode 100644 index 0000000..8487e93 --- /dev/null +++ b/ivyrodriguez/ConfirmBox.java @@ -0,0 +1,47 @@ +package JavaFXDemo; + +import javafx.stage.*; +import javafx.scene.*; +import javafx.scene.layout.*; +import javafx.scene.control.*; +import javafx.geometry.*; + +//Confirm Box allows the Main5 window and ConfirmBox window to interact with each other. It gets input from the user +//and passes it to the main program + +public class ConfirmBox { + static boolean answer; + + public static boolean display(String title, String message){ + Stage window = new Stage(); + window.initModality(Modality.APPLICATION_MODAL); + window.setTitle(title); + window.setMinWidth(250); + Label label = new Label(); + label.setText(message); + + //Create two buttons + Button yesButton = new Button("Yes"); + Button noButton = new Button("No"); + + yesButton.setOnAction(e -> { + answer = true; + window.close(); + }); + noButton.setOnAction(e -> { + answer = false; + window.close(); + }); + + VBox layout = new VBox(10); + layout.getChildren().addAll(label, yesButton, noButton); + layout.setAlignment(Pos.CENTER); + Scene scene = new Scene(layout); + window.setScene(scene); + window.showAndWait(); + + return answer; + } + + +} diff --git a/ivyrodriguez/Main4.java b/ivyrodriguez/Main4.java new file mode 100644 index 0000000..1393eab --- /dev/null +++ b/ivyrodriguez/Main4.java @@ -0,0 +1,59 @@ +package JavaFXDemo; + +import javafx.application.Application; +import javafx.scene.Scene; //scene is another view of the content inside the window +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.layout.VBox; +import javafx.scene.layout.StackPane; +import javafx.stage.Stage; + +public class Main4 extends Application { + //Application is the class that inherits all the functionality + + Stage window; + Scene scene1, scene2; + + public static void main(String[] args) { + launch(args); + //launch(args) is a method that is called once the main program starts and goes inside the application class + //it sets ups your javafx application + } + + @Override + public void start(Stage primaryStage) { + //the application will call a method called start, start is actually overridden because you are inheriting + //it from the application class. The start method passes in the primaryStage which is the main window for + //the application. + + window = primaryStage; + Label label1 =new Label("Welcome to the first scene"); + Button button1 = new Button("Go to scene2"); + button1.setOnAction(e -> window.setScene(scene2)); + + //Layout 1 - Children are laid out in vertical columns, stacked on top of + + VBox layout1 = new VBox(20); //columns are seperated by 20 pixels + layout1.getChildren().addAll(label1, button1); + scene1 = new Scene(layout1, 200, 200); + + //Button 2 + + Button button2 = new Button("Go back to scene1"); + button2.setOnAction(e -> window.setScene(scene1)); + + //Layout 2 + + StackPane layout2 = new StackPane(); + layout2.getChildren().add(button2); + scene2 = new Scene(layout2, 600, 300); + + window.setScene(scene1); + window.setTitle("Title here"); + window.show(); + + + + } + +} diff --git a/ivyrodriguez/Main5.java b/ivyrodriguez/Main5.java new file mode 100644 index 0000000..72dccbb --- /dev/null +++ b/ivyrodriguez/Main5.java @@ -0,0 +1,46 @@ +package JavaFXDemo; + +import javafx.application.Application; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.layout.StackPane; +import javafx.stage.Stage; + +/** + * Created by ivelisse on 6/27/2016. + */ +public class Main5 extends Application { + //Application is the class that inherits all the functionality + + Stage window; + Button button; + + public static void main(String[] args) { + launch(args); + //launch(args) is a method that is called once the main program starts and goes inside the application class + //it sets ups your javafx application + } + + @Override + public void start(Stage primaryStage){ + //the application will call a method called start, start is actually overridden because you are inheriting + //it from the application class. The start method passes in the primaryStage which is the main window for + //the application. + + window = primaryStage; + window.setTitle("thenewboston"); //sets the title of the window + button = new Button("Click Me"); + button.setOnAction(e -> AlertBox.display("Title of Window", "This is awesome")); + + StackPane layout = new StackPane(); //create layout object of the StackPane class + layout.getChildren().add(button); //add button to the layout + + Scene scene = new Scene(layout, 300, 250); //Create scene of the Scene class, pass in layout object and hw + window.setScene(scene); //pass in scene object to set Scene of window + window.show(); //show the window + + } + +} + + diff --git a/ivyrodriguez/Main6.java b/ivyrodriguez/Main6.java new file mode 100644 index 0000000..11aef36 --- /dev/null +++ b/ivyrodriguez/Main6.java @@ -0,0 +1,50 @@ +package JavaFXDemo; + +import javafx.application.Application; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.layout.StackPane; +import javafx.stage.Stage; + +/** + * Created by ivelisse on 6/27/2016. + */ +public class Main6 extends Application { + //Application is the class that inherits all the functionality + + Stage window; + Button button; + + public static void main(String[] args) { + launch(args); + //launch(args) is a method that is called once the main program starts and goes inside the application class + //it sets ups your javafx application + } + + @Override + public void start(Stage primaryStage){ + //the application will call a method called start, start is actually overridden because you are inheriting + //it from the application class. The start method passes in the primaryStage which is the main window for + //the application. + + window = primaryStage; + window.setTitle("thenewboston"); //sets the title of the window + button = new Button("Click Me"); + button.setOnAction(e -> { + boolean result = ConfirmBox.display("Title of Window", "Are you sure you want to send nake pics?"); + System.out.println(result); + }); + + StackPane layout = new StackPane(); //create layout object of the StackPane class + layout.getChildren().add(button); //add button to the layout + + Scene scene = new Scene(layout, 300, 250); //Create scene of the Scene class, pass in layout object and hw + window.setScene(scene); //pass in scene object to set Scene of window + window.show(); //show the window + + } + +} + + + From e27fbde64745afc9668a366b2af053f723b3c411 Mon Sep 17 00:00:00 2001 From: Mark Caruso Date: Wed, 6 Jul 2016 00:04:35 -0400 Subject: [PATCH 08/33] Added FX Tutorial Extracting and Validating Input --- .../j_FXExtractAndValidate/src/Main.java | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 mcaruso/mc_FXStudies/j_FXExtractAndValidate/src/Main.java diff --git a/mcaruso/mc_FXStudies/j_FXExtractAndValidate/src/Main.java b/mcaruso/mc_FXStudies/j_FXExtractAndValidate/src/Main.java new file mode 100644 index 0000000..db85c4d --- /dev/null +++ b/mcaruso/mc_FXStudies/j_FXExtractAndValidate/src/Main.java @@ -0,0 +1,55 @@ +import javafx.application.Application; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.TextField; +import javafx.scene.layout.VBox; +import javafx.stage.Stage; + +public class Main extends Application{ + + Stage window; + Scene scene; + Button btn; + public static void main(String[] args) { + launch(args); + + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("Getting Input"); + + TextField nameInput = new TextField(); + btn = new Button("Click Here"); + btn.setOnAction( e -> isInt(nameInput, nameInput.getText())); + + VBox layout = new VBox(); + layout.setPadding(new Insets(20, 20, 20, 20)); + layout.getChildren().addAll(nameInput, btn); + + scene = new Scene(layout, 300, 200); + + window.setScene(scene); + window.show(); + } + + // sample validation method + private boolean isInt( TextField input, String message){ + + try{ + int age = Integer.parseInt(input.getText()); + System.out.println("Users age is: " + age); + return true; + }catch(NumberFormatException e){ + System.out.println("Error: " + message + " is not a number"); + return false; + } + + + } + + + +}//EndOfMain From 4040e006b156e9d94508d7f0b3b8f011de074ae3 Mon Sep 17 00:00:00 2001 From: Mark Caruso Date: Wed, 6 Jul 2016 19:50:34 -0400 Subject: [PATCH 09/33] Added two FX Tutorials - CheckBox and ChoiceBox --- .../j_FXCheckBoxInput/src/CheckBoxInput.java | 62 ++++++++++++++++ .../mc_FXStudies/k_FXChoiceBox/src/Main.java | 70 +++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 mcaruso/mc_FXStudies/j_FXCheckBoxInput/src/CheckBoxInput.java create mode 100644 mcaruso/mc_FXStudies/k_FXChoiceBox/src/Main.java diff --git a/mcaruso/mc_FXStudies/j_FXCheckBoxInput/src/CheckBoxInput.java b/mcaruso/mc_FXStudies/j_FXCheckBoxInput/src/CheckBoxInput.java new file mode 100644 index 0000000..5d7d532 --- /dev/null +++ b/mcaruso/mc_FXStudies/j_FXCheckBoxInput/src/CheckBoxInput.java @@ -0,0 +1,62 @@ +import javafx.application.Application; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.CheckBox; +import javafx.scene.layout.VBox; +import javafx.stage.Stage; + +public class CheckBoxInput extends Application{ + + Stage window; + Button orderButton; + Scene scene; + public static void main(String[] args) { + launch(args); + + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("The Sub Shop"); + + //checkboxes + CheckBox box1 = new CheckBox("MeatBall Parm"); + CheckBox box2 = new CheckBox("Chicken Parm"); + box2.setSelected(true); + CheckBox box3 = new CheckBox("Eggplant Parm"); + + + orderButton = new Button("Order Now"); + orderButton.setOnAction( e -> handleOptions(box1,box2,box3)); + VBox layout = new VBox(10); + layout.setPadding(new Insets(10,10,10,10)); + layout.getChildren().addAll(box1, box2, box3, orderButton); + + scene = new Scene(layout, 300, 250); + + window.setScene(scene); + window.show(); + + + } + + // handle checkbox options + private void handleOptions(CheckBox boxA, CheckBox boxB, CheckBox boxC){ + String message = "You ordered:"; + + if(boxA.isSelected()) + message += "\n" + boxA.getText(); + + if(boxB.isSelected()) + message += "\n" + boxB.getText(); + + if(boxC.isSelected()) + message += "\n" + boxC.getText(); + + System.out.println(message); + } + + +} diff --git a/mcaruso/mc_FXStudies/k_FXChoiceBox/src/Main.java b/mcaruso/mc_FXStudies/k_FXChoiceBox/src/Main.java new file mode 100644 index 0000000..e43ba8e --- /dev/null +++ b/mcaruso/mc_FXStudies/k_FXChoiceBox/src/Main.java @@ -0,0 +1,70 @@ +import javafx.application.Application; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.layout.VBox; +import javafx.stage.Stage; +import javafx.scene.control.ChoiceBox; + +public class Main extends Application{ + + Stage window; + Scene scene; + Button btn; + public static void main(String[] args) { + launch(args); + + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("Choice Box"); + + //one way of adding items to ChoiceBox + String[] moreFruits = {"Mango", "Tomatoe", "Strawberry" }; + int i; + + // Instantiate a ChoiceBox obj + ChoiceBox dropDown = new ChoiceBox<>(); + //add items to your observable list ChoiceBox + dropDown.getItems().add("Apples"); + dropDown.getItems().add("Peaches"); + dropDown.getItems().add("Plums"); + dropDown.getItems().addAll("Oranges", "Grapes", "Necturines"); + + //to add items from an array of choices + for(i= 0; i < moreFruits.length; i++){ + dropDown.getItems().addAll( moreFruits[i] ); + } + + + + + //set a default value + dropDown.setValue("Oranges"); + //Listen for selection changes + dropDown.getSelectionModel().selectedItemProperty() + .addListener((v, oldValue, newValue) -> System.out.println(newValue)); + //btn = new Button("Click Me!"); + //btn.setOnAction( e -> getChoice(dropDown)); + VBox layout = new VBox(10); + layout.setPadding(new Insets(10,10,10,10)); + layout.getChildren().addAll(dropDown); + + scene = new Scene(layout, 300, 250); + window.setScene(scene); + window.show(); + + } + + //Method to get value of selected choice on button click +/* private void getChoice(ChoiceBox dropDown){ + + String fruit = dropDown.getValue(); + + System.out.println("You chose: " + fruit); + + }*/ + +} From 189fd3b19a083de52be48cfadfb0dd5e6edc1d70 Mon Sep 17 00:00:00 2001 From: Mark Caruso Date: Thu, 7 Jul 2016 12:23:55 -0400 Subject: [PATCH 10/33] Added two FX Tutorials, ComboBox and TreeView --- .../mc_FXStudies/l_FXComboBox/src/Main.java | 54 ++++++++++++++ .../mc_FXStudies/m_FXTreeView/src/Main.java | 73 +++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 mcaruso/mc_FXStudies/l_FXComboBox/src/Main.java create mode 100644 mcaruso/mc_FXStudies/m_FXTreeView/src/Main.java diff --git a/mcaruso/mc_FXStudies/l_FXComboBox/src/Main.java b/mcaruso/mc_FXStudies/l_FXComboBox/src/Main.java new file mode 100644 index 0000000..b8b3a96 --- /dev/null +++ b/mcaruso/mc_FXStudies/l_FXComboBox/src/Main.java @@ -0,0 +1,54 @@ +import javafx.application.Application; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.ComboBox; +import javafx.scene.layout.VBox; +import javafx.stage.Stage; + +public class Main extends Application{ + + Stage window; + Scene scene; + Button btn; + ComboBox comboBox; + public static void main(String[] args) { + launch(args); + + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("Combo Box Demo"); + + btn = new Button("Submit"); + + comboBox = new ComboBox<>(); + comboBox.getItems().addAll( + "New York Yankees", + "Texas Rangers", + "Boston Red Sox", + "Baltimore Oriols" + ); + //comboBox.setPromptText("Select your favorite team?"); + comboBox.setEditable(true); + comboBox.setOnAction( e -> System.out.println("User selected: " + comboBox.getValue())); + btn.setOnAction( e -> printTeam()); + VBox layout = new VBox(10); + layout.setPadding(new Insets(20,20,20,20)); + layout.getChildren().addAll(comboBox,btn); + + scene = new Scene(layout, 400, 300); + window.setScene(scene); + window.show(); + + } + + private void printTeam(){ + System.out.println(comboBox.getValue()); + } + + + +} diff --git a/mcaruso/mc_FXStudies/m_FXTreeView/src/Main.java b/mcaruso/mc_FXStudies/m_FXTreeView/src/Main.java new file mode 100644 index 0000000..f4eac55 --- /dev/null +++ b/mcaruso/mc_FXStudies/m_FXTreeView/src/Main.java @@ -0,0 +1,73 @@ +import javafx.application.Application; +import javafx.scene.Scene; +import javafx.scene.control.TreeItem; +import javafx.scene.control.TreeView; +import javafx.scene.layout.StackPane; +import javafx.stage.Stage; + +public class Main extends Application{ + + Stage window; + TreeView tree; + + public static void main(String[] args) { + launch(args); + + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("ListView Demo"); + + //add root and tree branches + TreeItem root, Save, Print, Preferences; + root = new TreeItem<>(); + root.setExpanded(true); + + //Save + Save = makeBranch("Save", root); + makeBranch("Save File", Save); + makeBranch("Save As", Save); + + //Print + Print = makeBranch("Print", root); + makeBranch("Print to file", Print); + makeBranch("Print to PDF", Print); + + //Preferences + Preferences = makeBranch("Preferences", root); + makeBranch("Global", Preferences); + makeBranch("Project", Preferences); + + //Create tree + tree = new TreeView<>(root); + tree.setShowRoot(false); + tree.getSelectionModel().selectedItemProperty() + .addListener( (v, oldValue, newValue)-> { + if(newValue != null) + System.out.println(newValue.getValue()); + }); + + + //layout + StackPane layout = new StackPane(); + layout.getChildren().add(tree); + + Scene scene = new Scene(layout, 400, 450); + + window.setScene(scene); + window.show(); + + } + + //Create tree branch + public TreeItem makeBranch(String title, TreeItem parent){ + TreeItem item = new TreeItem(title); + item.setExpanded(true); + parent.getChildren().add(item); + return item; + } + + +} From 94571aee0de37fd6578d4ad0d6ceb92ffcb76bf6 Mon Sep 17 00:00:00 2001 From: Mark Caruso Date: Sat, 9 Jul 2016 17:05:10 -0400 Subject: [PATCH 11/33] Added two FX Studies Tutorials. Completed ListView Tutorial, conflated TableView with EditableTables Tutorial --- .../mc_FXStudies/n_FXListView/src/Main.java | 69 +++++++++ .../o_EditableTables/src/Main.java | 132 ++++++++++++++++++ .../o_EditableTables/src/Products.java | 48 +++++++ 3 files changed, 249 insertions(+) create mode 100644 mcaruso/mc_FXStudies/n_FXListView/src/Main.java create mode 100644 mcaruso/mc_FXStudies/o_EditableTables/src/Main.java create mode 100644 mcaruso/mc_FXStudies/o_EditableTables/src/Products.java diff --git a/mcaruso/mc_FXStudies/n_FXListView/src/Main.java b/mcaruso/mc_FXStudies/n_FXListView/src/Main.java new file mode 100644 index 0000000..96e5933 --- /dev/null +++ b/mcaruso/mc_FXStudies/n_FXListView/src/Main.java @@ -0,0 +1,69 @@ +import javafx.application.Application; +import javafx.collections.ObservableList; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.ListView; +import javafx.scene.control.SelectionMode; +import javafx.scene.layout.VBox; +import javafx.stage.Stage; + +public class Main extends Application{ + + Stage window; + Scene scene; + Button btn; + ListView listview; + + public static void main(String[] args) { + launch(args); + + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("ListView Demo"); + + btn = new Button("Submit"); + + listview = new ListView<>(); + listview.getItems().addAll( + "Chuck", + "Blue Bloods", + "NCIS L.A.", + "Blacklist", + "Blind Spot", + "Scorpion", + "Supergirl" + + ); + + listview.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);; + + btn.setOnAction( e -> selectedItems()); + + VBox layout = new VBox(10); + layout.setPadding(new Insets(10,10,10,10)); + layout.getChildren().addAll(listview, btn); + + scene = new Scene(layout, 300, 200); + + window.setScene(scene); + window.show(); + + } + + //Retrieve selected items from list view + private void selectedItems(){ + String msg = ""; + ObservableList items; + + items = listview.getSelectionModel().getSelectedItems(); + for(String item : items){ + msg += item + "\n"; + } + System.out.println(msg); + } + +} diff --git a/mcaruso/mc_FXStudies/o_EditableTables/src/Main.java b/mcaruso/mc_FXStudies/o_EditableTables/src/Main.java new file mode 100644 index 0000000..ad823e0 --- /dev/null +++ b/mcaruso/mc_FXStudies/o_EditableTables/src/Main.java @@ -0,0 +1,132 @@ +import javafx.application.Application; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.TableColumn; +import javafx.scene.control.TableView; +import javafx.scene.control.TextField; +import javafx.scene.control.cell.PropertyValueFactory; +import javafx.scene.layout.HBox; +import javafx.scene.layout.VBox; +import javafx.stage.Stage; + +public class Main extends Application{ + + Stage window; + TableView productsTable; + TextField nameInput, priceInput, quantityInput; + + public static void main(String[] args) { + launch(args); + + } + + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("FX TableView Demo"); + + // set up columns for table + //name column + TableColumn nameCol = new TableColumn<>("Name"); + nameCol.setMinWidth(200); + + //use this data for this column + nameCol.setCellValueFactory(new PropertyValueFactory<>("name")); + + //Price col + TableColumn priceCol = new TableColumn<>("Price"); + priceCol.setMinWidth(100); + priceCol.setCellValueFactory(new PropertyValueFactory<>("price")); + + //Quantity Col + TableColumn quantityCol = new TableColumn<>("Quantity"); + quantityCol.setMinWidth(100); + quantityCol.setCellValueFactory(new PropertyValueFactory<>("quantity")); + + //nameInput + nameInput = new TextField(); + nameInput.setPromptText("Product Name"); + nameInput.setMinWidth(125); + + //price input + priceInput = new TextField(); + priceInput.setPromptText("Product Price"); + priceInput.setMinWidth(125); + + //quantity input + quantityInput = new TextField(); + quantityInput.setPromptText("Quantity"); + quantityInput.setMinWidth(125); + + //add and delete buttons + Button addButton = new Button("Add"); + addButton.setOnAction( e -> addButtonClicked()); + Button deleteButton = new Button("Delete"); + deleteButton.setOnAction( e -> deleteButtonClicked()); + + //Make horizontal layout for inputs and buttons + HBox hbox = new HBox(); + hbox.setPadding(new Insets(10,10,10,10)); + hbox.setSpacing(10); + hbox.getChildren().addAll(nameInput, priceInput, quantityInput, addButton, deleteButton); + + + + //build the table + productsTable = new TableView<>(); + productsTable.setItems(getProducts()); + productsTable.getColumns().addAll(nameCol, priceCol, quantityCol); + + VBox layout = new VBox(10); + layout.getChildren().addAll(productsTable, hbox); + + Scene scene = new Scene(layout, 800, 400); + window.setScene(scene); + window.show(); + } + + // add button clicked method + public void addButtonClicked(){ + Products product = new Products(); + product.setName(nameInput.getText()); + product.setPrice(Double.parseDouble(priceInput.getText())); + product.setQuantity(Integer.parseInt(quantityInput.getText())); + // add to table + productsTable.getItems().add(product); + + //clear input fields + nameInput.clear(); + priceInput.clear(); + quantityInput.clear(); + + } + + //delete button method + public void deleteButtonClicked(){ + ObservableList selectedProduct, allProducts; + allProducts = productsTable.getItems(); + selectedProduct = productsTable.getSelectionModel().getSelectedItems(); + selectedProduct.forEach(allProducts :: remove); + } + + //Get all the products, usually some kind of DB + public ObservableList getProducts(){ + + ObservableList products = FXCollections.observableArrayList(); + products.add(new Products("Gibson SG", 1500.00, 20)); + products.add(new Products("Gibson Les Paul", 2500.00, 10)); + products.add(new Products("Epiphone EX", 900.99, 40)); + products.add(new Products("Martin D100", 3050.67, 15)); + products.add(new Products("Martin D18", 4500.00, 8)); + + return products; + } + + + + +} diff --git a/mcaruso/mc_FXStudies/o_EditableTables/src/Products.java b/mcaruso/mc_FXStudies/o_EditableTables/src/Products.java new file mode 100644 index 0000000..ff196b0 --- /dev/null +++ b/mcaruso/mc_FXStudies/o_EditableTables/src/Products.java @@ -0,0 +1,48 @@ + +public class Products { + + private String name; + private double price; + private int quantity; + + // Default constructor + public Products(){ + this.name = ""; + this.price = 0; + this.quantity = 0; + } + + public Products(String name, double price, int quantity){ + this.name = name; + this.price = price; + this.quantity = quantity; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public double getPrice() { + return price; + } + + public void setPrice(double price) { + this.price = price; + } + + public int getQuantity() { + return quantity; + } + + public void setQuantity(int quantity) { + this.quantity = quantity; + } + + + + +}//EndOfProductsClass From c08a47d6b73843df7dcb44c8aafe171eaa4821b4 Mon Sep 17 00:00:00 2001 From: Eric Schmitt Date: Mon, 11 Jul 2016 11:32:48 -0400 Subject: [PATCH 12/33] Finished JavaFX Tutorial --- .../Tutorials 20-35/Binding/Binding.java | 47 ++++++++++ .../Tutorials 20-35/Css/Css.java | 69 ++++++++++++++ .../Tutorials 20-35/Css/Viper.css | 23 +++++ .../FXML - Scene Builder/FXMLDocument.fxml | 63 +++++++++++++ .../FXMLDocumentController.java | 15 +++ .../FXML - Scene Builder/JavaFXMLExample.java | 25 +++++ .../Tutorials 20-35/FXML/Fxml.java | 48 ++++++++++ .../Tutorials 20-35/Menus/Menus.java | 91 +++++++++++++++++++ .../Tutorials 20-35/Properties/Person.java | 20 ++++ .../Properties/Properties.java | 42 +++++++++ 10 files changed, 443 insertions(+) create mode 100644 ericaschmitt/JavaFXTutorials/Tutorials 20-35/Binding/Binding.java create mode 100644 ericaschmitt/JavaFXTutorials/Tutorials 20-35/Css/Css.java create mode 100644 ericaschmitt/JavaFXTutorials/Tutorials 20-35/Css/Viper.css create mode 100644 ericaschmitt/JavaFXTutorials/Tutorials 20-35/FXML - Scene Builder/FXMLDocument.fxml create mode 100644 ericaschmitt/JavaFXTutorials/Tutorials 20-35/FXML - Scene Builder/FXMLDocumentController.java create mode 100644 ericaschmitt/JavaFXTutorials/Tutorials 20-35/FXML - Scene Builder/JavaFXMLExample.java create mode 100644 ericaschmitt/JavaFXTutorials/Tutorials 20-35/FXML/Fxml.java create mode 100644 ericaschmitt/JavaFXTutorials/Tutorials 20-35/Menus/Menus.java create mode 100644 ericaschmitt/JavaFXTutorials/Tutorials 20-35/Properties/Person.java create mode 100644 ericaschmitt/JavaFXTutorials/Tutorials 20-35/Properties/Properties.java diff --git a/ericaschmitt/JavaFXTutorials/Tutorials 20-35/Binding/Binding.java b/ericaschmitt/JavaFXTutorials/Tutorials 20-35/Binding/Binding.java new file mode 100644 index 0000000..a29f5f7 --- /dev/null +++ b/ericaschmitt/JavaFXTutorials/Tutorials 20-35/Binding/Binding.java @@ -0,0 +1,47 @@ +package binding; + +import javafx.application.Application; +import javafx.beans.property.IntegerProperty; +import javafx.beans.property.SimpleIntegerProperty; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.layout.StackPane; +import javafx.stage.Stage; + +public class Binding extends Application { + + Stage window; + Button button; + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("thenewboston"); + + IntegerProperty x = new SimpleIntegerProperty(3); + IntegerProperty y = new SimpleIntegerProperty(); + + y.bind(x.multiply(10)); + System.out.println("x: " + x.getValue()); + System.out.println("y: "+ y.getValue() + "\n"); + + x.setValue(9); + + System.out.println("x: " + x.getValue()); + System.out.println("y: "+ y.getValue() + "\n"); + + button = new Button("Submit"); + + StackPane layout = new StackPane(); + layout.getChildren().add(button); + Scene scene = new Scene(layout, 300, 250); + window.setScene(scene); + window.show(); + } + + +} \ No newline at end of file diff --git a/ericaschmitt/JavaFXTutorials/Tutorials 20-35/Css/Css.java b/ericaschmitt/JavaFXTutorials/Tutorials 20-35/Css/Css.java new file mode 100644 index 0000000..9fbad40 --- /dev/null +++ b/ericaschmitt/JavaFXTutorials/Tutorials 20-35/Css/Css.java @@ -0,0 +1,69 @@ + +package css; + +import javafx.application.Application; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import javafx.scene.layout.GridPane; +import javafx.stage.Stage; + +public class Css extends Application{ + + Stage window; + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("thenewboston - JavaFX"); + + //GridPane with 10px padding around edge + GridPane grid = new GridPane(); + grid.setPadding(new Insets(10, 10, 10, 10)); + grid.setVgap(8); + grid.setHgap(10); + + //Name Label - constrains use (child, column, row) + Label nameLabel = new Label("Username:"); + nameLabel.setId("bold-label"); + GridPane.setConstraints(nameLabel, 0, 0); + + //Name Input + TextField nameInput = new TextField("Bucky"); + GridPane.setConstraints(nameInput, 1, 0); + + //Password Label + Label passLabel = new Label("Password:"); + GridPane.setConstraints(passLabel, 0, 1); + + //Password Input + TextField passInput = new TextField(); + passInput.setPromptText("password"); + GridPane.setConstraints(passInput, 1, 1); + + //Login + Button loginButton = new Button("Log In"); + GridPane.setConstraints(loginButton, 1, 2); + + //signup + Button signupButton = new Button("Sign Up"); + signupButton.getStyleClass().add("button-blue"); + GridPane.setConstraints(signupButton, 1, 3); + + //Add everything to grid + grid.getChildren().addAll(nameLabel, nameInput, passLabel, passInput, loginButton, signupButton); + + Scene scene = new Scene(grid, 300, 200); + scene.getStylesheets().add("Css/Viper.css"); + window.setScene(scene); + window.show(); + } + + +} \ No newline at end of file diff --git a/ericaschmitt/JavaFXTutorials/Tutorials 20-35/Css/Viper.css b/ericaschmitt/JavaFXTutorials/Tutorials 20-35/Css/Viper.css new file mode 100644 index 0000000..348b5f9 --- /dev/null +++ b/ericaschmitt/JavaFXTutorials/Tutorials 20-35/Css/Viper.css @@ -0,0 +1,23 @@ +.root{ + -fx-background-color:#383838; +} + +.label{ + -fx-text-fill: #e8e8e8; +} + +.button{ + -fx-background-color: #ab4642; + -fx-text-fill: #fff; + -fx-background-radius: 4; +} + +.button-blue{ + -fx-background-color: #7cafc2; + -fx-text-fill: #fff; + -fx-background-radius: 4; +} + +#bold-label{ + -fx-font-weight: bold; +} \ No newline at end of file diff --git a/ericaschmitt/JavaFXTutorials/Tutorials 20-35/FXML - Scene Builder/FXMLDocument.fxml b/ericaschmitt/JavaFXTutorials/Tutorials 20-35/FXML - Scene Builder/FXMLDocument.fxml new file mode 100644 index 0000000..764de30 --- /dev/null +++ b/ericaschmitt/JavaFXTutorials/Tutorials 20-35/FXML - Scene Builder/FXMLDocument.fxml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +