{"id":15044988,"url":"https://github.com/parubok/multiline-label","last_synced_at":"2025-04-10T00:43:10.372Z","repository":{"id":57734454,"uuid":"285054794","full_name":"parubok/multiline-label","owner":"parubok","description":"Java Swing component to display multiline plain text.","archived":false,"fork":false,"pushed_at":"2024-08-24T14:33:35.000Z","size":412,"stargazers_count":14,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-10T00:43:03.731Z","etag":null,"topics":["java-11","java-module","swing","swing-component"],"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/parubok.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-04T17:42:49.000Z","updated_at":"2025-04-08T09:47:49.000Z","dependencies_parsed_at":"2024-09-28T23:21:00.288Z","dependency_job_id":"5e8fe251-9f33-404b-a50e-c15f4b8c5922","html_url":"https://github.com/parubok/multiline-label","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parubok%2Fmultiline-label","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parubok%2Fmultiline-label/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parubok%2Fmultiline-label/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parubok%2Fmultiline-label/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parubok","download_url":"https://codeload.github.com/parubok/multiline-label/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137998,"owners_count":21053775,"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":["java-11","java-module","swing","swing-component"],"created_at":"2024-09-24T20:51:19.059Z","updated_at":"2025-04-10T00:43:10.350Z","avatar_url":"https://github.com/parubok.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Java CI with Maven](https://github.com/parubok/multiline-label/workflows/Java%20CI%20with%20Maven/badge.svg?branch=master)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/parubok/multiline-label/blob/master/LICENSE)\n[![Latest Version](https://img.shields.io/maven-central/v/io.github.parubok/multiline-label)](https://search.maven.org/search?q=a:multiline-label)\n[![javadoc](https://javadoc.io/badge2/io.github.parubok/multiline-label/javadoc.svg)](https://javadoc.io/doc/io.github.parubok/multiline-label)\n\n# multiline-label\n\nJava Swing component to display a plain, left-to-right text (single line or multiline).  Allows to specify preferred \nwrapping width (in pixels) for cases when there is not enough room to display the text as a single line.\n\nMotivation: Though standard Swing provides a number of options to display multiline text (e.g. `JLabel` with HTML, \nread-only `JTextArea`, etc.), none of them IMHO is very convenient and straightforward.\nThe goal of this component is to provide a multiline label with predictable and easily configurable behavior.\n\nThe label allows to specify custom separator characters (a space character by default). See `MultilineLabel.setSeparators`.\nThe label always honors line breaks (e.g. `\\n`) if they are present in the text.\n\nThe label implements `javax.swing.Scrollable` interface to support scrolling. By default, up to 20 lines will be \ndisplayed without vertical scroll bar. See `MultilineLabel.setPreferredViewportLineCount`.\n\nThe `MultilineLabel` class provides a number of static methods to support multiline text painting on components other \nthan the `MultilineLabel`. For example, `MultilineLabel.calculatePreferredSize` method.\n\nExample:\n```java\nimport javax.swing.border.EmptyBorder;\nimport java.util.Set;\n\nimport io.github.parubok.text.multiline.MultilineLabel;\n\nvar label = new MultilineLabel();\nlabel.setText(myText); // set text - possibly requiring multiline presentation\nlabel.setPreferredWidthLimit(330); // the label's preferred width won't exceed 330 pixels\nlabel.setLineSpacing(1.2f); // relative spacing between adjacent text lines\nlabel.setMaxLines(30); // limit the label to 30 lines of text\nlabel.setBorder(new EmptyBorder(10, 5, 10, 5));\nlabel.setSeparators(Set.of(' ', '/', '|', '(', ')')); // allow separators other than space\npanel.add(label); // add label to its parent container\n```\n\nA demo application is provided. See `io.github.parubok.text.multiline.demo.Demo`.\n\n![alt tag](https://raw.github.com/parubok/multiline-label/master/wiki/images/demo.png)\n\nThis library is packaged as a Java 9 module `io.github.parubok.text.multiline` (with a single dependency on a system module `java.desktop`). \n\nThis project has no external dependencies (except JUnit 5, for testing).\n\nRequires Java 11 or later.\n\n### License\n\nThis project is licensed under [Apache License, version 2.0](https://www.apache.org/licenses/LICENSE-2.0)\n\n### Installation\n\nReleases are available in [Maven Central](https://repo1.maven.org/maven2/io/github/parubok/multiline-label/)\n\n#### Maven\n\nAdd this snippet to the pom.xml `dependencies` section:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.parubok\u003c/groupId\u003e\n    \u003cartifactId\u003emultiline-label\u003c/artifactId\u003e\n    \u003cversion\u003e1.20\u003c/version\u003e\n\u003c/dependency\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparubok%2Fmultiline-label","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparubok%2Fmultiline-label","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparubok%2Fmultiline-label/lists"}