JFrame Thread Behavior with JDK 8 to 12

This section provides a tutorial example on JFrame Thread behavior with JDK 1.8 to JDK 12.



I also tested the same program in JDK 8 to JDK 12. The result is different:

Test 1 - Run FrameThreads.java with JDK 12 in a command window and wait:

C:\herong>\progra~1\java\jdk-12.0.1\bin\java FrameThreads

Active thread = main
Active thread = AWT-EventQueue-0
Interrupting thread = AWT-EventQueue-0

Noticed that the "AWT-Shutdown" and "AWT-Windows" threads are not there anymore in JDK 8 to JDK 12. They are probably moved to the "system" thread group now from the "main" thread group. The interruption did sent to the AWT-EventQueue-0 threat. But the 3 Swing frames were displayed on the screen forever.

Test 2 - Run FrameThreads.java in a command window, hide 3 frames behind another window and wait. I got the same results as test 1.

This tells me that AWT packages in JDK 1.8 to JDK 12 are still having some issues if its threads are interrupted. But it behaves consistently now.



 

Table of Contents

 About This Book

 JDK (Java Development Kit)

 Introduction of Java Swing Package

 Graphics Environment of the Local System

JFrame - Main Frame Class

 Creating Frames with Sizes and Locations

 Closing Frame and Terminating Application

 Listing and Interrupting AWT Threads

 "AWT blocker activation interrupted" Error

JFrame Thread Behavior with JDK 8 to 12

 Displaying Chinese Characters in Frame Title

 Drawing Graphics - Using paint() on Frame

 Drawing Graphics - Using paint() on Component

 Drawing Graphics - Using paint() on Content Pane

 Drawing Chinese Characters on Frames

 JLabel - Swing Label Class

 JButton - Swing Button Class

 JCheckBox - Swing Check Box Class

 JRadioButton - Swing Radio Button Class

 JTextField - Swing Text Field Class

 JComboBox - Swing Combo Box Class

 Menu Bar, Menus, Menu Items and Listeners

 Creating Internal Frames inside the Main Frame

 Layout of Components in a Container

 LookAndFeel and UIManager

 Option Dialog Boxes

 JEditorPane - The Editor Pane Class

 SwingWorker - The Background Task Worker

 AWT (Abstract Windows Toolkit)

 Integration with Desktop System

 Outdated Tutorials

 References

 Full Version in PDF/EPUB