An interactive, educational demo that showcases the behavior and usage of major Java Swing layout managers. It is designed for students, educators, and developers who want a concise, hands-on reference for building Swing UIs.
π¦ BorderLayout, FlowLayout, GridLayout, BoxLayout, CardLayout, and GridBagLayout.
Built with Java 11 and FlatLaf for a modern UI.
JavaSwingLayouts/
βββ exe/ # Windows executable (.exe) generated via Launch4j
β βββ JavaSwingLayouts.exe
βββ lib/ # External libraries (FlatLaf)
β βββ flatlaf-3.6.jar
βββ nbproject/ # NetBeans project metadata
βββ src/
β βββ LayoutsShowcase/ # Java source package
β βββ LayoutShowcase.java
βββ dist/ # Generated JAR file (JavaSwingLayouts.jar)
βββ build.xml # Ant build script
βββ manifest.mf # Manifest file
βββ LICENSE # MIT License
βββ README.md # This file
βββ ApplicationDemo.png # Screenshot of the application
Navigate to the exe/ folder and double-click:
- Open the project in NetBeans.
- Make sure JDK 11 is configured.
- Run the
LayoutShowcase.javafile.
β Requires: Java Development Kit (JDK) 11+
This small demo application includes examples for the following layout managers:
BorderLayoutFlowLayoutGridLayoutBoxLayoutCardLayout(interactive view switching)GridBagLayout
Each demo is implemented in src/LayoutsShowcase/LayoutShowcase.java and demonstrates typical use cases and resizing behavior.
- Clear, interactive examples of major Swing layouts.
- Modern appearance using FlatLaf (optional dependency in
lib/). - Resizable UI to demonstrate layout responsiveness.
- Simple entry points for experimentation and extension.
- Java Development Kit (JDK) 11 or later
- Optional: NetBeans IDE (project metadata provided) or another Java IDE
Contributions and feedback are welcome. Please follow these steps:
- Fork the repository.
- Create a feature branch (
feature/my-change). - Add tests or demonstrate the change in the UI where applicable.
- Open a pull request with a clear description of the change.
For issues or feature requests, use the GitHub issues page: https://github.com/Mavros-Lykos/java-swing-layouts-showcase/issues
This project is released under the MIT License. See LICENSE for details.
** π€ Author**: Mavros-Lykos β https://github.com/Mavros-Lykos
