The so-called single-State Design Mode of classes is to adopt a certain method to ensure that only one object instance can exist for a class in the entire software system, in addition, this class only provides one method to get its object instance. If you want a class to generate only one object in a virtual machine, you must first set the access permission of the class constructor to private, in this way, the new operator cannot be used to generate class objects outside the class, but the class objects can still be generated within the class. Because the class object cannot be obtained from outside the class, you can only call a static method of the class to return the object created inside the class. The static method can only be changed to the static member of the category, changes to the class objects generated inside the class must also be defined as static. Example public class testsingle {Private Static final testsingle onlyone = new testsingle (); public static testsingle gettestsingle () {return onlyone;} private testsingle () {}} public class schematicdialog extends jdialog {Private Static schematicdialog instance = NULL; private schematicdialog () {super (jframe. getframes () [0]); super. add (schematicmainpanel. getinstance (); // super. setsize (1000,600); dimension = toolkit. getdefatooltoolkit (). getscreensize (); // super. setlocation (INT) (dimension. getwidth ()-Super. getwidth ()/2, (INT) (dimension. getheight ()-Super. getheight ()/2); super. setsize (INT) dimension. getwidth ()-10, (INT) dimension. getheight ()-50); super. setmodal (false); super. addwindowlistener (New windowadapter () {public void windowclosing (invalid wevent e) {schematicloaddata. getinstance (). clearschematiclayers () ;}});} public void setvisible (Boolean B) {schematicmainpanel. getinstance (). getlayoutcombobox (). setselectedindex (0); super. setvisible (B);} public static schematicdiible getinstance () {If (instance = NULL) {instance = new schematicdialog ();} return instance ;}}