********************************************************************
COMPLETE SOURCE CODE FOR : GetJFrameTitle.java
********************************************************************
import javax.swing.JFrame;
import javax.swing.JOptionPane;
public class GetJFrameTitle
{
public static void main(String[]args)
{
//Create a JFrame with title ( My first window )
JFrame frame=new JFrame("My first window");
//Set default close operation for JFrame
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Set JFrame size
frame.setSize(500,500);
//Make JFrame visible
frame.setVisible(true);
//Create a message box that show JFrame title
//Method getTitle() will get JFrame title
JOptionPane.showMessageDialog(frame,"MY NAME IS : "+frame.getTitle());
}
}
********************************************************************
JUST COMPILE AND EXECUTE IT
********************************************************************