Java GUI Test Program

This section provides a tutorial example on how to build a Java GUI application with JInternalFrame class and related listeners.

In order to test JAB (Java Access Bridge) related tools on my Windows computer, I wrote the following Java GUI application:

 * Copyright (c) 2018 All Rights Reserved.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class JInternalFrameListenerTest
   implements InternalFrameListener, ActionListener {
   JFrame myFrame = null;
   int count = 0;
   public static void main(String[] a) {
      (new JInternalFrameListenerTest()).test();
   private void test() {
      myFrame = new JFrame("Internal Frame Listener Test");
      myFrame.setContentPane(new JDesktopPane());
      JMenuBar myMenuBar = new JMenuBar();
      JMenu myMenu = new JMenu("Frame");
      JMenuItem myMenuItem = new JMenuItem("New");
   public void actionPerformed(ActionEvent e) {
      JInternalFrame f = new JInternalFrame("Frame "+count);
   public void internalFrameActivated(InternalFrameEvent e) {
      System.out.println("Internal frame activated");
   public void internalFrameClosed(InternalFrameEvent e) {
      System.out.println("Internal frame closed");
   public void internalFrameClosing(InternalFrameEvent e) {
      System.out.println("Internal frame closing");
   public void internalFrameDeactivated(InternalFrameEvent e) {
      System.out.println("Internal frame deactivated");
   public void internalFrameDeiconified(InternalFrameEvent e) {
      System.out.println("Internal frame deiconified");
   public void internalFrameIconified(InternalFrameEvent e) {
      System.out.println("Internal frame iconified");
   public void internalFrameOpened(InternalFrameEvent e) {
      System.out.println("Internal frame opened");

Run this program, you will see a blank frame with one menu called "Frame". If you:

You will see the following messages generated from the internal frame listener methods.

Action performed              - Clicked "New" menu item
Internal frame opened
Action performed              - Clicked "New" menu item
Internal frame opened
Internal frame closing        - Clicked the close icon
Internal frame closed
Internal frame activated      - Clicked the maximize icon
Internal frame deactivated    - Clicked the minimize icon
Internal frame iconified
Internal frame activated      - Clicked the minimized image
Internal frame deiconified

At the end of the test, the main frame will look like this:

Internal Frame Listener
Internal Frame Listener

Table of Contents

 About This Book

 Java Tools Terminology

 Java Tools Included in JDK

 javac - The Java Program Compiler

 java - The Java Program Launcher

 jar - The JAR File Tool

 jlink - The JRE Linker

 jmod - The JMOD File Tool

 jimage - The JIMAGE File Tool

 jpackage - Binary Package Builder

 javadoc - The Java Document Generator

 jdeps - The Java Class Dependency Analyzer

 jdeprscan - The Java Deprecated API Scanner

 jdb - The Java Debugger

 jcmd - The JVM Diagnostic Tool

 jconsole - Java Monitoring and Management Console

 jstat - JVM Statistics Monitoring Tool

 JVM Troubleshooting Tools

 jhsdb - The Java HotSpot Debugger

 jvisualvm (Java VisualVM) - JVM Visual Tool

 jmc - Java Mission Control

 javap - The Java Class File Disassembler

 keytool - Public Key Certificate Tool

 jarsigner - JAR File Signer

 jshell - Java Language Shell

 jrunscript - Script Code Shell

 Miscellaneous Tools

 native2ascii - Native-to-ASCII Encoding Converter

JAB (Java Access Bridge) for Windows

 What Is JAB (Java Access Bridge)

Java GUI Test Program

 "jaccesswalker" - GUI Component Tree Browser

 "jaccessinspector" - Accessible Information Examiner

 Archived Tutorials


 Full Version in PDF/EPUB