{"id":18556608,"url":"https://github.com/valkryst/vmvc","last_synced_at":"2026-03-09T19:02:10.567Z","repository":{"id":142749645,"uuid":"113888181","full_name":"Valkryst/VMVC","owner":"Valkryst","description":"An implementation of the Model-View-Controller pattern for my personal Swing projects.","archived":false,"fork":false,"pushed_at":"2025-06-03T17:55:06.000Z","size":81,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-04T03:19:54.135Z","etag":null,"topics":["gui-framework","java","model-view-controller","mvc","swing"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Valkryst.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","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,"zenodo":null},"funding":{"github":"Valkryst"}},"created_at":"2017-12-11T17:26:59.000Z","updated_at":"2025-06-03T17:55:08.000Z","dependencies_parsed_at":"2024-01-12T01:06:12.250Z","dependency_job_id":"63ea44a0-4197-43a7-836b-bd5b3a5092d6","html_url":"https://github.com/Valkryst/VMVC","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/Valkryst/VMVC","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Valkryst%2FVMVC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Valkryst%2FVMVC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Valkryst%2FVMVC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Valkryst%2FVMVC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Valkryst","download_url":"https://codeload.github.com/Valkryst/VMVC/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Valkryst%2FVMVC/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262068749,"owners_count":23253863,"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":["gui-framework","java","model-view-controller","mvc","swing"],"created_at":"2024-11-06T21:32:16.345Z","updated_at":"2026-03-09T19:02:10.467Z","avatar_url":"https://github.com/Valkryst.png","language":"Java","funding_links":["https://github.com/sponsors/Valkryst"],"categories":[],"sub_categories":[],"readme":"[![Java CI with Maven](https://github.com/Valkryst/VMVC/actions/workflows/maven.yml/badge.svg)](https://github.com/Valkryst/VMVC/actions/workflows/maven.yml)\n\nThis project is a Java implementation of the MVC design pattern. It is designed to be used with Swing UIs and for my\npersonal use. It is not intended to be a general purpose MVC framework, but you are free to use it as such if you wish.\n\nThe design goals are as follows:\n\n1. Separate the _View_ from the _Model_. This not only makes the code cleaner, easier to read and maintain, but it also\n    allows for easier testing of \"business\" logic in the _Model_ by having it separate from the UI.\n2. Separate some of the Listener logic from the _View_ to the _Controller_. This allows for easier testing, without the\n   need for something to click through a UI to trigger a Listener.\n3. Provide methods to perform get, set, or compound operations on the _Model_ VIA the _Controller_. Again, this allows\n   for cleaner code in the _View_ and less methods in the _Model_.\n\nThe classes can be described as follows:\n\n* `Model` - Contains data and \"business\" logic for manipulating the data. It has no knowledge of the _View_ or _Controller_.\n* `View` - A Swing UI. It has no knowledge of the _Model_ and can only get/set data VIA the _Controller_.\n* `Controller` - Provides methods for getting/setting data in its _Model_. It may also implement various Listener\n  interfaces (e.g. `ActionListener`, `ChangeListener`, etc.) if it needs to communicate with the _Model_ when the\n  _View_ changes.\n\n## Links\n\n* Projects Using this Pattern\n  * [Schillsaver](https://github.com/Valkryst/Schillsaver)\n  * [Valerie](https://github.com/Valkryst/Valerie) \n* [Installation](https://github.com/Valkryst/VMVC#installation)\n    * [Gradle](https://github.com/Valkryst/VMVC#-gradle)\n    * [Maven](https://github.com/Valkryst/VMVC#-maven)\n    * [sbt](https://github.com/Valkryst/VMVC#-scala-sbt)\n* [Example](https://github.com/Valkryst/VMVC#example)\n  * [Controller](https://github.com/Valkryst/VMVC#controller)\n  * [Model](https://github.com/Valkryst/VMVC#model)\n  * [View](https://github.com/Valkryst/VMVC#view)\n* [Credits \u0026 Inspiration](https://github.com/Valkryst/VMVC#credits--inspiration)\n\n## Installation\n\nVMVC is hosted on the [JitPack package repository](https://jitpack.io/#Valkryst/VMVC)\nwhich supports Gradle, Maven, and sbt.\n\n### ![Gradle](https://i.imgur.com/qtc6bXq.png?1) Gradle\n\nAdd JitPack to your `build.gradle` at the end of repositories.\n\n```\nallprojects {\n\trepositories {\n\t\t...\n\t\tmaven { url 'https://jitpack.io' }\n\t}\n}\n```\n\nAdd VMVC as a dependency.\n\n```\ndependencies {\n\timplementation 'com.github.Valkryst:VMVC:2025.5.15'\n}\n```\n\n### ![Maven](https://i.imgur.com/2TZzobp.png?1) Maven\n\nAdd JitPack as a repository.\n\n``` xml\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003ejitpack.io\u003c/id\u003e\n        \u003curl\u003ehttps://jitpack.io\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n```\nAdd VMVC as a dependency.\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.Valkryst\u003c/groupId\u003e\n    \u003cartifactId\u003eVMVC\u003c/artifactId\u003e\n    \u003cversion\u003e2025.5.15\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### ![Scala SBT](https://i.imgur.com/Nqv3mVd.png?1) Scala SBT\n\nAdd JitPack as a resolver.\n\n```\nresolvers += \"jitpack\" at \"https://jitpack.io\"\n```\n\nAdd VMVC as a dependency.\n\n```\nlibraryDependencies += \"com.github.Valkryst\" % \"VMVC\" % \"2025.5.15\"\n```\n\n## Example\n\nUsing the _Controller_, _Model_, and _View_ classes below, we can display the _View_ in a Swing UI as follows:\n\n```java\nimport javax.swing.*;\nimport java.awt.*;\n\npublic class Example {\n    public static void main(final String[] args) {\n        SwingUtilities.invokeLater(() -\u003e {\n            final var frame = new JFrame(\"Example\");\n            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n            frame.setPreferredSize(new Dimension(640, 480));\n            \n            // createView() will call the overridden methods in ExampleModel.\n            frame.add(new ExampleModel().createView());\n            \n            frame.setVisible(true);\n            frame.pack();\n            frame.setLocationRelativeTo(null);\n        });\n    }\n}\n```\n\n### Controller\n\n```java\n// This can implement various Listener interfaces, if the View requires it.\npublic class ExampleController extends Controller\u003cExampleModel\u003e {\n    public ExampleController(final ExampleModel model) {\n        super(model);\n    }\n    \n    // Add methods to perform get, set, or compound actions on the Model.\n  \n    // Add overridden methods from Listener interfaces, if the View requires it.\n}\n```\n\n### Model\n\n```java\npublic class ExampleModel extends Model\u003cExampleController, ExampleView\u003e {\n    // Add instance variables to store data used by the View.\n    \n    @Override\n    protected ExampleController createController() {\n      return new ExampleController(this);\n    }\n  \n    @Override\n    protected ExampleView createView(final ExampleController controller) {\n      return new ExampleView(controller);\n    }\n    \n    // Add methods to perform \"business\" logic on the data.\n}\n```\n\n### View\n\n```java\npublic class ExampleView extends View\u003cExampleController\u003e {\n    public ExampleView(final ExampleController controller) {\n        super(controller);\n        \n        // Create a Swing UI within ExampleView.\n    }\n}\n```\n\n## Credits \u0026 Inspiration\n\n* Architecture\n    * Robert Eckstein's [\"Java SE Application Design With MVC\"](https://www.oracle.com/technical-resources/articles/javase/application-design-with-mvc.html).\n    * Juri Strumpflohner's [\"Logical separation with MVC\"](https://juristr.com/blog/2008/03/logical-separation-with-mvc/), a follow-up to Eckstein's article.\n* [Filthy Rich Clients: Developing Animated and Graphical Effects for Desktop Java™ Applications](https://www.amazon.ca/Filthy-Rich-Clients-Developing-Applications/dp/0132413930/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalkryst%2Fvmvc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalkryst%2Fvmvc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalkryst%2Fvmvc/lists"}