Here you can find the source of setDirty(JDialog dialog, boolean isDirty)
public static void setDirty(JDialog dialog, 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.j a va 2s.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)); } }