This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
i have a search function that returns a list of records from a database into a list, upon selecting of these records and pressing a button i want for it to be displayed fully in a user interface i have created to display that type of record.
the problem is, if an instance of this user interface already exists i dont want to create another instance (i.e. 2 windows), i would rather get hold of this instance and the use the technique i developed for putting data from the database into the user interface.
is there a way to check if an instance of a specific object (i.e. the user interface) already exists, and if it does get the focus on it, and if not then use the usual code to create a new instance?
First declare an instance variable for the class that wants to make this decision, and set it to null:At this point you don't have any instance of the user interface. Then to use the interface or create a new instance if necessary:and now the variable contains a reference to what you want.