├── .gitattributes ├── .gitignore ├── JavaFX-3D ├── .idea │ ├── compiler.xml │ ├── copyright │ │ └── profiles_settings.xml │ ├── description.html │ ├── encodings.xml │ ├── libraries │ │ └── 3DImporter.xml │ ├── misc.xml │ ├── modules.xml │ ├── uiDesigner.xml │ └── workspace.xml ├── javafx_3d.iml ├── lib │ └── 3DImporter.jar ├── out │ └── production │ │ └── javafx_3d │ │ └── sample │ │ ├── muro_diffuse.jpg │ │ ├── muro_normal.jpg │ │ └── obj-model │ │ ├── LICENSE.txt │ │ ├── cyborg.obj │ │ ├── cyborg1.mtl │ │ ├── cyborg_diffuse.jpg │ │ ├── cyborg_normal.jpg │ │ └── cyborg_specular.jpg └── src │ └── sample │ ├── Main.java │ ├── muro_diffuse.jpg │ ├── muro_normal.jpg │ └── obj-model │ ├── LICENSE.txt │ ├── cyborg.obj │ ├── cyborg1.mtl │ ├── cyborg_diffuse.jpg │ ├── cyborg_normal.jpg │ └── cyborg_specular.jpg ├── JavaFX-AudioAndVideo ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── configs │ │ ├── Run_as_WebStart.properties │ │ └── Run_in_Browser.properties │ ├── genfiles.properties │ ├── jfx-impl.xml │ ├── project.properties │ └── project.xml └── src │ └── carmelo │ └── javafx │ └── PlayMedia.java ├── JavaFX-CSS ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── configs │ │ ├── Run_as_WebStart.properties │ │ └── Run_in_Browser.properties │ ├── genfiles.properties │ ├── jfx-impl.xml │ ├── private │ │ ├── configs │ │ │ ├── Run_as_WebStart.properties │ │ │ └── Run_in_Browser.properties │ │ ├── private.properties │ │ └── private.xml │ ├── project.properties │ └── project.xml └── src │ └── carmelo │ ├── JavaFXCSS.java │ └── estilos.css ├── JavaFX-ColorPicker ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── configs │ │ ├── Run_as_WebStart.properties │ │ └── Run_in_Browser.properties │ ├── genfiles.properties │ ├── jfx-impl.xml │ ├── project.properties │ └── project.xml └── src │ └── tutor │ └── javafx │ └── ColorPickerExample.java ├── JavaFX-DatePicker ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── configs │ │ ├── Run_as_WebStart.properties │ │ └── Run_in_Browser.properties │ ├── genfiles.properties │ ├── jfx-impl.xml │ ├── project.properties │ └── project.xml └── src │ └── tutor │ └── javafx │ └── DatePickerExample.java ├── JavaFX-Effects ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── configs │ │ ├── Run_as_WebStart.properties │ │ └── Run_in_Browser.properties │ ├── genfiles.properties │ ├── jfx-impl.xml │ ├── project.properties │ └── project.xml └── src │ └── javafx │ └── effects │ └── Main.java ├── JavaFX-Enlaces ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── configs │ │ ├── Run_as_WebStart.properties │ │ └── Run_in_Browser.properties │ ├── genfiles.properties │ ├── jfx-impl.xml │ ├── project.properties │ └── project.xml └── src │ └── javafx │ └── enlaces │ └── JavaFXEnlaces.java ├── JavaFX-Eventos ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── configs │ │ ├── Run_as_WebStart.properties │ │ └── Run_in_Browser.properties │ ├── genfiles.properties │ ├── jfx-impl.xml │ ├── project.properties │ └── project.xml └── src │ └── tutor │ └── programacion │ ├── JavaFXKeyEvent.java │ └── JavaFXMouseEvent.java ├── JavaFX-OpenCV ├── Readme.md ├── build.xml ├── lib │ ├── CopyLibs │ │ └── org-netbeans-modules-java-j2seproject-copylibstask.jar │ └── nblibraries.properties ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── configs │ │ ├── Run_as_WebStart.properties │ │ └── Run_in_Browser.properties │ ├── genfiles.properties │ ├── jfx-impl.xml │ ├── project.properties │ └── project.xml └── src │ └── carmelo │ ├── CameraTask.java │ └── JavaFXOpenCV.java ├── JavaFX-Pagination ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── configs │ │ ├── Run_as_WebStart.properties │ │ └── Run_in_Browser.properties │ ├── genfiles.properties │ ├── jfx-impl.xml │ ├── project.properties │ └── project.xml └── src │ └── tutor │ └── javafx │ └── JavaFXPaginationExample.java ├── JavaFX-PieChart ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── configs │ │ ├── Run_as_WebStart.properties │ │ └── Run_in_Browser.properties │ ├── genfiles.properties │ ├── jfx-impl.xml │ ├── project.properties │ └── project.xml └── src │ └── tutor │ └── javafx │ ├── PieChartExample.java │ └── style.css ├── JavaFX-Preloader ├── JFXTestPreloader-Preloader │ ├── build.xml │ ├── lib │ │ └── medusa-3.5.jar │ ├── manifest.mf │ ├── nbproject │ │ ├── build-impl.xml │ │ ├── configs │ │ │ ├── Run_as_WebStart.properties │ │ │ └── Run_in_Browser.properties │ │ ├── genfiles.properties │ │ ├── jfx-impl.xml │ │ ├── private │ │ │ ├── configs │ │ │ │ ├── Run_as_WebStart.properties │ │ │ │ └── Run_in_Browser.properties │ │ │ ├── private.properties │ │ │ └── private.xml │ │ ├── project.properties │ │ └── project.xml │ └── src │ │ └── jfxtestpreloader │ │ └── preloader │ │ ├── JFXTestPreloader_Preloader.java │ │ ├── MedusaPreloader.java │ │ └── loader.GIF └── JFXTestPreloader │ ├── build.xml │ ├── manifest.mf │ ├── nbproject │ ├── build-impl.xml │ ├── configs │ │ ├── Run_as_WebStart.properties │ │ └── Run_in_Browser.properties │ ├── genfiles.properties │ ├── jfx-impl.xml │ ├── private │ │ ├── configs │ │ │ ├── Run_as_WebStart.properties │ │ │ └── Run_in_Browser.properties │ │ ├── private.properties │ │ └── private.xml │ ├── project.properties │ └── project.xml │ └── src │ └── jfxtestpreloader │ ├── JFXTestMedusaPreloader.java │ └── JFXTestPreloader.java ├── JavaFX-ScrollBar_ScrollPane ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── configs │ │ ├── Run_as_WebStart.properties │ │ └── Run_in_Browser.properties │ ├── genfiles.properties │ ├── jfx-impl.xml │ ├── project.properties │ └── project.xml └── src │ └── carmelo │ └── javafx │ ├── TutorialScrollBar.java │ ├── TutorialScrollPane.java │ └── gears.jpg ├── JavaFX-SearchComboBox ├── Readme.md ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── configs │ │ ├── Run_as_WebStart.properties │ │ └── Run_in_Browser.properties │ ├── genfiles.properties │ ├── jfx-impl.xml │ ├── private │ │ ├── configs │ │ │ ├── Run_as_WebStart.properties │ │ │ └── Run_in_Browser.properties │ │ ├── private.properties │ │ └── private.xml │ ├── project.properties │ └── project.xml └── src │ └── carmelo │ ├── SearchComboBox.java │ ├── SearchComboBoxApp.java │ └── SearchComboBoxSkin.java ├── JavaFX-TableView-Editable ├── pom.xml └── src │ └── main │ └── java │ └── TutorProgramacion │ ├── MainApp.java │ └── Persona.java ├── JavaFX-TreeTableView ├── build.xml ├── lib │ ├── fontawesomefx-commons-8.12.jar │ └── fontawesomefx-octicons-4.3.0.jar ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── configs │ │ ├── Run_as_WebStart.properties │ │ └── Run_in_Browser.properties │ ├── genfiles.properties │ ├── jfx-impl.xml │ ├── project.properties │ └── project.xml └── src │ └── carmelo │ └── javafx │ ├── Empleado.java │ ├── Explorador.java │ └── JFXTreeTableView.java ├── JavaFX-TreeView ├── build.xml ├── lib │ ├── fontawesomefx-commons-8.12.jar │ └── fontawesomefx-octicons-4.3.0.jar ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── configs │ │ ├── Run_as_WebStart.properties │ │ └── Run_in_Browser.properties │ ├── genfiles.properties │ ├── jfx-impl.xml │ ├── project.properties │ └── project.xml └── src │ └── javafx │ └── treeview │ └── Main.java └── JavaFX-WebView ├── build.xml ├── manifest.mf ├── nbproject ├── build-impl.xml ├── configs │ ├── Run_as_WebStart.properties │ └── Run_in_Browser.properties ├── genfiles.properties ├── jfx-impl.xml ├── project.properties └── project.xml └── src └── carmelo └── javafx └── JavaFXWebView.java /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | # *.jar 8 | *.war 9 | *.ear 10 | 11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 12 | hs_err_pid* 13 | 14 | # ========================= 15 | # Operating System Files 16 | # ========================= 17 | 18 | # OSX 19 | # ========================= 20 | 21 | .DS_Store 22 | .AppleDouble 23 | .LSOverride 24 | 25 | # Thumbnails 26 | ._* 27 | 28 | # Files that might appear in the root of a volume 29 | .DocumentRevisions-V100 30 | .fseventsd 31 | .Spotlight-V100 32 | .TemporaryItems 33 | .Trashes 34 | .VolumeIcon.icns 35 | 36 | # Directories potentially created on remote AFP share 37 | .AppleDB 38 | .AppleDesktop 39 | Network Trash Folder 40 | Temporary Items 41 | .apdisk 42 | 43 | # Windows 44 | # ========================= 45 | 46 | # Windows image file caches 47 | Thumbs.db 48 | ehthumbs.db 49 | 50 | # Folder config file 51 | Desktop.ini 52 | 53 | # Recycle Bin used on file shares 54 | $RECYCLE.BIN/ 55 | 56 | # Windows Installer files 57 | *.cab 58 | *.msi 59 | *.msm 60 | *.msp 61 | 62 | # Windows shortcuts 63 | *.lnk 64 | -------------------------------------------------------------------------------- /JavaFX-3D/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /JavaFX-3D/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /JavaFX-3D/.idea/description.html: -------------------------------------------------------------------------------- 1 | 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. 2 | -------------------------------------------------------------------------------- /JavaFX-3D/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /JavaFX-3D/.idea/libraries/3DImporter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /JavaFX-3D/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /JavaFX-3D/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JavaFX-3D/javafx_3d.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /JavaFX-3D/lib/3DImporter.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TutorProgramacion/JavaFX-Tutoriales/67361200e8ffd2a9953624a727dfa3d1a51bbaa7/JavaFX-3D/lib/3DImporter.jar -------------------------------------------------------------------------------- /JavaFX-3D/out/production/javafx_3d/sample/muro_diffuse.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TutorProgramacion/JavaFX-Tutoriales/67361200e8ffd2a9953624a727dfa3d1a51bbaa7/JavaFX-3D/out/production/javafx_3d/sample/muro_diffuse.jpg -------------------------------------------------------------------------------- /JavaFX-3D/out/production/javafx_3d/sample/muro_normal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TutorProgramacion/JavaFX-Tutoriales/67361200e8ffd2a9953624a727dfa3d1a51bbaa7/JavaFX-3D/out/production/javafx_3d/sample/muro_normal.jpg -------------------------------------------------------------------------------- /JavaFX-3D/out/production/javafx_3d/sample/obj-model/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Slightly adapted version (by Joey de Vries) of Cyborg model. 2 | 3 | From: 3dregenerator 4 | Downloaded at: http://tf3dm.com/3d-model/cyborg-78.html 5 | 6 | For Personal Use Only. -------------------------------------------------------------------------------- /JavaFX-3D/out/production/javafx_3d/sample/obj-model/cyborg1.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'cyborg.blend' 2 | # Material Count: 1 3 | 4 | newmtl Cyborg 5 | Ns 92.156863 6 | Ka 0.000000 0.000000 0.000000 7 | Kd 0.512000 0.512000 0.512000 8 | Ks 0.000000 0.000000 0.000000 9 | Ni 1.000000 10 | d 1.000000 11 | illum 2 12 | map_Kd cyborg_diffuse.jpg 13 | map_Bump cyborg_normal.jpg 14 | map_Ks cyborg_specular.jpg 15 | -------------------------------------------------------------------------------- /JavaFX-3D/out/production/javafx_3d/sample/obj-model/cyborg_diffuse.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TutorProgramacion/JavaFX-Tutoriales/67361200e8ffd2a9953624a727dfa3d1a51bbaa7/JavaFX-3D/out/production/javafx_3d/sample/obj-model/cyborg_diffuse.jpg -------------------------------------------------------------------------------- /JavaFX-3D/out/production/javafx_3d/sample/obj-model/cyborg_normal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TutorProgramacion/JavaFX-Tutoriales/67361200e8ffd2a9953624a727dfa3d1a51bbaa7/JavaFX-3D/out/production/javafx_3d/sample/obj-model/cyborg_normal.jpg -------------------------------------------------------------------------------- /JavaFX-3D/out/production/javafx_3d/sample/obj-model/cyborg_specular.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TutorProgramacion/JavaFX-Tutoriales/67361200e8ffd2a9953624a727dfa3d1a51bbaa7/JavaFX-3D/out/production/javafx_3d/sample/obj-model/cyborg_specular.jpg -------------------------------------------------------------------------------- /JavaFX-3D/src/sample/Main.java: -------------------------------------------------------------------------------- 1 | package sample; 2 | 3 | import com.javafx.experiments.importers.Importer3D; 4 | import javafx.animation.Animation; 5 | import javafx.animation.RotateTransition; 6 | import javafx.application.Application; 7 | import javafx.application.ConditionalFeature; 8 | import javafx.application.Platform; 9 | import javafx.geometry.Point3D; 10 | import javafx.scene.*; 11 | import javafx.scene.image.Image; 12 | import javafx.scene.paint.Color; 13 | import javafx.scene.paint.PhongMaterial; 14 | import javafx.scene.shape.Box; 15 | import javafx.stage.Stage; 16 | import javafx.util.Duration; 17 | 18 | import java.io.IOException; 19 | 20 | public class Main extends Application { 21 | 22 | @Override 23 | public void start(Stage primaryStage) throws Exception { 24 | 25 | boolean supported = Platform.isSupported(ConditionalFeature.SCENE3D); 26 | 27 | // if (supported) createScene3D(primaryStage); 28 | if (supported) loadScene3D(primaryStage); 29 | } 30 | 31 | private void loadScene3D(Stage stage) throws IOException { 32 | 33 | PointLight light1 = new PointLight(); 34 | light1.setTranslateZ(-500); 35 | 36 | Node model = Importer3D.load(getClass().getResource("obj-model/cyborg.obj").toExternalForm()); 37 | model.setScaleX(150.0); 38 | model.setScaleY(150.0); 39 | model.setScaleZ(150.0); 40 | 41 | Group root = new Group(model, light1); 42 | 43 | Scene scene = new Scene(root, 1280, 768, true, SceneAntialiasing.BALANCED); 44 | 45 | PerspectiveCamera camera = new PerspectiveCamera(); 46 | camera.setTranslateX(scene.getWidth() / -2.0); 47 | camera.setTranslateY(scene.getHeight() / -2.0); 48 | 49 | RotateTransition rt = new RotateTransition(Duration.seconds(10), model); 50 | rt.setCycleCount(Animation.INDEFINITE); 51 | rt.setFromAngle(0); 52 | rt.setToAngle(360); 53 | rt.setAxis(new Point3D(0, 1, 0)); 54 | rt.play(); 55 | 56 | scene.setFill(Color.CORNFLOWERBLUE); 57 | scene.setCamera(camera); 58 | stage.setTitle("JavaFX Graficos 3D - Cargar Modelo"); 59 | stage.setScene(scene); 60 | stage.show(); 61 | } 62 | 63 | private void createScene3D(Stage stage) { 64 | 65 | Color color_luz = Color.WHITESMOKE; 66 | 67 | Image image_diffuse = new Image(getClass().getResource("muro_diffuse.jpg").toExternalForm()); 68 | Image image_normal = new Image(getClass().getResource("muro_normal.jpg").toExternalForm()); 69 | 70 | // materiales para el box shape 71 | PhongMaterial mat = new PhongMaterial(); 72 | mat.setSpecularColor(color_luz); 73 | mat.setSpecularPower(64); 74 | mat.setDiffuseMap(image_diffuse); 75 | mat.setBumpMap(image_normal); 76 | 77 | // crear un cubo 3D, anchura, altura y profundidad 78 | Box box = new Box(300, 300, 300); 79 | box.setRotate(45); 80 | box.setRotationAxis(new Point3D(1, 1, 0)); 81 | box.setMaterial(mat); 82 | 83 | // crear una luz puntual 84 | PointLight light = new PointLight(color_luz); 85 | light.setTranslateX(-350); 86 | light.setTranslateY(+180); 87 | light.setTranslateZ(-500); 88 | 89 | Group root = new Group(box, light); 90 | 91 | // crear la escena, true para activar el buffer de profindidad 92 | Scene scene = new Scene(root, 1280, 768, true, SceneAntialiasing.BALANCED); 93 | 94 | // crear una camara en perspectiva 95 | PerspectiveCamera camera = new PerspectiveCamera(); 96 | camera.setTranslateX(scene.getWidth() / -2.0); 97 | camera.setTranslateY(scene.getHeight() / -2.0); 98 | 99 | // crear una animacion de rotacion sobre los ejes (X,Y,Z) 100 | RotateTransition rt = new RotateTransition(Duration.seconds(10), box); 101 | rt.setCycleCount(Animation.INDEFINITE); 102 | rt.setFromAngle(0); 103 | rt.setToAngle(360); 104 | rt.setAxis(new Point3D(1, 1, 1)); 105 | rt.play(); 106 | 107 | scene.setCamera(camera); 108 | stage.setTitle("JavaFX Graficos 3D"); 109 | stage.setScene(scene); 110 | stage.show(); 111 | } 112 | 113 | public static void main(String[] args) { 114 | launch(args); 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /JavaFX-3D/src/sample/muro_diffuse.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TutorProgramacion/JavaFX-Tutoriales/67361200e8ffd2a9953624a727dfa3d1a51bbaa7/JavaFX-3D/src/sample/muro_diffuse.jpg -------------------------------------------------------------------------------- /JavaFX-3D/src/sample/muro_normal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TutorProgramacion/JavaFX-Tutoriales/67361200e8ffd2a9953624a727dfa3d1a51bbaa7/JavaFX-3D/src/sample/muro_normal.jpg -------------------------------------------------------------------------------- /JavaFX-3D/src/sample/obj-model/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Slightly adapted version (by Joey de Vries) of Cyborg model. 2 | 3 | From: 3dregenerator 4 | Downloaded at: http://tf3dm.com/3d-model/cyborg-78.html 5 | 6 | For Personal Use Only. -------------------------------------------------------------------------------- /JavaFX-3D/src/sample/obj-model/cyborg1.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'cyborg.blend' 2 | # Material Count: 1 3 | 4 | newmtl Cyborg 5 | Ns 92.156863 6 | Ka 0.000000 0.000000 0.000000 7 | Kd 0.512000 0.512000 0.512000 8 | Ks 0.000000 0.000000 0.000000 9 | Ni 1.000000 10 | d 1.000000 11 | illum 2 12 | map_Kd cyborg_diffuse.jpg 13 | map_Bump cyborg_normal.jpg 14 | map_Ks cyborg_specular.jpg 15 | -------------------------------------------------------------------------------- /JavaFX-3D/src/sample/obj-model/cyborg_diffuse.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TutorProgramacion/JavaFX-Tutoriales/67361200e8ffd2a9953624a727dfa3d1a51bbaa7/JavaFX-3D/src/sample/obj-model/cyborg_diffuse.jpg -------------------------------------------------------------------------------- /JavaFX-3D/src/sample/obj-model/cyborg_normal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TutorProgramacion/JavaFX-Tutoriales/67361200e8ffd2a9953624a727dfa3d1a51bbaa7/JavaFX-3D/src/sample/obj-model/cyborg_normal.jpg -------------------------------------------------------------------------------- /JavaFX-3D/src/sample/obj-model/cyborg_specular.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TutorProgramacion/JavaFX-Tutoriales/67361200e8ffd2a9953624a727dfa3d1a51bbaa7/JavaFX-3D/src/sample/obj-model/cyborg_specular.jpg -------------------------------------------------------------------------------- /JavaFX-AudioAndVideo/build.xml: -------------------------------------------------------------------------------- 1 | 2 | Builds, tests, and runs the project AudioAndVideo. 3 | 4 | 53 | 54 | -------------------------------------------------------------------------------- /JavaFX-AudioAndVideo/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /JavaFX-AudioAndVideo/nbproject/configs/Run_as_WebStart.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run as WebStart 3 | -------------------------------------------------------------------------------- /JavaFX-AudioAndVideo/nbproject/configs/Run_in_Browser.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run in Browser 3 | -------------------------------------------------------------------------------- /JavaFX-AudioAndVideo/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=03fa4cc0 2 | build.xml.script.CRC32=cbef740e 3 | build.xml.stylesheet.CRC32=8064a381@1.75.2.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=03fa4cc0 7 | nbproject/build-impl.xml.script.CRC32=ec132f22 8 | nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48 9 | -------------------------------------------------------------------------------- /JavaFX-AudioAndVideo/nbproject/project.properties: -------------------------------------------------------------------------------- 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=AudioAndVideo 8 | application.vendor=Carmelo Mar\u00edn Abrego 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}/AudioAndVideo.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=carmelo.javafx.PlayMedia 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 114 | -------------------------------------------------------------------------------- /JavaFX-AudioAndVideo/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | AudioAndVideo 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /JavaFX-CSS/build.xml: -------------------------------------------------------------------------------- 1 | 2 | Builds, tests, and runs the project JavaFX-CSS. 3 | 4 | 53 | 54 | -------------------------------------------------------------------------------- /JavaFX-CSS/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /JavaFX-CSS/nbproject/configs/Run_as_WebStart.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run as WebStart 3 | -------------------------------------------------------------------------------- /JavaFX-CSS/nbproject/configs/Run_in_Browser.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run in Browser 3 | -------------------------------------------------------------------------------- /JavaFX-CSS/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=2df969ab 2 | build.xml.script.CRC32=40520c68 3 | build.xml.stylesheet.CRC32=8064a381@1.75.2.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=2df969ab 7 | nbproject/build-impl.xml.script.CRC32=7508bd1b 8 | nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48 9 | -------------------------------------------------------------------------------- /JavaFX-CSS/nbproject/private/configs/Run_as_WebStart.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | javafx.run.as=webstart 3 | -------------------------------------------------------------------------------- /JavaFX-CSS/nbproject/private/configs/Run_in_Browser.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | javafx.run.as=embedded 3 | -------------------------------------------------------------------------------- /JavaFX-CSS/nbproject/private/private.properties: -------------------------------------------------------------------------------- 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= 5 | javafx.run.inbrowser.path=C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe 6 | user.properties.file=C:\\Users\\Carmelo Mar\u00edn Abrego\\AppData\\Roaming\\NetBeans\\8.0\\build.properties 7 | -------------------------------------------------------------------------------- /JavaFX-CSS/nbproject/private/private.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JavaFX-CSS/nbproject/project.properties: -------------------------------------------------------------------------------- 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=JavaFX-CSS 8 | application.vendor=Carmelo Mar\u00edn Abrego 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}/JavaFX-CSS.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=carmelo.JavaFXCSS 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 114 | -------------------------------------------------------------------------------- /JavaFX-CSS/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | JavaFX-CSS 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /JavaFX-CSS/src/carmelo/JavaFXCSS.java: -------------------------------------------------------------------------------- 1 | package carmelo; 2 | 3 | import javafx.application.Application; 4 | import javafx.scene.Scene; 5 | import javafx.scene.control.Button; 6 | import javafx.scene.control.Label; 7 | import javafx.scene.layout.VBox; 8 | import javafx.stage.Stage; 9 | 10 | /** 11 | * 12 | * @author Carmelo Marin Abrego 13 | */ 14 | public class JavaFXCSS extends Application { 15 | 16 | @Override 17 | public void start(Stage primaryStage) { 18 | 19 | Label lbl1 = new Label("Este es un label CSS = .label"); 20 | Label lbl2 = new Label("Este es un label CSS = .label"); 21 | Label lbl3 = new Label("Este es un label ID = texto, CSS = #texto"); 22 | lbl3.setId("texto"); 23 | 24 | VBox root = new VBox(); 25 | root.getStyleClass().add("vertical-box"); 26 | // root.setStyle("-fx-alignment: CENTER; -fx-background-color: gray;"); 27 | root.getChildren().addAll(lbl1, lbl2, lbl3, new Button("Click")); 28 | 29 | Scene scene = new Scene(root, 300, 250); 30 | scene.getStylesheets().add(getClass().getResource("estilos.css").toExternalForm()); 31 | 32 | primaryStage.setTitle("JavaFX - CSS"); 33 | primaryStage.setScene(scene); 34 | primaryStage.show(); 35 | } 36 | 37 | /** 38 | * @param args the command line arguments 39 | */ 40 | public static void main(String[] args) { 41 | launch(args); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /JavaFX-CSS/src/carmelo/estilos.css: -------------------------------------------------------------------------------- 1 | /* 2 | Created on : 03/10/2016, 09:02:06 AM 3 | Author : Carmelo Marin Abrego 4 | */ 5 | 6 | .label { 7 | -fx-text-fill: green; 8 | } 9 | 10 | #texto { 11 | -fx-text-fill: blue; 12 | } 13 | 14 | .vertical-box { 15 | -fx-alignment: CENTER; 16 | -fx-background-color: gray; 17 | } -------------------------------------------------------------------------------- /JavaFX-ColorPicker/build.xml: -------------------------------------------------------------------------------- 1 | 2 | Builds, tests, and runs the project JavaFX-ColorPicker. 3 | 4 | 53 | 54 | -------------------------------------------------------------------------------- /JavaFX-ColorPicker/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /JavaFX-ColorPicker/nbproject/configs/Run_as_WebStart.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run as WebStart 3 | -------------------------------------------------------------------------------- /JavaFX-ColorPicker/nbproject/configs/Run_in_Browser.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run in Browser 3 | -------------------------------------------------------------------------------- /JavaFX-ColorPicker/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=6d0b3972 2 | build.xml.script.CRC32=c44bb812 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=6d0b3972 7 | nbproject/build-impl.xml.script.CRC32=5287d5a3 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /JavaFX-ColorPicker/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | JavaFX-ColorPicker 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /JavaFX-ColorPicker/src/tutor/javafx/ColorPickerExample.java: -------------------------------------------------------------------------------- 1 | package tutor.javafx; 2 | 3 | import javafx.application.Application; 4 | import javafx.geometry.Insets; 5 | import javafx.geometry.Pos; 6 | import javafx.scene.Scene; 7 | import javafx.scene.control.ColorPicker; 8 | import javafx.scene.layout.Background; 9 | import javafx.scene.layout.BackgroundFill; 10 | import javafx.scene.layout.StackPane; 11 | import javafx.scene.paint.Color; 12 | import javafx.stage.Stage; 13 | 14 | public class ColorPickerExample extends Application { 15 | 16 | @Override 17 | public void start(Stage primaryStage) { 18 | 19 | ColorPicker color = new ColorPicker(Color.RED); 20 | color.getStyleClass().add(ColorPicker.STYLE_CLASS_SPLIT_BUTTON); 21 | 22 | StackPane root = new StackPane(); 23 | root.getChildren().add(color); 24 | root.setAlignment(Pos.TOP_LEFT); 25 | root.setPadding(new Insets(10.0)); 26 | 27 | color.setOnAction(e -> { 28 | BackgroundFill fill = new BackgroundFill(color.getValue(), null, null); 29 | root.setBackground(new Background(fill)); 30 | }); 31 | 32 | Scene scene = new Scene(root, 600, 250); 33 | 34 | primaryStage.setTitle("JavaFX ColorPicker"); 35 | primaryStage.setScene(scene); 36 | primaryStage.show(); 37 | } 38 | 39 | public static void main(String[] args) { 40 | launch(args); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /JavaFX-DatePicker/build.xml: -------------------------------------------------------------------------------- 1 | 2 | Builds, tests, and runs the project JavaFX-DatePicker. 3 | 4 | 53 | 54 | -------------------------------------------------------------------------------- /JavaFX-DatePicker/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /JavaFX-DatePicker/nbproject/configs/Run_as_WebStart.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run as WebStart 3 | -------------------------------------------------------------------------------- /JavaFX-DatePicker/nbproject/configs/Run_in_Browser.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run in Browser 3 | -------------------------------------------------------------------------------- /JavaFX-DatePicker/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=be4a3811 2 | build.xml.script.CRC32=ab887725 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=be4a3811 7 | nbproject/build-impl.xml.script.CRC32=a62d202b 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /JavaFX-DatePicker/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | JavaFX-DatePicker 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /JavaFX-DatePicker/src/tutor/javafx/DatePickerExample.java: -------------------------------------------------------------------------------- 1 | package tutor.javafx; 2 | 3 | import java.time.DayOfWeek; 4 | import java.time.LocalDate; 5 | import java.time.format.DateTimeFormatter; 6 | import javafx.application.Application; 7 | import javafx.geometry.Insets; 8 | import javafx.geometry.Pos; 9 | import javafx.scene.Scene; 10 | import javafx.scene.control.DateCell; 11 | import javafx.scene.control.DatePicker; 12 | import javafx.scene.layout.Background; 13 | import javafx.scene.layout.BackgroundFill; 14 | import javafx.scene.layout.VBox; 15 | import javafx.scene.paint.Color; 16 | import javafx.scene.paint.Paint; 17 | import javafx.stage.Stage; 18 | import javafx.util.Callback; 19 | 20 | import javafx.util.converter.LocalDateStringConverter; 21 | 22 | public class DatePickerExample extends Application { 23 | 24 | @Override 25 | public void start(Stage primaryStage) { 26 | 27 | Callback dayCellFactory 28 | = date -> new DateCell() { 29 | @Override 30 | public void updateItem(LocalDate item, boolean empty) { 31 | 32 | super.updateItem(item, empty); 33 | 34 | this.setDisable(false); 35 | this.setBackground(null); 36 | this.setTextFill(Color.BLACK); 37 | 38 | // deshabilitar las fechas futuras 39 | if (item.isAfter(LocalDate.now())) { 40 | this.setDisable(true); 41 | } 42 | 43 | // marcar los dias de quincena 44 | int day = item.getDayOfMonth(); 45 | if(day == 15 || day == 30) { 46 | 47 | Paint color = Color.RED; 48 | BackgroundFill fill = new BackgroundFill(color, null, null); 49 | 50 | this.setBackground(new Background(fill)); 51 | this.setTextFill(Color.WHITESMOKE); 52 | } 53 | 54 | // fines de semana en color verde 55 | DayOfWeek dayweek = item.getDayOfWeek(); 56 | if (dayweek == DayOfWeek.SATURDAY || dayweek == DayOfWeek.SUNDAY) { 57 | this.setTextFill(Color.GREEN); 58 | } 59 | } 60 | }; 61 | 62 | DatePicker fecha1 = new DatePicker(); 63 | fecha1.setOnAction(e -> System.out.println("fecha: " + fecha1.getValue())); 64 | fecha1.setDayCellFactory(dayCellFactory); 65 | 66 | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yy"); 67 | 68 | DatePicker fecha2 = new DatePicker(LocalDate.now()); 69 | fecha2.setConverter(new LocalDateStringConverter(formatter, null)); 70 | fecha2.setShowWeekNumbers(true); 71 | 72 | VBox root = new VBox(fecha1, fecha2); 73 | root.setAlignment(Pos.TOP_LEFT); 74 | root.setSpacing(10.0); 75 | root.setPadding(new Insets(5.0)); 76 | 77 | Scene scene = new Scene(root, 800, 300); 78 | 79 | primaryStage.setTitle("JavaFX DatePicker"); 80 | primaryStage.setScene(scene); 81 | primaryStage.show(); 82 | } 83 | 84 | public static void main(String[] args) { 85 | launch(args); 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /JavaFX-Effects/build.xml: -------------------------------------------------------------------------------- 1 | 2 | Builds, tests, and runs the project JavaFX-Effects. 3 | 4 | 53 | 54 | -------------------------------------------------------------------------------- /JavaFX-Effects/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /JavaFX-Effects/nbproject/configs/Run_as_WebStart.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run as WebStart 3 | -------------------------------------------------------------------------------- /JavaFX-Effects/nbproject/configs/Run_in_Browser.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run in Browser 3 | -------------------------------------------------------------------------------- /JavaFX-Effects/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=2934c3e7 2 | build.xml.script.CRC32=e8cfdccc 3 | build.xml.stylesheet.CRC32=8064a381@1.75.2.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=2934c3e7 7 | nbproject/build-impl.xml.script.CRC32=886c0d9e 8 | nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48 9 | -------------------------------------------------------------------------------- /JavaFX-Effects/nbproject/project.properties: -------------------------------------------------------------------------------- 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=JavaFX-Effects 8 | application.vendor=Carmelo Mar\u00edn Abrego 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}/JavaFX-Effects.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=javafx.effects.Main 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 114 | -------------------------------------------------------------------------------- /JavaFX-Effects/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | JavaFX-Effects 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /JavaFX-Effects/src/javafx/effects/Main.java: -------------------------------------------------------------------------------- 1 | package javafx.effects; 2 | 3 | import javafx.application.Application; 4 | import javafx.collections.FXCollections; 5 | import javafx.geometry.Insets; 6 | import javafx.scene.Scene; 7 | import javafx.scene.control.Button; 8 | import javafx.scene.control.ComboBox; 9 | import javafx.scene.effect.*; 10 | import javafx.scene.layout.HBox; 11 | import javafx.scene.paint.Color; 12 | import javafx.scene.text.Font; 13 | import javafx.scene.text.Text; 14 | import javafx.stage.Stage; 15 | 16 | public class Main extends Application { 17 | 18 | @Override 19 | public void start(Stage primaryStage) throws Exception{ 20 | 21 | GaussianBlur gaussianBlur = new GaussianBlur(3.0); 22 | 23 | DropShadow dropShadow = new DropShadow(); 24 | dropShadow.setColor(Color.BLUE); 25 | dropShadow.setInput(gaussianBlur); 26 | 27 | Button btn = new Button("Hello Effects"); 28 | btn.setEffect(dropShadow); 29 | 30 | Text txt = new Text("Text GLOW"); 31 | txt.setEffect(new Reflection()); 32 | txt.setFont(new Font("Arial", 14.0)); 33 | 34 | ComboBox cbx = new ComboBox<>(); 35 | cbx.setItems(FXCollections.observableArrayList("Panama", "Chile", "Mexico")); 36 | cbx.setEffect(new GaussianBlur(4.0)); 37 | cbx.getSelectionModel().selectFirst(); 38 | 39 | HBox root = new HBox(btn, txt, cbx); 40 | root.setPadding(new Insets(10.0)); 41 | root.setSpacing(10.0); 42 | 43 | primaryStage.setTitle("JavaFX Effects"); 44 | primaryStage.setScene(new Scene(root)); 45 | primaryStage.show(); 46 | } 47 | 48 | public static void main(String[] args) { 49 | launch(args); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /JavaFX-Enlaces/build.xml: -------------------------------------------------------------------------------- 1 | 2 | Builds, tests, and runs the project JavaFX-Enlaces. 3 | 4 | 53 | 54 | -------------------------------------------------------------------------------- /JavaFX-Enlaces/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /JavaFX-Enlaces/nbproject/configs/Run_as_WebStart.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run as WebStart 3 | -------------------------------------------------------------------------------- /JavaFX-Enlaces/nbproject/configs/Run_in_Browser.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run in Browser 3 | -------------------------------------------------------------------------------- /JavaFX-Enlaces/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=3b78f30d 2 | build.xml.script.CRC32=adf986c8 3 | build.xml.stylesheet.CRC32=8064a381@1.75.2.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=3b78f30d 7 | nbproject/build-impl.xml.script.CRC32=5630e829 8 | nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48 9 | -------------------------------------------------------------------------------- /JavaFX-Enlaces/nbproject/project.properties: -------------------------------------------------------------------------------- 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=JavaFX-Enlaces 8 | application.vendor=Carmelo Mar\u00edn Abrego 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}/JavaFX-Enlaces.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=javafx.enlaces.JavaFXEnlaces 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 114 | -------------------------------------------------------------------------------- /JavaFX-Enlaces/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | JavaFX-Enlaces 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /JavaFX-Eventos/build.xml: -------------------------------------------------------------------------------- 1 | 2 | Builds, tests, and runs the project JavaFX-Eventos. 3 | 4 | 53 | 54 | -------------------------------------------------------------------------------- /JavaFX-Eventos/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /JavaFX-Eventos/nbproject/configs/Run_as_WebStart.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run as WebStart 3 | -------------------------------------------------------------------------------- /JavaFX-Eventos/nbproject/configs/Run_in_Browser.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run in Browser 3 | -------------------------------------------------------------------------------- /JavaFX-Eventos/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=93fbaac1 2 | build.xml.script.CRC32=84c86732 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=93fbaac1 7 | nbproject/build-impl.xml.script.CRC32=5424985d 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /JavaFX-Eventos/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | JavaFX-Eventos 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /JavaFX-Eventos/src/tutor/programacion/JavaFXKeyEvent.java: -------------------------------------------------------------------------------- 1 | package tutor.programacion; 2 | 3 | import javafx.application.Application; 4 | import javafx.geometry.Insets; 5 | import javafx.scene.Scene; 6 | import javafx.scene.control.PasswordField; 7 | import javafx.scene.control.TextArea; 8 | import javafx.scene.control.TextField; 9 | import javafx.scene.input.KeyEvent; 10 | import javafx.scene.layout.VBox; 11 | import javafx.stage.Stage; 12 | 13 | public class JavaFXKeyEvent extends Application { 14 | 15 | @Override 16 | public void start(Stage primaryStage) throws Exception { 17 | 18 | TextField tf1 = new TextField(); 19 | PasswordField tf2 = new PasswordField(); 20 | TextArea tf3 = new TextArea(); 21 | 22 | VBox root = new VBox(tf1, tf2, tf3); 23 | root.setSpacing(5.0); 24 | root.setPadding(new Insets(5.0)); 25 | 26 | Scene scene = new Scene(root, 300, 250); 27 | scene.addEventFilter(KeyEvent.KEY_TYPED, e -> { 28 | 29 | String type = e.getEventType().getName(); 30 | String source = e.getSource().getClass().getSimpleName(); 31 | String target = e.getTarget().getClass().getSimpleName(); 32 | 33 | System.out.println("filter: " + type + ", " + source + ", " + target); 34 | 35 | if (Character.isDigit(e.getCharacter().charAt(0))) { 36 | System.out.println("caracter: " + e.getCharacter() + ", no permitido."); 37 | e.consume(); 38 | } 39 | }); 40 | 41 | primaryStage.setTitle("JavaFX Manejo de Eventos"); 42 | primaryStage.setScene(scene); 43 | primaryStage.show(); 44 | } 45 | 46 | public static void main(String[] args) { 47 | launch(args); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /JavaFX-Eventos/src/tutor/programacion/JavaFXMouseEvent.java: -------------------------------------------------------------------------------- 1 | package tutor.programacion; 2 | 3 | import javafx.application.Application; 4 | import javafx.event.EventHandler; 5 | import javafx.scene.Scene; 6 | import javafx.scene.control.Button; 7 | import javafx.scene.input.MouseEvent; 8 | import javafx.scene.layout.StackPane; 9 | import javafx.stage.Stage; 10 | 11 | public class JavaFXMouseEvent extends Application { 12 | 13 | @Override 14 | public void start(Stage primaryStage) { 15 | 16 | EventHandler handler = new EventHandler() { 17 | @Override 18 | public void handle(MouseEvent e) { 19 | String type = e.getEventType().getName(); 20 | String source = e.getSource().getClass().getSimpleName(); 21 | String target = e.getTarget().getClass().getSimpleName(); 22 | 23 | System.out.println("handler: " + type + ", " + source + ", " + target); 24 | } 25 | }; 26 | 27 | EventHandler filter = (MouseEvent e) -> { 28 | String type = e.getEventType().getName(); 29 | String source = e.getSource().getClass().getSimpleName(); 30 | String target = e.getTarget().getClass().getSimpleName(); 31 | 32 | System.out.println("filter: " + type + ", " + source + ", " + target); 33 | }; 34 | 35 | Button btn = new Button(); 36 | btn.setText("Button"); 37 | btn.addEventHandler(MouseEvent.MOUSE_CLICKED, handler); 38 | 39 | StackPane root = new StackPane(); 40 | root.getChildren().add(btn); 41 | root.addEventFilter(MouseEvent.MOUSE_CLICKED, filter); 42 | 43 | Scene scene = new Scene(root, 300, 250); 44 | scene.addEventFilter(MouseEvent.MOUSE_CLICKED, filter); 45 | 46 | primaryStage.setTitle("JavaFX Manejo de Eventos"); 47 | primaryStage.setScene(scene); 48 | primaryStage.show(); 49 | } 50 | 51 | public static void main(String[] args) { 52 | launch(args); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /JavaFX-OpenCV/Readme.md: -------------------------------------------------------------------------------- 1 | # OpenCV & JavaFX 2 | Interacción de una aplicación *JavaFX* con la librería *OpenCV*, explica como convertir un objeto *org.opencv.core.Mat* a *javafx.scene.image.Image* para poder mostrarlo en un control ImageView. 3 | 4 | Además creamos un ScheduledService para obtener priodicamente en segundo plano una captura de la cámara, esto nos permite mostrar una secuencia fluida de video. 5 | 6 | Este proyecto no incluye la librería OpenCV, por lo que debemos descárgala y copiar la carpeta **/opencv/build/java** dentro de la carpeta de proyecto **/JavaFX-OpenCV/lib**. 7 | 8 | Puedes encontrar más información y otros tutoriales en: [Tutoriales JavaFX](http://acodigo.blogspot.com/p/tutorial-opencv.html) -------------------------------------------------------------------------------- /JavaFX-OpenCV/build.xml: -------------------------------------------------------------------------------- 1 | 2 | Builds, tests, and runs the project JavaFX-OpenCV. 3 | 4 | 53 | 54 | -------------------------------------------------------------------------------- /JavaFX-OpenCV/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TutorProgramacion/JavaFX-Tutoriales/67361200e8ffd2a9953624a727dfa3d1a51bbaa7/JavaFX-OpenCV/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar -------------------------------------------------------------------------------- /JavaFX-OpenCV/lib/nblibraries.properties: -------------------------------------------------------------------------------- 1 | libs.CopyLibs.classpath=\ 2 | ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar 3 | libs.CopyLibs.displayName=CopyLibs Task 4 | libs.CopyLibs.prop-version=2.0 5 | libs.OpenCV.classpath=\ 6 | ${base}/OpenCV/opencv-300.jar;\ 7 | ${base}/OpenCV/x64/;\ 8 | ${base}/OpenCV/x86/ 9 | libs.OpenCV.displayName=OpenCV 10 | -------------------------------------------------------------------------------- /JavaFX-OpenCV/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /JavaFX-OpenCV/nbproject/configs/Run_as_WebStart.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run as WebStart 3 | -------------------------------------------------------------------------------- /JavaFX-OpenCV/nbproject/configs/Run_in_Browser.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run in Browser 3 | -------------------------------------------------------------------------------- /JavaFX-OpenCV/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=74779cdc 2 | build.xml.script.CRC32=3183f2e1 3 | build.xml.stylesheet.CRC32=8064a381@1.75.2.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=74779cdc 7 | nbproject/build-impl.xml.script.CRC32=cccff066 8 | nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48 9 | -------------------------------------------------------------------------------- /JavaFX-OpenCV/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | JavaFX-OpenCV 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | .\lib\nblibraries.properties 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /JavaFX-OpenCV/src/carmelo/CameraTask.java: -------------------------------------------------------------------------------- 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 carmelo; 7 | 8 | import java.io.ByteArrayInputStream; 9 | import java.util.Objects; 10 | import java.util.function.Function; 11 | import javafx.concurrent.Task; 12 | import javafx.scene.image.Image; 13 | import org.opencv.core.Mat; 14 | import org.opencv.core.MatOfByte; 15 | import org.opencv.imgcodecs.Imgcodecs; 16 | import org.opencv.videoio.VideoCapture; 17 | 18 | /** 19 | * 20 | * @author Carmelo Marin Abrego 21 | */ 22 | public class CameraTask extends Task { 23 | 24 | private final VideoCapture capture; 25 | private final Function imgproc; 26 | 27 | public CameraTask(VideoCapture capture, Function imgproc) { 28 | this.capture = Objects.requireNonNull(capture); 29 | this.imgproc = Objects.requireNonNull(imgproc); 30 | } 31 | 32 | @Override 33 | protected Image call() throws Exception { 34 | 35 | // omitir si la camara no esta abierta 36 | if (!capture.isOpened()) { 37 | return null; 38 | } 39 | 40 | // obtiene la captura de la camara, lo almacena el frame 41 | Mat frame = new Mat(); 42 | capture.read(frame); 43 | 44 | // verificar si es una captura valida 45 | if (!frame.empty()) { 46 | // procesar y convertir la imagen 47 | Mat dst = imgproc.apply(frame); 48 | return createImageFromMat(dst); 49 | } 50 | 51 | return null; 52 | } 53 | 54 | // convertir cv::Mat a javafx.scene.image.Image 55 | private Image createImageFromMat(Mat src) { 56 | MatOfByte dst = new MatOfByte(); 57 | Imgcodecs.imencode(".bmp", src, dst); 58 | return new Image(new ByteArrayInputStream(dst.toArray())); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /JavaFX-OpenCV/src/carmelo/JavaFXOpenCV.java: -------------------------------------------------------------------------------- 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 carmelo; 7 | 8 | import javafx.application.Application; 9 | import javafx.concurrent.ScheduledService; 10 | import javafx.concurrent.Task; 11 | import javafx.concurrent.WorkerStateEvent; 12 | import javafx.event.ActionEvent; 13 | import javafx.geometry.Insets; 14 | import javafx.scene.Scene; 15 | import javafx.scene.control.Button; 16 | import javafx.scene.image.Image; 17 | import javafx.scene.image.ImageView; 18 | import javafx.scene.layout.VBox; 19 | import javafx.stage.Stage; 20 | import javafx.stage.WindowEvent; 21 | import javafx.util.Duration; 22 | import org.opencv.core.Core; 23 | import org.opencv.core.Mat; 24 | import org.opencv.core.Size; 25 | import org.opencv.imgproc.Imgproc; 26 | import org.opencv.videoio.VideoCapture; 27 | 28 | /** 29 | * 30 | * @author Carmelo Marin Abrego 31 | */ 32 | public class JavaFXOpenCV extends Application { 33 | 34 | static { 35 | System.loadLibrary(Core.NATIVE_LIBRARY_NAME); 36 | } 37 | 38 | private VideoCapture capture; 39 | private ImageView imageView; 40 | private ScheduledService service; 41 | 42 | @Override 43 | public void start(Stage primaryStage) { 44 | 45 | capture = new VideoCapture(); 46 | 47 | // servicio que ejecutar la captura periodicamente 48 | service = new ScheduledService() { 49 | @Override 50 | protected Task createTask() { 51 | // crear un CameraTask usando el VideoCapture y 52 | // el metodo para procesar la imagen idicado JavaFXOpenCV.this::procesarImagen 53 | return new CameraTask(capture, JavaFXOpenCV.this::procesarImagen); 54 | } 55 | }; 56 | 57 | // ejecutar el servicio cada 33.3 ms 58 | service.setPeriod(Duration.millis(33.333333)); 59 | 60 | // al finalizar cada ejecucion ejecutar el metodo this::ready 61 | service.setOnReady(this::ready); 62 | 63 | imageView = new ImageView(); 64 | imageView.setFitHeight(600); 65 | imageView.setFitWidth(800); 66 | 67 | Button btn = new Button(); 68 | btn.setText("Iniciar Camara"); 69 | btn.setOnAction(this::start); 70 | 71 | VBox root = new VBox(imageView, btn); 72 | root.setPadding(new Insets(10.0)); 73 | root.setSpacing(10.0); 74 | 75 | Scene scene = new Scene(root); 76 | 77 | primaryStage.setTitle("JavaFX & OpenCV"); 78 | primaryStage.setScene(scene); 79 | primaryStage.sizeToScene(); 80 | primaryStage.setOnCloseRequest(this::stop); 81 | primaryStage.setResizable(false); 82 | 83 | primaryStage.show(); 84 | } 85 | 86 | private Mat procesarImagen(Mat src) { 87 | Mat dst = new Mat(); 88 | 89 | Imgproc.cvtColor(src, dst, Imgproc.COLOR_BGR2GRAY); 90 | Imgproc.GaussianBlur(dst, dst, new Size(7, 7), 1.5, 1.5); 91 | Imgproc.Canny(dst, dst, 0, 30, 3, false); 92 | 93 | return dst; 94 | } 95 | 96 | private void ready(WorkerStateEvent worker) { 97 | Image image = (Image) worker.getSource().getValue(); 98 | if (image != null) { 99 | imageView.setImage(image); 100 | } 101 | } 102 | 103 | private void start(ActionEvent e) { 104 | if (!capture.isOpened() && !service.isRunning()) { 105 | capture.open(0); 106 | service.start(); 107 | } 108 | } 109 | 110 | private void stop(WindowEvent e) { 111 | service.cancel(); 112 | capture.release(); 113 | } 114 | 115 | /** 116 | * @param args the command line arguments 117 | */ 118 | public static void main(String[] args) { 119 | launch(args); 120 | } 121 | 122 | } 123 | -------------------------------------------------------------------------------- /JavaFX-Pagination/build.xml: -------------------------------------------------------------------------------- 1 | 2 | Builds, tests, and runs the project JavaFX-Pagination. 3 | 4 | 53 | 54 | -------------------------------------------------------------------------------- /JavaFX-Pagination/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /JavaFX-Pagination/nbproject/configs/Run_as_WebStart.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run as WebStart 3 | -------------------------------------------------------------------------------- /JavaFX-Pagination/nbproject/configs/Run_in_Browser.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run in Browser 3 | -------------------------------------------------------------------------------- /JavaFX-Pagination/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=fde4fea8 2 | build.xml.script.CRC32=8f7175ab 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=fde4fea8 7 | nbproject/build-impl.xml.script.CRC32=706a48f4 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /JavaFX-Pagination/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | JavaFX-Pagination 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /JavaFX-Pagination/src/tutor/javafx/JavaFXPaginationExample.java: -------------------------------------------------------------------------------- 1 | package tutor.javafx; 2 | 3 | import java.io.File; 4 | import java.util.List; 5 | import javafx.application.Application; 6 | import javafx.geometry.Insets; 7 | import javafx.scene.Node; 8 | import javafx.scene.Scene; 9 | import javafx.scene.control.Button; 10 | import javafx.scene.control.Label; 11 | import javafx.scene.control.Pagination; 12 | import javafx.scene.control.TextField; 13 | import javafx.scene.image.ImageView; 14 | import javafx.scene.layout.HBox; 15 | import javafx.scene.layout.Priority; 16 | import javafx.scene.layout.VBox; 17 | import javafx.stage.FileChooser; 18 | import javafx.stage.FileChooser.ExtensionFilter; 19 | import javafx.stage.Stage; 20 | 21 | public class JavaFXPaginationExample extends Application { 22 | 23 | private List imageList; 24 | private Pagination pagination; 25 | 26 | @Override 27 | public void start(Stage primaryStage) { 28 | 29 | pagination = new Pagination(); 30 | pagination.setPageFactory(index -> { 31 | if (imageList != null && index < imageList.size()) { 32 | 33 | String url = imageList.get(index).toURI().toString(); 34 | 35 | ImageView imageView = new ImageView(url); 36 | imageView.setPreserveRatio(true); 37 | imageView.setFitHeight(400); 38 | imageView.setFitWidth(600); 39 | 40 | return imageView; 41 | 42 | } else { 43 | return new Label("No hay imagen seleccionada."); 44 | } 45 | }); 46 | 47 | VBox.setVgrow(pagination, Priority.ALWAYS); 48 | 49 | VBox root = new VBox(createTopBar(primaryStage), pagination); 50 | root.setSpacing(10.0); 51 | root.setPadding(new Insets(10.0)); 52 | 53 | Scene scene = new Scene(root, 800, 600); 54 | 55 | primaryStage.setTitle("JavaFX Pagination"); 56 | primaryStage.setScene(scene); 57 | primaryStage.show(); 58 | } 59 | 60 | public Node createTopBar(Stage stage) { 61 | 62 | HBox box = new HBox(); 63 | box.setSpacing(10.0); 64 | 65 | TextField tf = new TextField(); 66 | tf.setPromptText("buscar carpeta de imagenes"); 67 | tf.setEditable(false); 68 | tf.setFocusTraversable(false); 69 | 70 | HBox.setHgrow(tf, Priority.ALWAYS); 71 | 72 | FileChooser fileDialog = new FileChooser(); 73 | fileDialog.getExtensionFilters() 74 | .add(new ExtensionFilter("Imagen", "*.jpg", "*.png", "*.bmp", "*.gif")); 75 | 76 | Button btn = new Button("..."); 77 | btn.setOnAction(e -> { 78 | fileDialog.setTitle("Abrir imagenes"); 79 | imageList = fileDialog.showOpenMultipleDialog(stage); 80 | if(imageList != null) { 81 | pagination.setPageCount(imageList.size()); 82 | tf.setText(imageList.get(0).getParent()); 83 | } 84 | }); 85 | 86 | box.getChildren().add(tf); 87 | box.getChildren().add(btn); 88 | 89 | return box; 90 | } 91 | 92 | public static void main(String[] args) { 93 | launch(args); 94 | } 95 | 96 | } 97 | -------------------------------------------------------------------------------- /JavaFX-PieChart/build.xml: -------------------------------------------------------------------------------- 1 | 2 | Builds, tests, and runs the project JavaFX-PieChart. 3 | 4 | 53 | 54 | -------------------------------------------------------------------------------- /JavaFX-PieChart/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /JavaFX-PieChart/nbproject/configs/Run_as_WebStart.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run as WebStart 3 | -------------------------------------------------------------------------------- /JavaFX-PieChart/nbproject/configs/Run_in_Browser.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run in Browser 3 | -------------------------------------------------------------------------------- /JavaFX-PieChart/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=a6fc38eb 2 | build.xml.script.CRC32=a2682e30 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=a6fc38eb 7 | nbproject/build-impl.xml.script.CRC32=54af1a38 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /JavaFX-PieChart/nbproject/project.properties: -------------------------------------------------------------------------------- 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=JavaFX-PieChart 8 | application.vendor=Carmelo Mar\u00edn Abrego 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}/JavaFX-PieChart.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=tutor.javafx.PieChartExample 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 114 | -------------------------------------------------------------------------------- /JavaFX-PieChart/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | JavaFX-PieChart 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /JavaFX-PieChart/src/tutor/javafx/PieChartExample.java: -------------------------------------------------------------------------------- 1 | package tutor.javafx; 2 | 3 | import javafx.application.Application; 4 | import javafx.collections.FXCollections; 5 | import javafx.collections.ObservableList; 6 | import javafx.geometry.Side; 7 | import javafx.scene.Scene; 8 | import javafx.scene.chart.PieChart; 9 | import javafx.scene.control.Tooltip; 10 | import javafx.scene.layout.StackPane; 11 | import javafx.stage.Stage; 12 | 13 | public class PieChartExample extends Application { 14 | 15 | @Override 16 | public void start(Stage primaryStage) { 17 | 18 | ObservableList data = FXCollections.observableArrayList(); 19 | data.add(new PieChart.Data("OpenCV", 20)); 20 | data.add(new PieChart.Data("JavaFX", 40)); 21 | data.add(new PieChart.Data("Python", 10)); 22 | data.add(new PieChart.Data("Spring", 15)); 23 | data.add(new PieChart.Data("Qt", 10)); 24 | data.add(new PieChart.Data("SQL", 17)); 25 | 26 | PieChart pie = new PieChart(data); 27 | pie.setTitle("PieChart Tutorial 2017"); 28 | pie.setLegendSide(Side.LEFT); 29 | pie.setTitleSide(Side.BOTTOM); 30 | pie.setLabelLineLength(60); 31 | pie.setLabelsVisible(true); 32 | 33 | pie.getData().forEach(this::installTooltip); 34 | 35 | StackPane root = new StackPane(pie); 36 | Scene scene = new Scene(root, 800, 600); 37 | scene.getStylesheets().add(getClass().getResource("style.css").toExternalForm()); 38 | 39 | primaryStage.setTitle("JavaFX PieChart"); 40 | primaryStage.setScene(scene); 41 | primaryStage.show(); 42 | } 43 | 44 | public void installTooltip(PieChart.Data d) { 45 | 46 | String msg = String.format("%s : %s", d.getName(), d.getPieValue()); 47 | 48 | Tooltip tt = new Tooltip(msg); 49 | tt.setStyle("-fx-background-color: gray; -fx-text-fill: whitesmoke;"); 50 | 51 | Tooltip.install(d.getNode(), tt); 52 | } 53 | 54 | public static void main(String[] args) { 55 | launch(args); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /JavaFX-PieChart/src/tutor/javafx/style.css: -------------------------------------------------------------------------------- 1 | 2 | .chart { 3 | -fx-clockwise: false; 4 | -fx-pie-label-visible: true; 5 | -fx-label-line-length: 25; 6 | -fx-start-angle: 90; 7 | -fx-legend-side: right; 8 | } 9 | 10 | .chart-pie-label { 11 | -fx-font-size: 14px; 12 | -fx-font-family: Roboto Light; 13 | } 14 | 15 | .chart-pie-label-line { 16 | -fx-fill: red; 17 | } 18 | 19 | /* 20 | .chart-content { 21 | -fx-padding: 10px; 22 | } 23 | */ 24 | 25 | .chart-title { 26 | -fx-font-family: Roboto; 27 | -fx-font-size: 28px; 28 | } 29 | 30 | .chart-legend-item-symbol { 31 | -fx-shape: "M0 -3.5 v7 l 4 -3.5z"; 32 | } 33 | 34 | /* 35 | .default-color0.chart-pie { 36 | -fx-pie-color:blue; 37 | } 38 | .default-color1.chart-pie { 39 | -fx-pie-color:red; 40 | } 41 | .default-color2.chart-pie { 42 | -fx-pie-color:green; 43 | } 44 | */ 45 | 46 | .chart-legend { 47 | -fx-background-color: #f0e68c; 48 | -fx-background-radius: 4px; 49 | -fx-border-color: #696969; 50 | -fx-border-width: 1; 51 | -fx-border-radius: 4px; 52 | } -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader-Preloader/build.xml: -------------------------------------------------------------------------------- 1 | 2 | Builds, tests, and runs the project JFXTestPreloader-Preloader. 3 | 4 | 53 | 54 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader-Preloader/lib/medusa-3.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TutorProgramacion/JavaFX-Tutoriales/67361200e8ffd2a9953624a727dfa3d1a51bbaa7/JavaFX-Preloader/JFXTestPreloader-Preloader/lib/medusa-3.5.jar -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader-Preloader/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader-Preloader/nbproject/configs/Run_as_WebStart.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run as WebStart 3 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader-Preloader/nbproject/configs/Run_in_Browser.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run in Browser 3 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader-Preloader/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=f96f0212 2 | build.xml.script.CRC32=e8a8f17d 3 | build.xml.stylesheet.CRC32=8064a381@1.75.2.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=f96f0212 7 | nbproject/build-impl.xml.script.CRC32=43b36716 8 | nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48 9 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader-Preloader/nbproject/private/configs/Run_as_WebStart.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | javafx.run.as=webstart 3 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader-Preloader/nbproject/private/configs/Run_in_Browser.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | javafx.run.as=embedded 3 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader-Preloader/nbproject/private/private.properties: -------------------------------------------------------------------------------- 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= 5 | javafx.run.inbrowser.path=C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe 6 | user.properties.file=C:\\Users\\Carmelo Mar\u00edn Abrego\\AppData\\Roaming\\NetBeans\\8.0\\build.properties 7 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader-Preloader/nbproject/private/private.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader-Preloader/nbproject/project.properties: -------------------------------------------------------------------------------- 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=JFXTestPreloader-Preloader 8 | application.vendor=Carmelo Mar\u00edn Abrego 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}/JFXTestPreloader-Preloader.jar 30 | dist.javadoc.dir=${dist.dir}/javadoc 31 | endorsed.classpath= 32 | excludes= 33 | file.reference.medusa-3.5.jar=lib\\medusa-3.5.jar 34 | includes=** 35 | jar.compress=false 36 | javac.classpath=\ 37 | ${javafx.classpath.extension}:\ 38 | ${file.reference.medusa-3.5.jar} 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 | ${platforms.JDK_1.8u74.home}/jre/lib/javaws.jar:\ 66 | ${platforms.JDK_1.8u74.home}/jre/lib/deploy.jar:\ 67 | ${platforms.JDK_1.8u74.home}/jre/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 | # This project is a Preloader 81 | javafx.preloader=true 82 | # Preloader can not use a preloader 83 | javafx.preloader.enabled=false 84 | # Set true for GlassFish only. Rebases manifest classpaths of JARs in lib dir. Not usable with signed JARs. 85 | javafx.rebase.libs=false 86 | javafx.run.height=600 87 | javafx.run.width=800 88 | # Pre-JavaFX 2.0 WebStart is deactivated in JavaFX 2.0+ projects 89 | jnlp.enabled=false 90 | # For improved security specify narrower Codebase manifest attribute to prevent RIAs from being repurposed 91 | manifest.custom.codebase=* 92 | # Specify Permissions manifest attribute to override default (choices: sandbox, all-permissions) 93 | manifest.custom.permissions= 94 | manifest.file=manifest.mf 95 | meta.inf.dir=${src.dir}/META-INF 96 | platform.active=JDK_1.8u74 97 | run.classpath=\ 98 | ${dist.jar}:\ 99 | ${javac.classpath}:\ 100 | ${build.classes.dir} 101 | run.test.classpath=\ 102 | ${javac.test.classpath}:\ 103 | ${build.test.classes.dir} 104 | source.encoding=UTF-8 105 | src.dir=src 106 | test.src.dir=test 107 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader-Preloader/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | JFXTestPreloader-Preloader 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader-Preloader/src/jfxtestpreloader/preloader/JFXTestPreloader_Preloader.java: -------------------------------------------------------------------------------- 1 | package jfxtestpreloader.preloader; 2 | 3 | import javafx.application.Preloader; 4 | import javafx.application.Preloader.StateChangeNotification; 5 | import javafx.geometry.Pos; 6 | import javafx.scene.Scene; 7 | import javafx.scene.control.Label; 8 | import javafx.scene.image.ImageView; 9 | import javafx.scene.layout.BorderPane; 10 | import javafx.scene.layout.VBox; 11 | import javafx.scene.paint.Color; 12 | import javafx.stage.Stage; 13 | import javafx.stage.StageStyle; 14 | 15 | /** 16 | * Simple Preloader Using the ProgressBar Control 17 | * 18 | * @author Carmelo Marin Abrego 19 | */ 20 | public class JFXTestPreloader_Preloader extends Preloader { 21 | 22 | private Stage stage; 23 | 24 | private Scene createPreloaderScene() { 25 | String url = getClass().getResource("loader.GIF").toExternalForm(); 26 | ImageView progress = new ImageView(url); 27 | 28 | Label title = new Label("Tutor de Programación"); 29 | title.setStyle("-fx-font-size: 2.3em; -fx-text-fill: whitesmoke;"); 30 | 31 | Label footer = new Label("Blog: Tutor de Programación"); 32 | footer.setStyle("-fx-font-size: 0.95em; -fx-text-fill: whitesmoke; -fx-font-style: oblique;"); 33 | 34 | VBox root = new VBox(); 35 | root.setSpacing(10.0); 36 | root.setAlignment(Pos.CENTER); 37 | root.getChildren().addAll(title, progress); 38 | 39 | BorderPane pane = new BorderPane(root); 40 | pane.setBottom(footer); 41 | pane.setStyle("-fx-background-color: #2b579a;"); 42 | 43 | return new Scene(pane, 480, 320, Color.TRANSPARENT); 44 | } 45 | 46 | @Override 47 | public void start(Stage stage) throws Exception { 48 | this.stage = stage; 49 | 50 | stage.initStyle(StageStyle.TRANSPARENT); 51 | stage.setScene(createPreloaderScene()); 52 | stage.show(); 53 | } 54 | 55 | @Override 56 | public void handleStateChangeNotification(StateChangeNotification scn) { 57 | if (scn.getType() == StateChangeNotification.Type.BEFORE_START) { 58 | stage.hide(); 59 | } 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader-Preloader/src/jfxtestpreloader/preloader/MedusaPreloader.java: -------------------------------------------------------------------------------- 1 | package jfxtestpreloader.preloader; 2 | 3 | import eu.hansolo.medusa.Gauge; 4 | import eu.hansolo.medusa.GaugeBuilder; 5 | import javafx.application.Preloader; 6 | import javafx.geometry.Insets; 7 | import javafx.scene.Scene; 8 | import javafx.scene.control.Label; 9 | import javafx.scene.layout.Background; 10 | import javafx.scene.layout.BackgroundFill; 11 | import javafx.scene.layout.BorderPane; 12 | import javafx.scene.layout.CornerRadii; 13 | import javafx.scene.layout.StackPane; 14 | import javafx.scene.paint.Color; 15 | import javafx.scene.paint.Stop; 16 | import javafx.stage.Stage; 17 | import javafx.stage.StageStyle; 18 | 19 | /** 20 | * 21 | * @author Carmelo Marin Abrego 22 | */ 23 | public class MedusaPreloader extends Preloader { 24 | 25 | private Stage stage; 26 | private Gauge gauge; 27 | 28 | private Scene createMedusaPreloaderScene() { 29 | gauge = GaugeBuilder.create() 30 | .skinType(Gauge.SkinType.LEVEL) 31 | .title("Cargando...") 32 | .titleColor(Color.WHITE) 33 | .animated(true) 34 | .gradientBarEnabled(true) 35 | .gradientBarStops(new Stop(0.0, Color.RED), 36 | new Stop(0.25, Color.ORANGE), 37 | new Stop(0.5, Color.YELLOW), 38 | new Stop(0.75, Color.YELLOWGREEN), 39 | new Stop(1.0, Color.LIME)) 40 | .build(); 41 | 42 | StackPane pane = new StackPane(gauge); 43 | pane.setPadding(new Insets(75)); 44 | 45 | Label footer = new Label("Blog: Tutor de Programación"); 46 | footer.setStyle("-fx-font-size: 0.95em; -fx-text-fill: whitesmoke; -fx-font-style: oblique;"); 47 | footer.setPadding(new Insets(10.0)); 48 | 49 | BorderPane root = new BorderPane(pane); 50 | root.setBackground(new Background(new BackgroundFill(Color.rgb(90, 90, 90), CornerRadii.EMPTY, Insets.EMPTY))); 51 | root.setBottom(footer); 52 | 53 | return new Scene(root, 480, 320, Color.TRANSPARENT); 54 | } 55 | 56 | @Override 57 | public void start(Stage stage) throws Exception { 58 | this.stage = stage; 59 | 60 | stage.initStyle(StageStyle.TRANSPARENT); 61 | stage.setScene(createMedusaPreloaderScene()); 62 | stage.show(); 63 | } 64 | 65 | @Override 66 | public void handleApplicationNotification(PreloaderNotification pn) { 67 | if (pn instanceof ProgressNotification) { 68 | double value = ((ProgressNotification) pn).getProgress(); 69 | gauge.setValue(value); 70 | } else if (pn instanceof StateChangeNotification) { 71 | stage.hide(); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader-Preloader/src/jfxtestpreloader/preloader/loader.GIF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TutorProgramacion/JavaFX-Tutoriales/67361200e8ffd2a9953624a727dfa3d1a51bbaa7/JavaFX-Preloader/JFXTestPreloader-Preloader/src/jfxtestpreloader/preloader/loader.GIF -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader/build.xml: -------------------------------------------------------------------------------- 1 | 2 | Builds, tests, and runs the project JFXTestPreloader. 3 | 4 | 53 | 54 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader/nbproject/configs/Run_as_WebStart.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run as WebStart 3 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader/nbproject/configs/Run_in_Browser.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run in Browser 3 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=64340e12 2 | build.xml.script.CRC32=c7576aa4 3 | build.xml.stylesheet.CRC32=8064a381@1.75.2.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=1a9522af 7 | nbproject/build-impl.xml.script.CRC32=3d7cc8a1 8 | nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48 9 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader/nbproject/private/configs/Run_as_WebStart.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | javafx.run.as=webstart 3 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader/nbproject/private/configs/Run_in_Browser.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | javafx.run.as=embedded 3 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader/nbproject/private/private.properties: -------------------------------------------------------------------------------- 1 | auxiliary.org-netbeans-modules-projectapi.issue214819_5f_fx_5f_enabled=true 2 | compile.on.save=true 3 | do.depend=false 4 | do.jar=true 5 | # No need to modify this property unless customizing JavaFX Ant task infrastructure 6 | endorsed.javafx.ant.classpath=. 7 | javac.debug=true 8 | javadoc.preview=true 9 | javafx.run.as=standalone 10 | javafx.run.inbrowser= 11 | javafx.run.inbrowser.path=C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe 12 | user.properties.file=C:\\Users\\Carmelo Mar\u00edn Abrego\\AppData\\Roaming\\NetBeans\\8.0\\build.properties 13 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader/nbproject/private/private.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | JFXTestPreloader 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | JFXTestPreloader-Preloader 28 | jar 29 | 30 | jar 31 | clean 32 | jar 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader/src/jfxtestpreloader/JFXTestMedusaPreloader.java: -------------------------------------------------------------------------------- 1 | package jfxtestpreloader; 2 | 3 | import javafx.application.Application; 4 | import javafx.application.Platform; 5 | import javafx.application.Preloader.ProgressNotification; 6 | import javafx.application.Preloader.StateChangeNotification; 7 | import javafx.beans.property.BooleanProperty; 8 | import javafx.beans.property.SimpleBooleanProperty; 9 | import javafx.concurrent.Task; 10 | import javafx.scene.Scene; 11 | import javafx.scene.control.Label; 12 | import javafx.scene.layout.StackPane; 13 | import javafx.stage.Stage; 14 | 15 | /** 16 | * 17 | * @author Carmelo Marin Abrego 18 | */ 19 | public class JFXTestMedusaPreloader extends Application { 20 | 21 | BooleanProperty ready = new SimpleBooleanProperty(false); 22 | 23 | private void longStart() { 24 | Task task = new Task() { 25 | @Override 26 | protected Void call() throws Exception { 27 | int max = 100; 28 | // enviar notidicacion de progreso cada 50 ms 29 | for (int i = 1; i <= max; i++) { 30 | Thread.sleep(50); 31 | notifyPreloader(new ProgressNotification(i)); 32 | } 33 | 34 | Thread.sleep(500); 35 | // indicar que la carga ha terminado, 100% completa 36 | ready.setValue(Boolean.TRUE); 37 | notifyPreloader(new StateChangeNotification(StateChangeNotification.Type.BEFORE_START)); 38 | 39 | return null; 40 | } 41 | }; 42 | new Thread(task).start(); 43 | } 44 | 45 | @Override 46 | public void start(final Stage stage) throws Exception { 47 | // simular carga 48 | longStart(); 49 | 50 | Label label = new Label("JavaFX Medusa Preloader"); 51 | StackPane pane = new StackPane(label); 52 | stage.setTitle("Tutor de Programacion"); 53 | stage.setScene(new Scene(pane, 400, 400)); 54 | 55 | // Abrir el stage principal cuando la carga este al 100% 56 | ready.addListener((ov, t, t1) -> { 57 | if (Boolean.TRUE.equals(t1)) { 58 | Platform.runLater(() -> { 59 | stage.show(); 60 | }); 61 | } 62 | }); 63 | } 64 | 65 | public static void main(String[] args) { 66 | launch(args); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /JavaFX-Preloader/JFXTestPreloader/src/jfxtestpreloader/JFXTestPreloader.java: -------------------------------------------------------------------------------- 1 | package jfxtestpreloader; 2 | 3 | import javafx.application.Application; 4 | import javafx.event.ActionEvent; 5 | import javafx.scene.Scene; 6 | import javafx.scene.control.Button; 7 | import javafx.scene.layout.StackPane; 8 | import javafx.stage.Stage; 9 | 10 | /** 11 | * 12 | * @author Carmelo Marin Abrego 13 | */ 14 | public class JFXTestPreloader extends Application { 15 | 16 | @Override 17 | public void init() throws Exception { 18 | Thread.sleep(3500); 19 | } 20 | 21 | @Override 22 | public void start(Stage primaryStage) { 23 | Button btn = new Button(); 24 | btn.setText("Say 'Hello World'"); 25 | btn.setOnAction((ActionEvent event) -> { 26 | System.out.println("Hello World!"); 27 | }); 28 | 29 | StackPane root = new StackPane(); 30 | root.getChildren().add(btn); 31 | 32 | Scene scene = new Scene(root, 300, 250); 33 | 34 | primaryStage.setTitle("Hello World!"); 35 | primaryStage.setScene(scene); 36 | primaryStage.show(); 37 | } 38 | 39 | /** 40 | * @param args the command line arguments 41 | */ 42 | public static void main(String[] args) { 43 | launch(args); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /JavaFX-ScrollBar_ScrollPane/build.xml: -------------------------------------------------------------------------------- 1 | 2 | Builds, tests, and runs the project JavaFX-ScrollBar_ScrollPane. 3 | 4 | 53 | 54 | -------------------------------------------------------------------------------- /JavaFX-ScrollBar_ScrollPane/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /JavaFX-ScrollBar_ScrollPane/nbproject/configs/Run_as_WebStart.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run as WebStart 3 | -------------------------------------------------------------------------------- /JavaFX-ScrollBar_ScrollPane/nbproject/configs/Run_in_Browser.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run in Browser 3 | -------------------------------------------------------------------------------- /JavaFX-ScrollBar_ScrollPane/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=a0d77191 2 | build.xml.script.CRC32=e6ea6694 3 | build.xml.stylesheet.CRC32=8064a381@1.75.2.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=a0d77191 7 | nbproject/build-impl.xml.script.CRC32=606ef1c8 8 | nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48 9 | -------------------------------------------------------------------------------- /JavaFX-ScrollBar_ScrollPane/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | JavaFX-ScrollBar_ScrollPane 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /JavaFX-ScrollBar_ScrollPane/src/carmelo/javafx/TutorialScrollBar.java: -------------------------------------------------------------------------------- 1 | package carmelo.javafx; 2 | 3 | import javafx.application.Application; 4 | import javafx.geometry.Orientation; 5 | import javafx.scene.Scene; 6 | import javafx.scene.canvas.Canvas; 7 | import javafx.scene.canvas.GraphicsContext; 8 | import javafx.scene.control.ScrollBar; 9 | import javafx.scene.image.Image; 10 | import javafx.scene.layout.HBox; 11 | import javafx.scene.layout.VBox; 12 | import javafx.stage.Stage; 13 | 14 | public class TutorialScrollBar extends Application { 15 | 16 | @Override 17 | public void start(Stage primaryStage) { 18 | 19 | Image image = new Image(getClass().getResourceAsStream("gears.jpg")); 20 | 21 | Canvas canvas = new Canvas(800, 600); 22 | 23 | double width = canvas.getWidth(); 24 | double height = canvas.getHeight(); 25 | 26 | GraphicsContext gc = canvas.getGraphicsContext2D(); 27 | gc.drawImage(image, 0, 0, width, height, 0, 0, width, height); 28 | 29 | ScrollBar vertical = new ScrollBar(); 30 | vertical.setOrientation(Orientation.VERTICAL); 31 | vertical.setMin(0); 32 | vertical.setMax(image.getHeight()); 33 | vertical.setVisibleAmount(height); 34 | vertical.setMaxHeight(height); 35 | 36 | ScrollBar horizontal = new ScrollBar(); 37 | horizontal.setOrientation(Orientation.HORIZONTAL); 38 | horizontal.setMin(0); 39 | horizontal.setMax(image.getWidth()); 40 | horizontal.setVisibleAmount(width); 41 | horizontal.setMaxWidth(width); 42 | 43 | vertical.valueProperty().addListener((property, old, value) -> { 44 | double dy = vertical.getValue(); 45 | double dx = horizontal.getValue(); 46 | 47 | gc.drawImage(image, dx, dy, width, height, 0, 0, width, height); 48 | }); 49 | 50 | horizontal.valueProperty().addListener((property, old, value) -> { 51 | double dy = vertical.getValue(); 52 | double dx = horizontal.getValue(); 53 | 54 | gc.drawImage(image, dx, dy, width, height, 0, 0, width, height); 55 | }); 56 | 57 | HBox root = new HBox(new VBox(canvas, horizontal), vertical); 58 | 59 | Scene scene = new Scene(root); 60 | 61 | primaryStage.setTitle("JavaFX ScrollBar"); 62 | primaryStage.setScene(scene); 63 | primaryStage.show(); 64 | } 65 | 66 | 67 | /** 68 | * @param args the command line arguments 69 | */ 70 | public static void main(String[] args) { 71 | launch(args); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /JavaFX-ScrollBar_ScrollPane/src/carmelo/javafx/TutorialScrollPane.java: -------------------------------------------------------------------------------- 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 carmelo.javafx; 7 | 8 | import javafx.application.Application; 9 | import javafx.scene.Scene; 10 | import javafx.scene.control.Label; 11 | import javafx.scene.control.ScrollPane; 12 | import javafx.scene.image.Image; 13 | import javafx.scene.image.ImageView; 14 | import javafx.stage.Stage; 15 | 16 | /** 17 | * 18 | * @author Carmelo Marín Abrego 19 | */ 20 | public class TutorialScrollPane extends Application { 21 | 22 | @Override 23 | public void start(Stage primaryStage) { 24 | 25 | Image image = new Image(getClass().getResourceAsStream("gears.jpg")); 26 | ImageView view = new ImageView(image); 27 | 28 | ScrollPane root = new ScrollPane(); 29 | root.setContent(view); 30 | root.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); 31 | root.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); 32 | root.setPannable(true); 33 | 34 | Scene scene = new Scene(root, 800, 600); 35 | 36 | primaryStage.setTitle("JavaFX ScrollPane"); 37 | primaryStage.setScene(scene); 38 | primaryStage.show(); 39 | } 40 | 41 | /** 42 | * @param args the command line arguments 43 | */ 44 | public static void main(String[] args) { 45 | launch(args); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /JavaFX-ScrollBar_ScrollPane/src/carmelo/javafx/gears.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TutorProgramacion/JavaFX-Tutoriales/67361200e8ffd2a9953624a727dfa3d1a51bbaa7/JavaFX-ScrollBar_ScrollPane/src/carmelo/javafx/gears.jpg -------------------------------------------------------------------------------- /JavaFX-SearchComboBox/Readme.md: -------------------------------------------------------------------------------- 1 | # JavaFX Control SearchComboBox 2 | 3 | Extendemos la clase `ComboBox` y `ComboBoxListViewSkin` para redefinir la apariencia y comportamiento de un control ComboBox, le agregamos la fucnionalidad de filtro de busquedas para facilitar el uso. 4 | 5 | Su uso es similiar al ComboBox, solo debemos agregar el filtro: 6 | 7 | ```java 8 | SearchComboBox cbx = new SearchComboBox<>(); 9 | cbx.setItems(items); 10 | cbx.setFilter((item, text) -> item.contains(text)); 11 | cbx.setPrefWidth(250.0); 12 | cbx.getSelectionModel().select(5); 13 | ``` 14 | 15 | Encuentra más información en mi blog: [Tutor de Programación](http://acodigo.blogspot.com/ "Blog de Programación") -------------------------------------------------------------------------------- /JavaFX-SearchComboBox/build.xml: -------------------------------------------------------------------------------- 1 | 2 | Builds, tests, and runs the project SearchComboBox. 3 | 4 | 53 | 54 | -------------------------------------------------------------------------------- /JavaFX-SearchComboBox/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /JavaFX-SearchComboBox/nbproject/configs/Run_as_WebStart.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run as WebStart 3 | -------------------------------------------------------------------------------- /JavaFX-SearchComboBox/nbproject/configs/Run_in_Browser.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run in Browser 3 | -------------------------------------------------------------------------------- /JavaFX-SearchComboBox/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=468e7dbe 2 | build.xml.script.CRC32=ce443754 3 | build.xml.stylesheet.CRC32=8064a381@1.75.2.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=468e7dbe 7 | nbproject/build-impl.xml.script.CRC32=dc4af2be 8 | nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48 9 | -------------------------------------------------------------------------------- /JavaFX-SearchComboBox/nbproject/private/configs/Run_as_WebStart.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | javafx.run.as=webstart 3 | -------------------------------------------------------------------------------- /JavaFX-SearchComboBox/nbproject/private/configs/Run_in_Browser.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | javafx.run.as=embedded 3 | -------------------------------------------------------------------------------- /JavaFX-SearchComboBox/nbproject/private/private.properties: -------------------------------------------------------------------------------- 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= 5 | javafx.run.inbrowser.path=C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe 6 | user.properties.file=C:\\Users\\Carmelo Mar\u00edn Abrego\\AppData\\Roaming\\NetBeans\\8.0\\build.properties 7 | -------------------------------------------------------------------------------- /JavaFX-SearchComboBox/nbproject/private/private.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JavaFX-SearchComboBox/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | SearchComboBox 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /JavaFX-SearchComboBox/src/carmelo/SearchComboBox.java: -------------------------------------------------------------------------------- 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 carmelo; 7 | 8 | import java.util.function.BiPredicate; 9 | import java.util.function.Predicate; 10 | import javafx.collections.FXCollections; 11 | import javafx.collections.ObservableList; 12 | import javafx.collections.transformation.FilteredList; 13 | import javafx.scene.control.ComboBox; 14 | import javafx.scene.control.Skin; 15 | 16 | /** 17 | * 18 | * @author Carmelo Marin Abrego 19 | */ 20 | public class SearchComboBox extends ComboBox { 21 | 22 | private FilteredList filterList; 23 | private BiPredicate filter; 24 | 25 | public SearchComboBox() { 26 | this(FXCollections.observableArrayList()); 27 | } 28 | 29 | public SearchComboBox(ObservableList items) { 30 | 31 | this.filterList = new FilteredList<>(items); 32 | this.filter = (i, s) -> true; 33 | 34 | super.setItems(items); 35 | super.itemsProperty().addListener((p, o, n) -> { 36 | this.filterList = new FilteredList<>(n); 37 | }); 38 | } 39 | 40 | @Override 41 | protected Skin createDefaultSkin() { 42 | return new SearchComboBoxSkin<>(this); 43 | } 44 | 45 | public void setFilter(BiPredicate filter) { 46 | this.filter = filter; 47 | } 48 | 49 | public BiPredicate getFilter() { 50 | return filter; 51 | } 52 | 53 | public void setPredicateFilter(Predicate predicate) { 54 | filterList.setPredicate(predicate); 55 | } 56 | 57 | public FilteredList getFilterList() { 58 | return filterList; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /JavaFX-SearchComboBox/src/carmelo/SearchComboBoxApp.java: -------------------------------------------------------------------------------- 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 carmelo; 7 | 8 | import javafx.application.Application; 9 | import javafx.collections.FXCollections; 10 | import javafx.collections.ObservableList; 11 | import javafx.geometry.Pos; 12 | import javafx.scene.Node; 13 | import javafx.scene.Scene; 14 | import javafx.scene.control.Button; 15 | import javafx.scene.layout.StackPane; 16 | import javafx.scene.layout.VBox; 17 | import javafx.stage.Stage; 18 | 19 | /** 20 | * 21 | * @author Carmelo Marin Abrego 22 | */ 23 | public class SearchComboBoxApp extends Application { 24 | 25 | @Override 26 | public void start(Stage primaryStage) { 27 | 28 | StackPane root = new StackPane(); 29 | root.getChildren().add(createSearchComboBox()); 30 | 31 | Scene scene = new Scene(root, 300, 250); 32 | 33 | primaryStage.setTitle("JavaFX - SearchComboBox"); 34 | primaryStage.setScene(scene); 35 | primaryStage.show(); 36 | } 37 | 38 | /** 39 | * @param args the command line arguments 40 | */ 41 | public static void main(String[] args) { 42 | launch(args); 43 | } 44 | 45 | private Node createSearchComboBox() { 46 | 47 | ObservableList items = FXCollections 48 | .observableArrayList( 49 | "auto", 50 | "casa", 51 | "perro", 52 | "animales", 53 | "oro", 54 | "minerales", 55 | "teclado", 56 | "computadora", 57 | "restaurante", 58 | "comida", 59 | "papas", 60 | "salud", 61 | "bellesa", 62 | "cristales", 63 | "escuela", 64 | "saber", 65 | "periodico"); 66 | 67 | SearchComboBox cbx = new SearchComboBox<>(); 68 | cbx.setItems(items); 69 | cbx.setFilter((item, text) -> item.contains(text)); 70 | cbx.getSelectionModel().selectedItemProperty().addListener((p, o, n) -> System.out.println("ComboBox Item: " + n)); 71 | cbx.setPrefWidth(250.0); 72 | cbx.getSelectionModel().select(5); 73 | 74 | Button btn = new Button("Select index 10"); 75 | btn.setOnAction(a -> cbx.getSelectionModel().clearAndSelect(10)); 76 | 77 | VBox box = new VBox(10.0); 78 | box.getChildren().addAll(cbx, btn); 79 | box.setAlignment(Pos.CENTER); 80 | 81 | return box; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /JavaFX-TableView-Editable/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | TutorProgramacion 7 | EditableTableView 8 | EditableTableView 9 | 10 | jar 11 | 1.0-SNAPSHOT 12 | 13 | 14 | 15 | Tutor de programacion 16 | 17 | 18 | 19 | 1.8 20 | 1.8 21 | 1.7.12 22 | 1.2.17 23 | 24 | 25 | 26 | 27 | EditableTableView 28 | 29 | 30 | 31 | 32 | com.zenjava 33 | javafx-maven-plugin 34 | 8.1.5 35 | 36 | 37 | TutorProgramacion.MainApp 38 | 39 | 40 | example-user 41 | example-password 42 | true 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | com.miglayout 57 | miglayout-javafx 58 | 5.0 59 | 60 | 61 | 62 | 63 | 64 | commons-lang 65 | commons-lang 66 | 2.6 67 | 68 | 69 | 70 | 71 | 72 | org.slf4j 73 | slf4j-api 74 | ${slf4j.version} 75 | 76 | 77 | org.slf4j 78 | jcl-over-slf4j 79 | ${slf4j.version} 80 | 81 | 82 | org.slf4j 83 | slf4j-log4j12 84 | ${slf4j.version} 85 | 86 | 87 | log4j 88 | log4j 89 | ${log4j.version} 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /JavaFX-TableView-Editable/src/main/java/TutorProgramacion/MainApp.java: -------------------------------------------------------------------------------- 1 | package TutorProgramacion; 2 | 3 | import javafx.application.Application; 4 | import javafx.beans.property.ReadOnlyBooleanWrapper; 5 | import javafx.beans.property.ReadOnlyStringWrapper; 6 | import javafx.beans.property.SimpleBooleanProperty; 7 | import javafx.fxml.FXMLLoader; 8 | import javafx.geometry.Insets; 9 | import javafx.scene.Parent; 10 | import javafx.scene.Scene; 11 | import javafx.scene.control.TableColumn; 12 | import javafx.scene.control.TableView; 13 | import javafx.scene.control.cell.CheckBoxTableCell; 14 | import javafx.scene.control.cell.ChoiceBoxTableCell; 15 | import javafx.scene.control.cell.PropertyValueFactory; 16 | import javafx.scene.control.cell.TextFieldTableCell; 17 | import javafx.scene.layout.AnchorPane; 18 | import javafx.scene.layout.StackPane; 19 | import javafx.stage.Stage; 20 | import javafx.util.converter.LocalDateStringConverter; 21 | import org.slf4j.Logger; 22 | import org.slf4j.LoggerFactory; 23 | 24 | import java.time.LocalDate; 25 | 26 | public class MainApp extends Application { 27 | 28 | public static void main(String[] args) throws Exception { 29 | launch(args); 30 | } 31 | 32 | public void start(Stage stage) throws Exception { 33 | 34 | TableView tv = new TableView(); 35 | tv.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); 36 | tv.setEditable(true); 37 | 38 | TableColumn tc_nombre = new TableColumn<>("Nombre"); 39 | tc_nombre.setCellValueFactory(new PropertyValueFactory("Nombre")); 40 | tc_nombre.setCellFactory(TextFieldTableCell.forTableColumn()); 41 | tc_nombre.setOnEditCommit(data -> { 42 | System.out.println("Nuevo Nombre: " + data.getNewValue()); 43 | System.out.println("Antiguo Nombre: " + data.getOldValue()); 44 | 45 | Persona p = data.getRowValue(); 46 | p.setNombre(data.getNewValue()); 47 | 48 | System.out.println(p); 49 | }); 50 | 51 | 52 | TableColumn tc_nacimiento = new TableColumn<>("Fecha de Nacimiento"); 53 | tc_nacimiento.setCellValueFactory(new PropertyValueFactory("nacimiento")); 54 | LocalDateStringConverter converter = new LocalDateStringConverter(); 55 | tc_nacimiento.setCellFactory(TextFieldTableCell.forTableColumn(converter)); 56 | tc_nacimiento.setOnEditCommit(data -> { data.getRowValue().setNacimiento(data.getNewValue()); }); 57 | 58 | 59 | TableColumn tc_genero = new TableColumn<>("Genero"); 60 | tc_genero.setCellValueFactory(new PropertyValueFactory("Genero")); 61 | tc_genero.setCellFactory(ChoiceBoxTableCell 62 | .forTableColumn(Persona.Genero.MASCULINO, Persona.Genero.FEMENINO)); 63 | tc_genero.setOnEditCommit(data -> { 64 | System.out.println(data.getRowValue()); 65 | }); 66 | 67 | 68 | TableColumn tc_activo = new TableColumn<>("Activo"); 69 | tc_activo.setCellValueFactory(cell -> cell.getValue().activoProperty()); 70 | tc_activo.setCellFactory(CheckBoxTableCell.forTableColumn(tc_activo)); 71 | 72 | 73 | tv.getColumns().addAll(tc_nombre, tc_nacimiento, tc_genero, tc_activo); 74 | tv.getItems().addAll(Persona.getPersonList()); 75 | 76 | StackPane root = new StackPane(tv); 77 | root.setPadding(new Insets(10.0)); 78 | Scene scene = new Scene(root, 1280, 720); 79 | 80 | stage.setTitle("Edicion en TableView"); 81 | stage.setScene(scene); 82 | stage.show(); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /JavaFX-TableView-Editable/src/main/java/TutorProgramacion/Persona.java: -------------------------------------------------------------------------------- 1 | package TutorProgramacion; 2 | 3 | import javafx.beans.property.BooleanProperty; 4 | import javafx.beans.property.SimpleBooleanProperty; 5 | import javafx.collections.FXCollections; 6 | import javafx.collections.ObservableList; 7 | 8 | import java.time.LocalDate; 9 | 10 | /** 11 | * Created by Carmelo Marín Abrego on 02/06/2016. 12 | */ 13 | public class Persona { 14 | private String nombre; 15 | private LocalDate nacimiento; 16 | private Genero genero; 17 | 18 | public Persona(String nombre, LocalDate nacimiento, Genero genero, Boolean activo) { 19 | this.genero = genero; 20 | this.nacimiento = nacimiento; 21 | this.nombre = nombre; 22 | this._activo = new SimpleBooleanProperty(activo); 23 | } 24 | 25 | enum Genero { 26 | MASCULINO, FEMENINO 27 | } 28 | 29 | public String getNombre() { 30 | return nombre; 31 | } 32 | 33 | public void setNombre(String nombre) { 34 | this.nombre = nombre; 35 | } 36 | 37 | public LocalDate getNacimiento() { 38 | return nacimiento; 39 | } 40 | 41 | public void setNacimiento(LocalDate nacimiento) { 42 | this.nacimiento = nacimiento; 43 | } 44 | 45 | public Genero getGenero() { 46 | return genero; 47 | } 48 | 49 | public void setGenero(Genero genero) { 50 | this.genero = genero; 51 | } 52 | 53 | public static ObservableList getPersonList(){ 54 | Persona p1 = new Persona("Juan", LocalDate.now(), Genero.MASCULINO, true); 55 | Persona p2 = new Persona("Anabel", LocalDate.now(), Genero.FEMENINO, false); 56 | Persona p3 = new Persona("Esteban", LocalDate.now(), Genero.MASCULINO, true); 57 | Persona p4 = new Persona("Lucia", LocalDate.now(), Genero.FEMENINO, true); 58 | Persona p5 = new Persona("Lucas", LocalDate.now(), Genero.MASCULINO, false); 59 | 60 | return FXCollections.observableArrayList(p1, p2, p3, p4, p5); 61 | } 62 | 63 | private BooleanProperty _activo; 64 | 65 | public final BooleanProperty activoProperty(){ 66 | return this._activo; 67 | } 68 | 69 | public final Boolean getActivo() { 70 | return _activo.get(); 71 | } 72 | 73 | public final void setActivo(Boolean activo) { 74 | this._activo.set(activo); 75 | } 76 | 77 | @Override 78 | public String toString() { 79 | return "Persona{" + 80 | "nombre='" + nombre + '\'' + 81 | ", nacimiento=" + nacimiento + 82 | ", genero=" + genero + 83 | ", activo=" + getActivo() + 84 | '}'; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /JavaFX-TreeTableView/build.xml: -------------------------------------------------------------------------------- 1 | 2 | Builds, tests, and runs the project JavaFX-TreeTableView. 3 | 4 | 53 | 54 | -------------------------------------------------------------------------------- /JavaFX-TreeTableView/lib/fontawesomefx-commons-8.12.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TutorProgramacion/JavaFX-Tutoriales/67361200e8ffd2a9953624a727dfa3d1a51bbaa7/JavaFX-TreeTableView/lib/fontawesomefx-commons-8.12.jar -------------------------------------------------------------------------------- /JavaFX-TreeTableView/lib/fontawesomefx-octicons-4.3.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TutorProgramacion/JavaFX-Tutoriales/67361200e8ffd2a9953624a727dfa3d1a51bbaa7/JavaFX-TreeTableView/lib/fontawesomefx-octicons-4.3.0.jar -------------------------------------------------------------------------------- /JavaFX-TreeTableView/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /JavaFX-TreeTableView/nbproject/configs/Run_as_WebStart.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run as WebStart 3 | -------------------------------------------------------------------------------- /JavaFX-TreeTableView/nbproject/configs/Run_in_Browser.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run in Browser 3 | -------------------------------------------------------------------------------- /JavaFX-TreeTableView/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=1c8e26ed 2 | build.xml.script.CRC32=cf57776a 3 | build.xml.stylesheet.CRC32=8064a381@1.75.2.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=1c8e26ed 7 | nbproject/build-impl.xml.script.CRC32=72364c23 8 | nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48 9 | -------------------------------------------------------------------------------- /JavaFX-TreeTableView/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | JavaFX-TreeTableView 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /JavaFX-TreeTableView/src/carmelo/javafx/Empleado.java: -------------------------------------------------------------------------------- 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 carmelo.javafx; 7 | 8 | import java.time.LocalDate; 9 | 10 | /** 11 | * 12 | * @author Carmelo Marín Abrego 13 | */ 14 | public class Empleado { 15 | 16 | private String nombre; 17 | private String apellido; 18 | private LocalDate nacimiento; 19 | private Double salario; 20 | 21 | public Empleado(String nombre, String apellido, LocalDate nacimiento, Double salario) { 22 | this.nombre = nombre; 23 | this.apellido = apellido; 24 | this.nacimiento = nacimiento; 25 | this.salario = salario; 26 | } 27 | 28 | public String getNombre() { 29 | return nombre; 30 | } 31 | 32 | public void setNombre(String nombre) { 33 | this.nombre = nombre; 34 | } 35 | 36 | public String getApellido() { 37 | return apellido; 38 | } 39 | 40 | public void setApellido(String apellido) { 41 | this.apellido = apellido; 42 | } 43 | 44 | public LocalDate getNacimiento() { 45 | return nacimiento; 46 | } 47 | 48 | public void setNacimiento(LocalDate nacimiento) { 49 | this.nacimiento = nacimiento; 50 | } 51 | 52 | public Double getSalario() { 53 | return salario; 54 | } 55 | 56 | public void setSalario(Double salario) { 57 | this.salario = salario; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /JavaFX-TreeTableView/src/carmelo/javafx/JFXTreeTableView.java: -------------------------------------------------------------------------------- 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 carmelo.javafx; 7 | 8 | import java.time.LocalDate; 9 | import javafx.application.Application; 10 | import javafx.event.ActionEvent; 11 | import javafx.event.EventHandler; 12 | import javafx.geometry.Insets; 13 | import javafx.scene.Scene; 14 | import javafx.scene.control.Button; 15 | import javafx.scene.control.TreeItem; 16 | import javafx.scene.control.TreeTableColumn; 17 | import javafx.scene.control.TreeTableView; 18 | import javafx.scene.control.cell.TreeItemPropertyValueFactory; 19 | import javafx.scene.layout.StackPane; 20 | import javafx.stage.Stage; 21 | 22 | /** 23 | * 24 | * @author Carmelo Marín Abrego 25 | */ 26 | public class JFXTreeTableView extends Application { 27 | 28 | @Override 29 | public void start(Stage primaryStage) { 30 | TreeTableView ttv = new TreeTableView(); 31 | 32 | TreeTableColumn ttcNombre = new TreeTableColumn<>("Nombre"); 33 | TreeTableColumn ttcApellido = new TreeTableColumn<>("Apellido"); 34 | TreeTableColumn ttcNacimiento = new TreeTableColumn<>("Fecha de Nacimiento"); 35 | TreeTableColumn ttcSalario = new TreeTableColumn<>("Salario Bruto"); 36 | 37 | ttcNombre.setCellValueFactory(new TreeItemPropertyValueFactory<>("nombre")); 38 | ttcApellido.setCellValueFactory(new TreeItemPropertyValueFactory<>("apellido")); 39 | ttcNacimiento.setCellValueFactory(new TreeItemPropertyValueFactory<>("nacimiento")); 40 | ttcSalario.setCellValueFactory(new TreeItemPropertyValueFactory<>("salario")); 41 | 42 | ttv.getColumns().addAll(ttcNombre, ttcApellido, ttcNacimiento, ttcSalario); 43 | 44 | addData(ttv); 45 | 46 | StackPane root = new StackPane(); 47 | root.getChildren().add(ttv); 48 | root.setPadding(new Insets(10.0)); 49 | 50 | Scene scene = new Scene(root, 480, 320); 51 | 52 | primaryStage.setTitle("JavaFX :: TreeTableView"); 53 | primaryStage.setScene(scene); 54 | primaryStage.show(); 55 | } 56 | 57 | private void addData(TreeTableView ttv) 58 | { 59 | Empleado emp1 = new Empleado("Juan", "Perez", LocalDate.parse("2000-05-01"), 500.0); 60 | Empleado emp11 = new Empleado("Maria", "Lopez", LocalDate.parse("2010-05-01"), 400.0); 61 | Empleado emp12 = new Empleado("Ivania", "Gonzalez", LocalDate.parse("2010-08-07"), 300.0); 62 | 63 | TreeItem itm1 = new TreeItem<>(emp1); 64 | TreeItem itm11 = new TreeItem<>(emp11); 65 | TreeItem itm12 = new TreeItem<>(emp12); 66 | 67 | itm1.getChildren().addAll(itm11, itm12); 68 | 69 | ttv.setRoot(itm1); 70 | } 71 | 72 | /** 73 | * @param args the command line arguments 74 | */ 75 | public static void main(String[] args) { 76 | launch(args); 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /JavaFX-TreeView/build.xml: -------------------------------------------------------------------------------- 1 | 2 | Builds, tests, and runs the project JavaFX-TreeView. 3 | 4 | 53 | 54 | -------------------------------------------------------------------------------- /JavaFX-TreeView/lib/fontawesomefx-commons-8.12.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TutorProgramacion/JavaFX-Tutoriales/67361200e8ffd2a9953624a727dfa3d1a51bbaa7/JavaFX-TreeView/lib/fontawesomefx-commons-8.12.jar -------------------------------------------------------------------------------- /JavaFX-TreeView/lib/fontawesomefx-octicons-4.3.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TutorProgramacion/JavaFX-Tutoriales/67361200e8ffd2a9953624a727dfa3d1a51bbaa7/JavaFX-TreeView/lib/fontawesomefx-octicons-4.3.0.jar -------------------------------------------------------------------------------- /JavaFX-TreeView/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /JavaFX-TreeView/nbproject/configs/Run_as_WebStart.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run as WebStart 3 | -------------------------------------------------------------------------------- /JavaFX-TreeView/nbproject/configs/Run_in_Browser.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run in Browser 3 | -------------------------------------------------------------------------------- /JavaFX-TreeView/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=24de881b 2 | build.xml.script.CRC32=cfac722f 3 | build.xml.stylesheet.CRC32=8064a381@1.75.2.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=24de881b 7 | nbproject/build-impl.xml.script.CRC32=ca478a06 8 | nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48 9 | -------------------------------------------------------------------------------- /JavaFX-TreeView/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | JavaFX-TreeView 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /JavaFX-WebView/build.xml: -------------------------------------------------------------------------------- 1 | 2 | Builds, tests, and runs the project JavaFX-WebView. 3 | 4 | 53 | 54 | -------------------------------------------------------------------------------- /JavaFX-WebView/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /JavaFX-WebView/nbproject/configs/Run_as_WebStart.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run as WebStart 3 | -------------------------------------------------------------------------------- /JavaFX-WebView/nbproject/configs/Run_in_Browser.properties: -------------------------------------------------------------------------------- 1 | # Do not modify this property in this configuration. It can be re-generated. 2 | $label=Run in Browser 3 | -------------------------------------------------------------------------------- /JavaFX-WebView/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=33cfbe75 2 | build.xml.script.CRC32=84712348 3 | build.xml.stylesheet.CRC32=8064a381@1.75.2.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=33cfbe75 7 | nbproject/build-impl.xml.script.CRC32=a0977a42 8 | nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48 9 | -------------------------------------------------------------------------------- /JavaFX-WebView/nbproject/project.properties: -------------------------------------------------------------------------------- 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=JavaFX-WebView 8 | application.vendor=Carmelo Mar\u00edn Abrego 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}/JavaFX-WebView.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=carmelo.javafx.JavaFXWebView 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 114 | -------------------------------------------------------------------------------- /JavaFX-WebView/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | JavaFX-WebView 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /JavaFX-WebView/src/carmelo/javafx/JavaFXWebView.java: -------------------------------------------------------------------------------- 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 carmelo.javafx; 7 | 8 | import javafx.application.Application; 9 | import javafx.geometry.Insets; 10 | import javafx.geometry.Pos; 11 | import javafx.scene.Node; 12 | import javafx.scene.Scene; 13 | import javafx.scene.control.Button; 14 | import javafx.scene.control.Label; 15 | import javafx.scene.control.ProgressBar; 16 | import javafx.scene.control.TextField; 17 | import javafx.scene.layout.HBox; 18 | import javafx.scene.layout.Priority; 19 | import javafx.scene.layout.VBox; 20 | import javafx.scene.web.WebEngine; 21 | import javafx.scene.web.WebHistory; 22 | import javafx.scene.web.WebView; 23 | import javafx.stage.Stage; 24 | 25 | /** 26 | * 27 | * @author Carmelo Marín Abrego 28 | */ 29 | public class JavaFXWebView extends Application { 30 | 31 | public Node createTopBar(WebEngine webEngine) { 32 | HBox root = new HBox(); 33 | root.setSpacing(5.0); 34 | root.setAlignment(Pos.CENTER); 35 | 36 | Label urlLabel = new Label("URL"); 37 | 38 | TextField urlText = new TextField("http://www.google.com"); 39 | HBox.setHgrow(urlText, Priority.ALWAYS); 40 | 41 | Button btnIr = new Button("Ir"); 42 | Button btnNext = new Button("Siguiente"); 43 | Button btnPrev = new Button("Anterior"); 44 | 45 | btnPrev.setDisable(true); 46 | btnNext.setDisable(true); 47 | 48 | WebHistory history = webEngine.getHistory(); 49 | 50 | history.currentIndexProperty().addListener((p, oldValue, newValue) -> { 51 | int currentIndex = newValue.intValue(); 52 | 53 | if (currentIndex <= 0) { 54 | btnPrev.setDisable(true); 55 | } else { 56 | btnPrev.setDisable(false); 57 | } 58 | 59 | if (currentIndex >= history.getEntries().size() - 1) { 60 | btnNext.setDisable(true); 61 | } else { 62 | btnNext.setDisable(false); 63 | } 64 | }); 65 | 66 | btnIr.setOnAction(a -> webEngine.load(urlText.getText())); 67 | 68 | btnNext.setOnAction(a -> history.go(+1)); 69 | btnPrev.setOnAction(a -> history.go(-1)); 70 | 71 | root.getChildren().addAll( 72 | urlLabel, urlText, 73 | btnIr, btnPrev, btnNext 74 | ); 75 | 76 | return root; 77 | } 78 | 79 | @Override 80 | public void start(Stage primaryStage) { 81 | 82 | ProgressBar progressBar = new ProgressBar(0); 83 | progressBar.setMaxWidth(Double.MAX_VALUE); 84 | 85 | WebView webView = new WebView(); 86 | 87 | WebEngine webEngine = webView.getEngine(); 88 | 89 | Node topBar = createTopBar(webEngine); 90 | 91 | // cambiar el titulo al cargar una nueva pagina web 92 | webEngine.titleProperty() 93 | .addListener((p, o, t) -> primaryStage.setTitle(t)); 94 | 95 | // mostrar el progreso de cargar de la web 96 | webEngine.getLoadWorker().progressProperty() 97 | .addListener((p, o, v) -> progressBar.setProgress(v.doubleValue())); 98 | 99 | VBox root = new VBox(); 100 | root.getChildren().addAll(topBar, webView, progressBar); 101 | root.setPadding(new Insets(5.0)); 102 | root.setSpacing(10.0); 103 | 104 | Scene scene = new Scene(root, 800, 420); 105 | 106 | primaryStage.setTitle("JavaFX Navegador Web"); 107 | primaryStage.setScene(scene); 108 | primaryStage.show(); 109 | } 110 | 111 | /** 112 | * @param args the command line arguments 113 | */ 114 | public static void main(String[] args) { 115 | launch(args); 116 | } 117 | 118 | } 119 | --------------------------------------------------------------------------------