{"id":16169910,"url":"https://github.com/ergoold/ktguishortcuts","last_synced_at":"2026-01-11T02:02:46.184Z","repository":{"id":186356753,"uuid":"166712657","full_name":"Ergoold/KtGUIShortcuts","owner":"Ergoold","description":"A Swing-based DSL for GUI development in kotlin.","archived":false,"fork":false,"pushed_at":"2019-05-19T11:44:18.000Z","size":75,"stargazers_count":0,"open_issues_count":11,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-02T11:25:51.375Z","etag":null,"topics":["dsl","gui","kotlin","swing"],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","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/Ergoold.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}},"created_at":"2019-01-20T21:43:38.000Z","updated_at":"2019-03-03T10:45:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"e2e2f96a-ccf6-4e1d-9d5c-6489df611db8","html_url":"https://github.com/Ergoold/KtGUIShortcuts","commit_stats":null,"previous_names":["ergoold/ktguishortcuts"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Ergoold/KtGUIShortcuts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ergoold%2FKtGUIShortcuts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ergoold%2FKtGUIShortcuts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ergoold%2FKtGUIShortcuts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ergoold%2FKtGUIShortcuts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ergoold","download_url":"https://codeload.github.com/Ergoold/KtGUIShortcuts/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ergoold%2FKtGUIShortcuts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28269899,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T01:49:32.096Z","status":"online","status_checked_at":"2026-01-11T02:00:07.090Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["dsl","gui","kotlin","swing"],"created_at":"2024-10-10T03:16:22.860Z","updated_at":"2026-01-11T02:02:46.159Z","avatar_url":"https://github.com/Ergoold.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KtGUIShortcuts\nKtGUIShortcuts is a swing-based DSL for creating GUIs in kotlin.\n\n## example\nThis is a simple example of a program showing a `frame` with a `label` containing the text `Hello, World!`:\n```kotlin\npackage yourPackage\n\nimport guishortcuts.*\nimport guishortcuts.consrainables.*\n\nfun main(args: Array\u003cString\u003e) {\n    val myFrame = create frame \"Hello, World!\"\n    window init myFrame\n\n    val myLabel = create label \"Hello, World!\"\n    window add myLabel to myFrame\n\n    myFrame set size(320, 180)\n}\n\n```\n\n### Breakdown\n```kotlin\npackage yourPackage\n```\nThe first line is a `package` statement, like you are already familiar with if you program in kotlin. If you don't know kotlin, I highly suggest [checking it out](http://kotlinlang.org/).\n\n```kotlin\nimport guishortcuts.*\nimport guishortcuts.constrainables.*\n```\nThese are `import` statements that import the guishortcuts package and its subpackage, constrainables. This is necessary for writing code with KtGUIShortcuts.\n\n#### Inside the main function\n```kotlin\nval myFrame = create frame \"Hello, World!\"\nwindow init myFrame\n```\nThese statements create and instantiate a `frame` called `myFrame` with the title `Hello, World!`. When initiated with `window init \u003cframe\u003e`, the `frame` is automatically displayed. However, you won't see it on screen if you run the program now. This is because there are no `component`s on the `frame`, and the `init` command `pack`s the frame - sets its size to the exact size all of the `component`s inside need. There are currently no `component`s, so the `frame` has no width or height. While you could negate this problem by adding `component`s to the `frame` before initiating, I highly recommend you do it in this order so that you can control your `frame`'s size more easily later on.\n\n```kotlin\nval myLabel = create label \"Hello, World!\"\nwindow add myLabel to myFrame\n```\nThese statements create a `label` with the text `Hello, World` and call it `myLabel`, then add it to `myFrame`, the `frame` we created earlier. A `label` is the simpelest type of `component` in KtGUIShortcuts, which just display the text you give them.\n\n```kotlin\nmyFrame set size(320, 180)\n```\nThis last statement in the main function sets the size of `myFrame` to 320 pixels wide by 180 pixels tall. We recommend putting this statement at the end of your program, so that you aren't concerned by the size of your `frame` during the creation of the `component`s.\n\nThere are some alternatives to `set size`, which affect the window size in different ways.\n\n##### Alternatives to `set size`:\n```kotlin\nwindow pack myFrame\n```\nThis `pack`s the `frame`, which as we discussed, sets the `frame`'s size to exactly the amount of space all of it's components need.\n\n```kotlin\nfull screen myFrame\n```\nThis will make `myFrame` fullscreen.\n\n## Basic Usage\n### Components\n#### Creating components\nTo create a component in KtGUIShortcuts, use the following code:\n```kotlin\nval \u003ccomponentName\u003e = create \u003ccomponent\u003e \u003cargs\u003e\n```\n\n#### Adding a component to another component\nIf you want to add a component to another component (usually a panel or frame), the following code is used:\n```kotlin\nwindow add \u003ccomponent\u003e to \u003cparent\u003e\n```\n\n#### Adding constraints to a component\nKtGUIShortcuts automatically creates your `frame` with a `GridBagLayout`. This layout allows components to be constrained in several ways, and this is a highly recommended way to refine the look of your programs.\n```kotlin\n\u003ccomponent\u003e constrain \u003cconstraint\u003e\n```\n\n`constraint`s can be one of several things, but the options I recommend are: \n```kotlin\ncoordinates(col, row) // Set the coordinates of the component on the grid, starting with (0, 0) in the top left corner.\ncells(cols, rows)     // Set the width and height of the component in grid-cells.\nweights(cols, rows)   // Set the weights of the component.\n```\n\nYou can read more about weights and other specifics of GridBagLayout in [The Java™ Tutorials](https://docs.oracle.com/javase/tutorial/uiswing/layout/gridbag.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fergoold%2Fktguishortcuts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fergoold%2Fktguishortcuts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fergoold%2Fktguishortcuts/lists"}