Here you can find the source of setDirty(JComponent comp, boolean isDirty)
private static void setDirty(JComponent comp, boolean isDirty)
//package com.java2s; // modify it under the terms of the GNU Lesser General Public License import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JFrame; public class Main { public static void setDirty(JFrame frame, boolean isDirty) { setDirty(frame.getRootPane(), isDirty); }//from w w w .ja v a2 s .c o m public static void setDirty(JDialog dialog, boolean isDirty) { setDirty(dialog.getRootPane(), isDirty); } private static void setDirty(JComponent comp, boolean isDirty) { if (comp != null) comp.putClientProperty("windowModified", Boolean.valueOf(isDirty)); } }