Welcome to the Java Swing Workshop! This hands-on session covers the basics of Swing programming and event handling for building GUI applications in Java.
Time | Topic | Details |
---|---|---|
1:30 - 1:35 PM | Setup | Install IntelliJ IDEA, configure Java SDK, and set up a basic project. |
1:35 - 1:45 PM | Introduction to Swing | Overview of Swing, its architecture, and comparison with AWT. |
1:45 - 2:00 PM | First Swing Application | Hands-on: Write a minimal Swing program using JFrame and JLabel . |
2:00 - 2:15 PM | Swing Layouts and Components | Add multiple components with layouts like FlowLayout , BorderLayout , and GridLayout . |
2:15 - 2:35 PM | Event Handling | Build an interactive program demonstrating ActionListener and KeyListener . |
2:35 - 3:25 PM | Hands-On Project: Calculator | Create a basic calculator with buttons for arithmetic operations. |
3:25 - 3:30 PM | Closing and Q&A | Summarize the topics, share resources, and address questions. |
- SwingIntro.java: Minimal Swing application.
- SwingLayouts.java: Example of layouts and multiple components.
- EventHandling.java: Example of button clicks and key press events.
- Calculator.java: Hands-on project to build a functional calculator.
- Open IntelliJ IDEA.
- Go to File > New > Project from Version Control.
- Select Git and provide the repository URL in the prompt.
- Choose a directory on your machine and click Clone.
- IntelliJ will automatically open the cloned project. If not, go to File > Open and select the cloned folder.
- Go to File > Project Structure > SDKs.
- Click + and select Add JDK.
- Navigate to your installed JDK (e.g., Java 21) and click OK.
- Right-click the
src
folder in the Project view. - Select Mark Directory as > Sources Root.
- Locate the desired file in the
src
folder (e.g.,SwingIntro.java
). - Right-click the file and select Run 'SwingIntro.main()'.
- Swing Documentation: Official Oracle Swing tutorial.
- Java SDK Downloads: Download Java 21 LTS.
- IntelliJ IDEA Guide: Follow the installation guide in the
setup/
folder.
Happy coding! 🚀