{"id":16175715,"url":"https://github.com/osiris-team/better-layout","last_synced_at":"2025-10-07T12:44:15.198Z","repository":{"id":47475992,"uuid":"516138530","full_name":"Osiris-Team/Better-Layout","owner":"Osiris-Team","description":"Probably the best and most modern layout for Java AWT/Swing","archived":false,"fork":false,"pushed_at":"2023-01-15T09:48:21.000Z","size":81,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T20:53:28.674Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Osiris-Team.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-20T21:24:31.000Z","updated_at":"2024-11-21T17:34:18.000Z","dependencies_parsed_at":"2023-02-09T21:40:12.372Z","dependency_job_id":null,"html_url":"https://github.com/Osiris-Team/Better-Layout","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/Osiris-Team/Better-Layout","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Osiris-Team%2FBetter-Layout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Osiris-Team%2FBetter-Layout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Osiris-Team%2FBetter-Layout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Osiris-Team%2FBetter-Layout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Osiris-Team","download_url":"https://codeload.github.com/Osiris-Team/Better-Layout/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Osiris-Team%2FBetter-Layout/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278778959,"owners_count":26044256,"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","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"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":[],"created_at":"2024-10-10T04:45:36.134Z","updated_at":"2025-10-07T12:44:15.182Z","avatar_url":"https://github.com/Osiris-Team.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Better-Layout [![](https://jitpack.io/v/Osiris-Team/Better-Layout.svg)](https://jitpack.io/#Osiris-Team/Better-Layout)\nProbably the best and most modern layout for Java AWT/Swing (Java 8 or higher required)\n\n![](assets/img.png)\n\n```java\n// ... window code not shown\nBLayout rootLayout = new BLayout();\nthis.setContentPane(rootLayout);\nrootLayout.isDebug = true;\nrootLayout.access(() -\u003e { // No need to call revalidate on any component inside here\n    BLayout lyTitle = new BLayout(rootLayout, true); // true = crop to content\n    rootLayout.addV(lyTitle);\n    JLabel title = new JLabel(), subtitle = new JLabel();\n\n    title.setText(\"My title\");\n    title.putClientProperty(\"FlatLaf.style\", \"font: 200% $semibold.font\");\n    lyTitle.addH(titleAutoPlug).paddingLeft();\n\n    subtitle.setText(\"| my subtile\");\n    subtitle.putClientProperty(\"FlatLaf.style\", \"font: 200% $light.font\");\n    lyTitle.addH(titleTray).paddingLeft();\n       \n    rootLayout.addV(new JLabel(\"VERTICAL\")); // Basically the same as \"\\n\" in a string.\n    rootLayout.addH(new JLabel(\"HORIZONTAL\"), new JLabel(\"HORIZONTAL\"), new JLabel(\"HORIZONTAL\"));\n    rootLayout.addV(new JLabel(\"VERTICAL\"));\n    rootLayout.addH(new JLabel(\"HORIZONTAL\"));\n    new BLayout(rootLayout, 30, 10) // 30% width and 10% height\n        .addV(new JLabel(\"Lorem ipsum dolor sit amet! \"),\n                new JLabel(\"Lorem ipsum dolor sit amet! \"),\n                new JLabel(\"Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet\"),\n                new JLabel(\"Lorem ipsum dolor sit amet! \"),\n                new JLabel(\"Lorem ipsum dolor sit amet! \"))\n        .makeScrollable(); // This adds the scroll layout to the rootLayout\n    JTabbedPane tabbedPane = new JTabbedPane();\n    tabbedPane.addTab(\"hello!\", new BLayout()); // 100% of window\n    rootLayout.addV(tabbedPane);\n});\n```\n\n### Features\n- Compatible with all Java AWT/Swing components and containers.\n- No need to write constraints/styles in strings, everything available through methods.\n\n#### Design choices:\n- Better-Layout tries to combine vertical \u0026 horizontal layouts\nand to reduce the amount of indidual child layouts needed to create more complex layouts.\n- Each child element has its own style attributes.\n- Absolute positioning thorugh relative parent sizes.\n- TODO: Responsive layout support.\n\n#### Styles per component:\n- Horizontal and Vertical positioning.\n- Right, left, top and bottom padding.\n\n#### Container methods for:\n- Easy validation/revalidation of itself, parent and child containers via `access()` method.\n- Easy addition of components vertically or horizontally via `addV()` and `addH()` methods.\n- Methods to make the layout scrollable and to scroll to horizontal/vertical start/end.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosiris-team%2Fbetter-layout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosiris-team%2Fbetter-layout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosiris-team%2Fbetter-layout/lists"}