How to check if an object exists and how to discard it?

Greetings,
I have a main GUI panel in a JFrame that creates a smaller JFrame with a progress bar and text area whenever a process is initiated. I've set the default close operation to DISPOSE_ON_CLOSE as when I set it to EXIT_ON_CLOSE the main GUI panel closes as well (!). But whenever I'm closing the smaller JFrame and initiate a new thread, then the same operation is perform in parallel 2, 3 ,4 times, etc. It seems that the object of the class ProgressGUI which carries all the components of the small panel is not disposed properly. So my question is how can I check if an object exists and if yes how can I discard it? Or in other words how can I discard the JFrame of the small panel without closing the main GUI panel as well?
thanks,
Thomas

I've set the default close operation to DISPOSE_ON_CLOSE thats right.
So my question is how can I check if an object exists Whenever you create an object, save its refrence somewhere, then just check
if(reference==null){
         //object does not exist
}else {
        //object exists
and if yes how can I discard it? Ensure that no references of the object to be discarded are remaining with any of the objects and then believe in 'Garbage Collector' to do the job! e.g. if there is only one reference to the frame (in your case) somewhere, you can just make an assignment like:
reference=null;by doing this, you have made the object a candidate for garbage collection. Rest is done by 'Garbage Collector', not you.
For cases like yours, it is better to make the small frame just once and whenever required just make the frame visible.
e.g.
JFrame smallFrame;
void showSmallFrame(){
    if(smallFrame==null)smallFrame=new SmallFrame(); //or something like that
    smallFrame.setVisible(true);
}Thanks!

Similar Messages

  • How to check if the path exists and if not, create it

    I'm trying to check if the path given by the user already exists. In case it doesn't, I'd like to create a folder with name given in the same directory.
    Let's say path_1: "C:\folder1" and path_2: "C:\folder2", and suppose that folder1 exists but folder2 doesn't. Then if the path given by the user is the path_1, then ok, nothing happens, but if it is the path_2, then the programm should realize that it doesn't exist in C:\ and should ask you whether you want to create it or not.
    I know how to do that for files, but not for folders!
    Thanks in advance

    hi guys,
    i`m new at this so im gonne prob. ask a noob`s question...
    i have the same issue as in the title.
    but when i run :
                                              int a,b,c,d,folderexist=-1;
                                             switch (event)
                                                       case EVENT_COMMIT:
                                                                                 GetCtrlVal (panelHandle, PANEL_NAME, name);
                                                                                 folderexist = GetFileAttrs (name, &a, &b, &c, &d);
                                                                                 if (folderexist==-1)
                                                                                           MakeDir (name);
                                                                                           sprintf...........
                                                                                 else.......
    if the folder do exists it works perfectly.
    if it doesnt - it breaks the run and gives me the message :
                          NON-FATAL RUN-TIME ERROR: "NewScap.c", line 317, col 27, thread id 0x00001B98: Library function error (return value == -1 [0xffffffff]).
    (and mark the getfileattrs line in blue)
    and when i check the "folderexits" value it shows 2!? not 1 not 0 not even -1, but 2...
    can somone please help ?
    thanks 
    Adi.

  • Example of generating excel dynamically in ssis? geting error [Excel Destination [190]] Error: Opening a rowset for "Excel_Destination$" failed. Check that the object exists in the database.

    example of generating excel dynamically in ssis? geting error [Excel Destination [190]] Error: Opening a rowset for "Excel_Destination$" failed. Check that the object exists in the database.

    Hi Vijay
    Can you be little bit more specific, did you receive this error when you are designing this pacakge using BIDS
    Becuase when you are designing this pacakge in BIDS, you need to manaually create a excel sheet manually for the first time you run,
    are you creating excel sheet using execute sql task and excel connection with input from a variable?
    Did you receive this error in validation phase or execution phase ?
    Can you share your query to create table in excel ?
    http://sqljunkieshare.com/2012/02/28/how-to-create-and-map-excel-destination-dynamically-in-ssis/
    Use the above post

  • JavaScript: How to check if a file exists.

    Hello Everybody,
    Can you tell me how to check if a file exists using JavaScript and Internet Explorer.
    Browsing on this website I could read about the command "f.exists()" and it was necessary to include "java.io.*".
    Should I use this same command and should I include the same files? Or are there other files and other commands?
    Thanks in advance.

    sorry ya. there is no command to check whether a file exists using javascript. The following code says the object name and value. But it can't say whether the file exists in the harddisk or .. Javascript cannot access database and system resources. If the file exists or not can be checked through the application (ASP, CFML, ..) you are using.

  • Error : Opening a rowset for "Sheet$" failed. Check that the object exists in the database.

    Hi,
    i am trying to load the data from excel sheet using For each loop container in ssis 2005.
    But it gave me the below error:
    Error: Opening a rowset for "Sheet1$" failed. Check that the object exists in the database.
    [DTS.Pipeline] Error: "component "failed validation and returned validation status "VS_ISBROKEN".
    Error: There were errors during task validation.
    Could you please let me know the solution
    Regards
    Sqlstud

    That message usually means validation has failed;
    Have any of the underlying tables changed?  Data types, lengths, maybe even column ordering, etc...?
    try this..
    Right-click on the Data Flow Task and select Properties. Then set DelayValidation =TRUE.
    Let us TRY this |
    My Blog :: http://quest4gen.blogspot.com/
    Thanks ETL.
    Everything is fine..(Datatypes,length,orderings etc)
    Already i have set
    DelayValidation =TRUE.
    IS there any other problem?
    Regards
    Sqlstud

  • How to check if database/table exists in MYSQL

    I am writing a program which accesses databases in MYSQL, is there any way to check if the databases exists on the MYSQL server and if not create one && to check if a table exists and create one of if it does not

    OK, found out that as special permissions needed to create databases I assume it cannot be done via my app but how about Tables

  • How to check the usage of ram and cpu Performance for the particular application like sqlserver ,ms word

    how to check the usage of ram and cpu  Performance for the particular application like sqlserver ,ms word
    ranki

    Hi,
    You can use Performance Monitor and add the required counters.
    Check the below Technet article on Performance Monitor.
    http://technet.microsoft.com/en-us/library/cc749249.aspx
    Below are the steps to monitor the process in Performance Monitor.
    - Go to the Performance Monitor. 
    - Right-click on the graph and select "Add Counters".
    - In the "Available counters" list, open the "Process" section by clicking on the down arrow next to it. Select "% Processor Time" (and any other counter you want).
    - In the "Instances of selected object" list, select the process you want to track. Then click on "Add >>" button. Click on OK.
    Regards,
    Jack
    www.jijitechnologies.com

  • Excel Source - Opening a rowset for "EFT$" failed. Check that the object exists in the database.

    Why oh why do I sometimes get this error when defining my Excel Source and then sometimes I do not?
    Am I doing something wrong here???
    The error is...
    Exception from HRESULT: 0xC02020E8
    Error at Data Flow Task [[Excel Source[27]]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
    Error at Data Flow Task [Excel Source [27}}: Opening a rowset for "EFT$" failed. Check that the object exists in the database.
    I know the Worksheet "EFT" exists because I defined this previously for the same Excel spreadsheet.
    Thanks for your review and am hopeful for a reply.
    PSULionRP

    A reply from CozyRoc must be hitting the nail on the head
    sheet name contains $
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/ce0fbff5-f5f1-4a4a-9c29-6adc32b0fd79/using-excel-file-as-source-in-data-flow-task-of-ssis-bi-2005-need-example-of-sheetnamecellrange?forum=sqlintegrationservices
    Arthur My Blog

  • How many types of Queues exists and how to identify them.

    Hello
    can anyone say How many types of Queues exists and how to identify them.
    What does R3R* and CSA* stands for.
    Regards,
    divya

    Hi Divya,
        The queues R3* and CSA* that you have specified are qRFC queues. qRFC queues are data queues which transport data to and fro different systems.
    There are also the tRFC queues which are triggered whenever you make RFC calls to connect to another system.
    Queues with prefix R3AD* - for delta download from R3->CRM
    Queues with prefix R3AU* - for data upload from CRM->R3
    Queues with prefix R3AR* - used to transfer data during request load from R3->CRM
    Queues with prefix R3AI* - for initial load from R3->CRM
    Queues with prefix CSA* - these are validation object specific queues used for processing/persisting data in CRM tables in a serialized manner. E.g. CSABUPA* for business partner,CSA_ORDER* for sales order etc.
    You can administer and monitor the queues in trax. SMQR,SMQS.
    Hope this helps you! Pls. do not forget to reward me some points.
    Regards,
    Sudipta.

  • How to check whether a file exist in the program folder or not?

    Hi guys,
    how to check whether a file exist in the program folder or not? Let is say i recieve a file name from user then i want to know if the file is there not and act on that base.
    abdul

    Look at the class java.io.File and the .exists() method:
    http://java.sun.com/j2se/1.4/docs/api/java/io/File.html

  • Please help me how to check a material does existed group code in system (w

    Hi all,
    Please help me...
    I have inputted quantity for  tx MC 94  but when I input them into  tx MC94, I met  a message " Structure  not yet maintained for  this conbination characterstics". Step by step to show a error message as below:
    Step 1: Launch MC 94
    step 2: Enter Planning
    Step 3: Enter  Prod.Code. Material (ex: enter material code :0101010260008, this code is existed  Prod.Code )
    Step 4: Click on "Inactive Version " button
    ==> A error message is showed.
    Please help me how to check a material does existed group code in system (which table to  check  it)?
    How to record the message" Structure  not yet maintained for  this conbination characterstics" to catch up it in my program?
    Thank in advance.

    Karenloria,
    1. Check in MC8C, which Infostructure is used for Planning type "Planning" or the one you are entering in the intial screen of MC94.
    2. Using transaction MC63 for the infostructure identified in step 1, check the planning hierarchy maintained. If this product is not maintined maintain using MC62.
    You can also check using SE16 transction the current infostructe records(Plan) for the table name = infostructure identified in step 1.
    Regards,
    Prasobh

  • How to check was the object bound or not without exception handling?

    context.lookup("someName");throws NameNotFoundException in case object was not bound to someName.
    How to check was the object bound or not without exception handling?

    context.lookup("someName");throws NameNotFoundException in case object was not bound to someName.
    How to check was the object bound or not without exception handling?

  • How to Check source systems in RSA1 and verify that connections are working

    How to Check source systems in RSA1 and verify that connections are working ok and how to Check Planning Area have green status.................

    Hi,
    In rsa1, go to 'Tools' and option 'Manage Source System' - the screens are self explanatory there after. To check the planning areas, go to transaction /SAPAPO/MSDP_ADMIN anc check the status of the relevant planning areas.
    Regards
    Vinod

  • Utl_file.open_file question to check if a file exists and is not empty

    Hello,
    I am trying to write a code where in 3 seperate files are created based on some parameter condition for the extract call.
    Say the parameters are NULL, 'A' and 'B'.
    When Null condition is passed to the extract call then it should create file A and B if records are found. If not it should create empty files.
    It is possible that the parameter to the extract is just 'A' then it would create A with say non zero file and B with zero file.
    Now when the extract is called with 'B' parameter and if the file A already exists and is not empty then I should not touch/overwrite it with empty records.
    Is there any simple way that I can do this to check if a file exists and is non empty?
    I am using
    open_file
    ( gv_utl_file_path
    ,lv_file_name
    ,lv_file_handle
    Please help.
    Thanks

    @OP : No Need to open
    SQL> declare
      2   lb_file_exist boolean;
      3   ln_size number;
      4   ln_block_size number;
      5  begin
      6   sys.utl_file.fgetattr('TEST_DIR','a.txt',lb_file_exist,ln_size,ln_block_size);
      7   if lb_file_exist then
      8    dbms_output.put_line('a Exists');
      9    dbms_output.put_line(to_char(ln_size));
    10   else
    11    dbms_output.put_line('a Not Exists');
    12   end if;
    13   sys.utl_file.fgetattr('TEST_DIR','b.txt',lb_file_exist,ln_size,ln_block_size);
    14   if lb_file_exist then
    15    dbms_output.put_line('b Exists');
    16    dbms_output.put_line(to_char(ln_size));
    17   else
    18    dbms_output.put_line('b Not Exists');
    19   end if;
    20   sys.utl_file.fgetattr('TEST_DIR','c.txt',lb_file_exist,ln_size,ln_block_size);
    21   if lb_file_exist then
    22    dbms_output.put_line('c Exists');
    23    dbms_output.put_line(to_char(ln_size));
    24   else
    25    dbms_output.put_line('c Not Exists');
    26   end if;
    27  end;
    28  /
    a Exists
    0
    b Exists
    3
    c Not Exists
    PL/SQL procedure successfully completed.Edited by: jeneesh on Mar 30, 2012 1:21 AM

  • MacKeeper seems to be the biggest threat to Mac users. How is MacKeeper legally allowed to exist. How can we get rid of it?

    At least once a day I get a MacKeeper Pop-up that won's allow me to continue browsing unless I click close the MacKeeper page. Once I do that, a second window pops up that I need to verify that I want to leave the page. I cannot continue using safari unless I click this other window, which I am too worried to do, so I just quit safari, but this window is so intrusive, it stays open even after safari is closed! How is that even allowed to happen and how is that legal. I then have to force quit Safari and restart it. Then if I am looking to buy or download software, half the time the link to the software or the download icon is fake and simply redirects you to  MacKeeper's home page, which again they won't allow you to leave. I have also been told that MacKeeper has planted writers in forums and bloggers and proffesional reviewers all over. Then I hear that the package MacKeeper offers is all software that is available elsewhere for free and it has just been renamed, and the rest of the software is inoperable. How is this company allowed to exist. How could their practices possibly be considered legal?
    Is there anything legitamate they offer?mWhat can be done about them???

    i guess what i'm really asking is- has mackeeper compromised my computer? and how can i check?
    If you did not actually install MacKeeper, it can do nothing to your Mac. I'll assume that the only problems you're faced with have been the intrusive advertisements.
    First go to Safari's Preferences and block popup windows: Safari menu > Preferences > Security > select "Block popup windows".
    Then, make sure you don't have any Safari Extensions you don't want: Go to the Safari menu > Preferences > Extensions. If you see any extensions that you do not recognize or understand, simply click the Uninstall button and they will be gone.
    Then, consider the possibility that your wireless router has been "hacked", a recent problem that has been growing in popularity:If the wireless router you are using is one that uses a web page for configuration, such as Linksys and Netgear products do, it is possible that its DNS settings have been maliciously tampered with. To fix it will require resetting your router using its hardware reset option, followed by configuring it again.
    When doing so, be sure to select the option to prevent setup over its WAN port. Different routers use different terminology for remote administration, so be sure to find the correct setting and disable that option. Use WPA / WPA2 encryption and a reasonably secure wireless network password.
    btw, it is not on pirate sights or xxx sites that i encounter mac keeper, but baseball blogs and stat sights, and the administrators DO say what you said they would... that they have a third party that pays them to do the advertisments. i know some of these guys personally, and none of them would allow this to happen if they could avoid it. they don't have the most traffic in the world, so they don't have the luxury of choosing where or how they get their revenue, they're just happy they can make a living.
    I understand that and I don't begrudge anyone legitimate means of earning a living. However, I strongly disagree with taking the easy way out, saying they have no control over the ads that appear on their site. Would they adopt that stance if their site hosted advertisements for child pørnography?
    Somewhere between that extreme (and illegal) example and having no advertisements whatsoever lies responsibility. Your friends should fire AdChoices or AdSense or whatever service is placing paid content on their web pages, and be abundantly clear about the reason. You don't see MacKeeper or CleanMyMac or similar ads for garbage products on many respectable websites. Unfortunately, they appear on enough of them to be the invasive problem it has become. Until enough site administrators stand up and say they're not willing to tolerate it, the scourge of garbage products will continue to result in lost time, money, irreplaceable data, or all three. MacKeeper alone has earned at least $18 million in revenue, by their own admission, and that was some time ago. If all that money does is to enrich one or two people, that's bad enough. How do they know the revenue is not being directed to fund more sinister purposes? How does anyone?
    What is the baseball site's URL? Post it here. I want to determine what cookies it drops on the system I'm using.

Maybe you are looking for

  • IMac Display stretched and out of focus

    My iMac display is not right. It is slightly enlarged and out of focus. I have already tried the display settings and holding the control key and scrolling down. I also tried restarting. Nothing is working. Last night I tried configuring my router fo

  • JDeveloper Crashed

    I use the JDeveloper Release 2.0 under Windows NT workstation 4 SP3 Japanese Version. When I used the Application wizard and Frame wizard to generate the code, I found ther was any error in the source code. like /ouuu/ouu/ouut("Close File"); I correc

  • Thick line in questionbox when opening the form in internet explore

    When I open my form in firefox, everything appears correctly but when I open it in internet explore there are some thick lines in 2 questionboxes. How can i change this? I don´t see these lines when I create my form.

  • [SOLVED] Playing sound simultaniously from wine and other applications

    I'm using Pulseaudio with the following packages installed: ~> pacman -Q | grep 'alsa\|pulse' alsa-lib 1.0.27.2-1 alsa-plugins 1.0.27-2 alsa-utils 1.0.27.2-1 lib32-alsa-lib 1.0.27.2-1 lib32-libpulse 5.0-1 libpulse 5.0-1 pulseaudio 5.0-1 pulseaudio-al

  • Contribute 3.11 (Studio 8) Crashes

    Got Contribute 3.11 as part of Studio 8 for XP Pro SP2 system. Have not used it for a while but when I try execute it, it crashes before showing the opening page. Is it me - or do others have this problem? Very curious.