{"id":15056055,"url":"https://github.com/micycle1/processingfx","last_synced_at":"2025-04-10T04:06:24.714Z","repository":{"id":133574899,"uuid":"154869875","full_name":"micycle1/ProcessingFX","owner":"micycle1","description":"A basic project showing how a Processing sketch and an FXML JavaFX stage may be integrated.","archived":false,"fork":false,"pushed_at":"2020-03-07T14:11:39.000Z","size":1101,"stargazers_count":12,"open_issues_count":3,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T04:06:19.590Z","etag":null,"topics":["combine","fxml","javafx","javafx-application","javafx-gui","processing","processing-language","processing-library"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/micycle1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-26T17:25:10.000Z","updated_at":"2025-04-04T09:55:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"bd7ca9f1-9dd3-49a6-91aa-e4db784124ab","html_url":"https://github.com/micycle1/ProcessingFX","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micycle1%2FProcessingFX","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micycle1%2FProcessingFX/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micycle1%2FProcessingFX/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micycle1%2FProcessingFX/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/micycle1","download_url":"https://codeload.github.com/micycle1/ProcessingFX/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154983,"owners_count":21056543,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["combine","fxml","javafx","javafx-application","javafx-gui","processing","processing-language","processing-library"],"created_at":"2024-09-24T21:47:50.116Z","updated_at":"2025-04-10T04:06:24.692Z","avatar_url":"https://github.com/micycle1.png","language":"Java","readme":"# ProcessingFX\n### Description\nA basic project showing how a Processing sketch and a JavaFX window (a stage loaded from an *.FXML* file) may be combined/integrated (both as a Java Project and PDE file), and how each of the two components may interact with each other (Java project only).\n\n### Extending\nIf you use this code as inspiration, ensure you download the [*core-10.jar file*](https://github.com/micycle1/ProcessingFX/blob/master/lib/core-10.jar)\nand use this in place of your existing Processing library: *core.jar*. \n\n*core-10.jar* is a modified version of the Processing library in which there have been minor modifications to the *PSurfaceFX* and *PGraphicsFX2D* classes. \nThe changes allow us to launch Processing embedded within our own *.....extends Application* (JavaFX stage) class, rather than using the stage Processing would otherwise\ncreate during the sketch's initialisation.\n\n### Methodology (simple)\nBefore its call to setup(), a PApplet in FX2D rendering mode creates a JavaFX *stage*, *scene* \u0026 *stackPane* and embeds the drawing canvas (a JavaFX *Canvas* object) within the stackPane.\nIn this example project we circumvent this step (enabled by using *core-10.jar*), creating a customised stage (from loading the FXML file) and then embedding the PApplet's drawing canvas into this stage.\n\n## Features\nI have included examples of the sketch modifying the UI, and the UI modifying the sketch, so see can see how the two components can interact.\nSee the headings below for more information about each:\n\n### JavaFX UI --\u003e Processing\nThere are 2 JavaFX sliders and a colour-picker that modify sketch parameters (the colour of the pen). Behind the scenes, these UI elements trigger `@FXML` decorated methods\nin the *Controller.java* class, which in turn call *strokeColor()* on the sketch (*myPApplet.class*) to change pen colour. The method in the controller class that each UI element\ncalls is prescribed with with `onAction` tag, found accompanying each in the *.FXML* file.\n\n### Processing --\u003e JavaFX UI\nIn the example project, the sketch updates 3 text labels found in the *Info* tab of the JavaFX UI: frameCount, frameRate and canvasWidth.\nThe text label objects are exposed in the *myPApplet* class by looking up the `fx:id` (prescribed in the *.FXML* file) of each element in the scene.\nThe labels are then updated during the *draw()* loop of the sketch.\n\n## Screenshot\nThe stage is a splitPane, with an *Accordion* on the left and a *StackPane* on the right.\nThe drawing canvas is added as a node to the *StackPane*. By adding to a stackpane, it is possible to draw JavaFX primitives on top the of the canvas.\n\u003ch1 align=\"center\"\u003e\n\u003cimg src=\"/assets/screen.PNG\"/\u003e\n\u003c/h1\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicycle1%2Fprocessingfx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicycle1%2Fprocessingfx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicycle1%2Fprocessingfx/lists"}