• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

checking for an instance of an object

 
Deyna Cegielski
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

thanks.
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic