Here you can find the source of getWindowTitle(Window window)
public static String getWindowTitle(Window window)
//package com.java2s; //License from project: Apache License import java.awt.Window; import javax.swing.JDialog; import javax.swing.JFrame; public class Main { public static String getWindowTitle(Window window) { if (window instanceof JFrame) { return ((JFrame) window).getTitle(); }/*ww w . j av a 2 s.c o m*/ if (window instanceof JDialog) { return ((JDialog) window).getTitle(); } return null; } }