{"id":22454803,"url":"https://github.com/waikato/fcms-widgets","last_synced_at":"2025-08-09T19:22:03.462Z","repository":{"id":57723966,"uuid":"73115861","full_name":"Waikato/fcms-widgets","owner":"Waikato","description":"Small collection of useful Java widgets.","archived":false,"fork":false,"pushed_at":"2022-11-28T00:18:19.000Z","size":192,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-01T17:32:11.775Z","etag":null,"topics":["java","swing","widgets"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Waikato.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-07T20:02:21.000Z","updated_at":"2023-02-01T23:45:13.000Z","dependencies_parsed_at":"2023-01-22T02:07:00.898Z","dependency_job_id":null,"html_url":"https://github.com/Waikato/fcms-widgets","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Waikato%2Ffcms-widgets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Waikato%2Ffcms-widgets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Waikato%2Ffcms-widgets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Waikato%2Ffcms-widgets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Waikato","download_url":"https://codeload.github.com/Waikato/fcms-widgets/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245850363,"owners_count":20682647,"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","swing","widgets"],"created_at":"2024-12-06T07:09:09.885Z","updated_at":"2025-08-09T19:22:03.439Z","avatar_url":"https://github.com/Waikato.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fcms-widgets\n\nSmall collection of useful Java widgets and utility classes.\n\n## Utility classes\n\n* Package `nz.ac.waikato.cms.core`\n\n  * `BrowserHelper` - for launching browsers with URLs\n  * `FileUtils` - methods for closing streams/readers, file extension handling\n  * `OS` - determining underlying OS (Android/Linux/Mac/Windows)\n  * `PropsUtils` - for loading/saving properties files\n  \n* Package `nz.ac.waikato.cms.gui.core`\n\n  * `GUIHelper` - methods for determining parent components, loading images/icons, etc.\n  * `JListHelper` - methods for moving elements in `JList`\n  * `JTableHelper` - methods calculating column widhts of a `JTable`\n  * `KeyUtils` - convenience methods for `KeyEvent` events\n  * `MouseUtils` - convenience methods for `MouseEvent` events\n\n## Widgets\n\n* Package `nz.ac.waikato.cms.gui.core`\n\n  * `ApprovalDialog` - dialog template for dialogs with Approve/Cancel/Discard buttons\n    (can be individually renamed, hidden/displayed)\n  * `BaseDialog` - dialog with 3-part initialization (`initialize`, `initGUI`, `finishInit`),\n    hook methods for show (`beforeShow`, `afterShow`) and hide (`beforeHide`, `afterHide`)\n  * `BaseDirectoryChooser` - directory chooser with bookmarks panel (based on JFileChooser)  \n  * `BaseFileChooser` - file chooser with bookmarks panel\n  * `BaseFrame` - frame with 3-part initialization (`initialize`, `initGUI`, `finishInit`)\n  * `BasePanel` - panel with 3-part initialization (`initialize`, `initGUI`, `finishInit`)\n  * `BaseScrollPane` - scroll pane with sensible scroll units\n  * `BaseTextPane` - extended `javax.swing.JTextPane` making it easy to append lines with different fonts/colors\n  * `BaseTextPaneWithWordWrap` - extended `BaseTextPane` supporting word wrap\n  * `DetachablePanel` - meta-panel that can detach the content in a separate dialog (and then re-attach it again)\n  * `DialogWithButtons` - dialog with panel at bottom of window for easy placement of buttons\n  * `DirectoryChooserPanel` - text field with associated button for selecting directory\n  * `FileChooserPanel` - text field with associated button for selecting file\n  * `FontChooser` - a chooser dialog for fonts\n  * `FontChooserPanel` - panel that allows selection of fonts via a `FontChooser` dialog\n  * `FontChooserPanelWithPreview` - previews the selected font with some sample text\n  * `MultiPagePane` - pane that works like `javax.swing.JTabbedPane`, but lists the pages \n    on the left-hand side (better use of space on widescreen monitors)\n  * `ParameterPanel` - panel for displaying multiple parameters to be entered\n  * `PropertiesParameterPanel` - based on `ParameterPanel`, but backed by `java.util.Properties` \n    for getting/setting the parameters\n  * `SetupPanel` - ancestor for panels that load/save setups from/to properties files\n  * `SimpleDirectoryChooser` - directory chooser with a more intuitive interface, similar API to JFileChooser\n  \n## Examples\n\n### ApprovalDialog\n\n```java\nimport javax.swing.JLabel;\nimport javax.swing.JPanel;\nimport java.awt.BorderLayout;\nimport nz.ac.waikato.cms.gui.core.ApprovalDialog;\n...\n// panel with content to display, e.g, a question\nJPanel panel = new JPanel(new BorderLayout());\npanel.add(new JLabel(\"Some question to ask?\"), BorderLayout.CENTER);\n\n// configure and display dialog\nApprovalDialog dialog = new ApprovalDialog((java.awt.Frame) null, true);\ndialog.setDefaultCloseOperation(ApprovalDialog.DISPOSE_ON_CLOSE);\ndialog.setTitle(\"Please confirm\");\ndialog.getContentPane().add(panel, BorderLayout.CENTER);\ndialog.pack();\ndialog.setLocationRelativeTo(null);\ndialog.setVisible(true);\nif (dialog.getOption() == ApprovalDialog.APPROVE_OPTION)\n  System.out.println(\"Approved!\");\nelse\n  System.out.println(\"Nope...\");\n```\n\n### PropertiesParameterPanel\n\n```java\nimport nz.ac.waikato.cms.gui.core.ApprovalDialog;\nimport nz.ac.waikato.cms.gui.core.GUIHelper;\nimport nz.ac.waikato.cms.gui.core.PropertiesParameterPanel;\nimport nz.ac.waikato.cms.gui.core.PropertiesParameterPanel.PropertyType;\nimport java.util.Properties;\n...\nPropertiesParameterPanel panel = new PropertiesParameterPanel();\n\n// properties\npanel.addPropertyType(\"name\", PropertyType.STRING);\npanel.setLabel(\"name\", \"New name\");\npanel.setHelp(\"name\", \"The name for the environment\");\n\npanel.addPropertyType(\"java\", PropertyType.FILE);\npanel.setLabel(\"java\", \"Java executable\");\npanel.setHelp(\"java\", \"System default is used when pointing to a directory\");\n\npanel.addPropertyType(\"memory\", PropertyType.STRING);\npanel.setLabel(\"memory\", \"Heap size\");\npanel.setHelp(\"memory\", \"System default is used when empty\");\n\npanel.addPropertyType(\"weka\", PropertyType.FILE);\npanel.setLabel(\"weka\", \"Weka jar\");\npanel.setHelp(\"weka\", \"The weka jar to use for the environment, cannot be empty\");\n\n// define order of parameters\npanel.setPropertyOrder(new String[]{\n  \"name\",\n  \"java\",\n  \"memory\",\n  \"weka\",\n});\n\n// initial values\nProperties props = new Properties();\nprops.setProperty(\"name\", \"coolname\");\nprops.setProperty(\"java\", \"/usr/bin/java\");\nprops.setProperty(\"memory\", \"4g\");\nprops.setProperty(\"weka\", \"/some/where/weka.jar\");\npanel.setProperties(props);\n\n// configure dialog and prompt user\nApprovalDialog dialog = new ApprovalDialog((java.awt.Frame) null, true);\ndialog.setDefaultCloseOperation(ApprovalDialog.DISPOSE_ON_CLOSE);\ndialog.setTitle(\"Enter parameters\");\ndialog.getContentPane().add(panel, BorderLayout.CENTER);\ndialog.pack();\ndialog.setLocationRelativeTo(null);\ndialog.setVisible(true);\n\n// output user provided parameters\nif (dialog.getOption() == ApprovalDialog.APPROVE_OPTION)\n  System.out.println(panel.getProperties());\nelse\n  System.out.println(\"Canceled\");\n```\n  \n## Maven\n\nAdd the following dependency to your `pom.xml`:\n\n```xml\n    \u003cdependency\u003e\n      \u003cgroupId\u003ecom.github.waikato\u003c/groupId\u003e\n      \u003cartifactId\u003efcms-widgets\u003c/artifactId\u003e\n      \u003cversion\u003e0.0.26\u003c/version\u003e\n    \u003c/dependency\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaikato%2Ffcms-widgets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwaikato%2Ffcms-widgets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaikato%2Ffcms-widgets/lists"}