Making a JWindow disapear when you click on it

Here is my code, the question is at the bottom.
// The "Splash" class.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Splash extends JWindow
    Container con = getContentPane ();
    JProgressBar progressBar = new JProgressBar ();
    JLabel lblTitle = new JLabel ();
    public Splash ()
     initFrame ();
     initComponents ();
     runProgress ();
// for some reason the following code hides the window after exactly 16 seconds
     try
         setVisible (false);
     catch (Exception e)
    void initFrame ()
     setBounds (250, 250, 500, 300);
     con.setBackground (Color.darkGray);
     con.setLayout (null);
     setVisible (true);
    void initComponents ()
     lblTitle.setBounds (75, 10, 600, 100);
     lblTitle.setFont (new Font ("Comic Sans MS", Font.ITALIC, 60));
     lblTitle.setForeground (new Color (0, 220, 110));
     lblTitle.setText ("FORMULEX");
     con.add (lblTitle);
     progressBar.setStringPainted (true);
     con.add (progressBar);
     progressBar.setMaximum (100);
     progressBar.setBounds (10, 270, 475, 20);
    public void runProgress ()
     int count = 0;
     try
         Thread thread = new Thread ();
         for (int loop = 0 ; loop < 1001 ; loop++)
          thread.sleep (10);
          progressBar.setValue (loop);
     catch (Exception e)
    public static void main (String[] args)
                 new Splash ();
    } // main method
} // Splash classWhat should I add to make the window disapear when I click on it?
and could somebody please explain to me why the window disapears after _16 seconds_
thanx

Growler wrote:
What should I add to make the window disapear when I click on it?Implement MouseListener interface and override its mouseClicked(MouseEvent e) method
public class Splash extends JWindow implements MouseListener
//....Your Code
public Splash ()
     //your code
// for some reason the following code hides the window after exactly 16 seconds
     /*try   //  this block is placed inside comment 
         setVisible (false);
     catch (Exception e)
void initFrame ()
     //...your code
     addMouseListener(this);//register MouseListener with your window
public void mouseClicked(MouseEvent e) //This get called whenever you clicked in your window component
setVisible (false);
//Also you have to override the other methods of MouseListener
}Edited by: j2ee_ubuntu on Oct 13, 2008 6:24 AM

Similar Messages

  • How do you delete songs that you purchased through iTunes but don't show up when you connect the iphone to iTunes they don't show up in music when you click on "On this phone"? I have my phone setup to manually manage music. Please help.

    How do you delete songs that you purchased through iTunes but don't show up when you connect the iphone to iTunes? They don't show up in the music section when you click on "On this phone". Side Note: I have my phone setup to manually manage music. Please help.

    Hi, Mrs.Frankie57. 
    Thank you for visiting Apple Support Communities.
    If you want to delete a song from your iOS device on iOS 7, tap Songs, swipe the song from right to left, then tap Delete. The song is deleted from iPhone, but not from your iTunes library on your Mac or PC, or from iCloud.
    iPhone User Guide
    Cheers,
    Jason H.

  • I'm on a website that usually when you click on the open chat(popup) link it opens a certain now, but now they are opening maximized all the time. How do I get them to open the proper size?

    It was opening the proper size and now it doesn't

    Works normally for me. The script that runs when you click the link will check to see if it already opened a window and try to switch to it, but if you are starting from scratch, this shouldn't be an issue.
    There probably are quite a few add-ons that affect popup window behavior. To see whether an add-on could be responsible, you could test the page in Firefox's Safe Mode.
    First, I recommend backing up your Firefox settings in case something goes wrong. See [https://support.mozilla.com/en-US/kb/Backing+up+your+information Backing up your information]. (You can copy your entire Firefox profile folder somewhere outside of the Mozilla folder.)
    Next, close Firefox, hold the Shift key, then restart Firefox. You will get a [https://support.mozilla.com/kb/Safe+Mode Safe Mode dialog]. Just click "Continue in Safe Mode" and do not "reset" anything just yet.
    If the window displays at the specified size in Safe Mode, one of your other add-ons (especially in the Extensions category) may be overriding it.

  • Since i upgraded to FF4 Beta. The suggestion bit in my Google toolbar, works but not when you click on a suggestion?

    It gives suggestions but when you click on them nothing happens they just disappear.

    Hi satorilori-
    You might try this:
    -> Clear Cookies & Cache
    https://support.mozilla.com/en-US/kb/Template:clearCookiesCache
    -> Clear the Network Cache
    -> Reload web page(s) and bypass the cache.
    Press and hold Shift and left-click the Reload button.
    Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
    Press "Cmd + Shift + R" (MAC)
    Check and tell if its working. Hope that helps!

  • Please help. My facebook app will not open on my iphone 4. I deleted it,numerous times and downloaded it again. It uploads, but when you click on the icon, it flickers then closes.  Help.

    Please help. My facebook app will not open on my iphone 4. I deleted it,numerous times and downloaded it again. It uploads, but when you click on the icon, it flickers then closes.
    Help.

    Then the next step would be to restore your phone.  My advice is that prior to restoring you import your photos and videos to your computer and back up your contacts (by syncing them with iCloud or to a supported program on your computer using iTunes) as a number of users report losing these when restoring their device.

  • DW CS6 - Spry collapsible panels - How to have panel close when you click away from it?

    I know typically onmouseout is used to close other items, but I could not figure it out with the spry collapsible panel. I have the panel opening onclick and closing onclick, but I would really like for it to close when you click anything else on the page outside of the panel.
    Thank you!

    Sorry, I did not mean other collapsing panels close when you click away from it. I simply meant in general for the closing after clicking away function, you can use onmouseout. I was working on something with collapsing panels and I wanted it to show the information when you clicked on it, but when you click on another panel, they both remain open. I really want both to close. I believe accordion does this, but not quite what I am looking for either.
    Here is a better example of what I would prefer: Houston Public Library
    If you visit their page and click "Find it" a box pops down with information and then when you click anywhere else on the screen, it closes that box. When you click "Research," it closes the "Find It" box and opens the "Research" box. There is likely a much better way to do this, but I am pretty new to this.
    Any assistance is very much appreciated.
    Thank you!

  • Why can't I get the image to view larger when you click on a thumbnail?

    I thought that there was a way to have the image open up larger in a new little window when you click the thumbnail on a photos page....when I click a thumbnail on my photos page it takes me right to slideshow view and the images are displayed too small to see fine detail (I am a retoucher, so my clients need to be able to see hi res images) I can't find a way to change the size of the slideshow images or to get my thumbnails to click open to a hi res version in a new window. The only solution I can think of is to use a blank template page, make each small image a link to a hidden page with the image at hi resolution....but this would take forever and I would have a gazillion pages on my site that way. Any idea how to get around this. Seems like the older version of iweb didn't have this problem...????
    (for an example of what I mean, my site: http://www.katesilsby.com (retouch page) and what old iweb did and what I want to happen: http://web.mac.com/vogier/iWeb/vivian%20ogier/wardrobe.html

    (for an example of what I mean, my site: http://www.katesilsby.com (retouch page) and what old iweb did and what I want to happen: http://web.mac.com/vogier/iWeb/vivian%20ogier/wardrobe.html
    iWeb2 photos page is completely different from that of iWeb1.
    iWeb2 photos page can be retro back to iWeb1, but not without major javascript coding.
    or using completely different previewing method for larger image, example: http://hdl.50webs.com/Lytebox/Photos.html

  • How can I have a PDF in Full Screnn Mode without it goinging to the next page when you click?

    I'm trying to make, let's say, a mini website using a pdf that includes hyperlinks. I also want the PDF to open in FULL SCREEN Mode. For some reason, when in FULL SCREEN mode you can click on the links (works excellent), but when you click on an area of the page that is NOT a link, it forwards you to the next page in the PDF.
    I ordered the full version of Acrobat X Pro, and thought that it would work saving it out of Powerpoint (original file), but I had to disable the add-in because it just kept on crashing.
    I can't seem to find where i can control the "Do Not Forward to Next Page OnClick".
    Help!
    Thanks!

    If you just purchased Acrobat 10, you might be eligible for a free upgrade to Acrobat 11, which is suppposed to have much improved export to PPT.

  • Hi there, Can you please HELP ME? I created a signature for my email account, but I can not choose it because the option is daded under "none"and nothing happens when you click on it! Thank you, Johan

    Hi there, Can you please HELP ME? I created a signature for my email account, but I can not choose it because the option is daded under "none"and nothing happens when you click on it! Thank you, Johan

    This can be a problem with the file places.sqlite that stores the bookmarks and the history.
    * http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox

  • Where does it go when you click on the Calendar icon beside the date field?

    Hi,
    Does anybody know what page or region does it go when you click on the Calendar icon beside a date field? I need to know how it generates the list of values for year.
    Need your help. ASAP. If you need to know more about my inquiry please email me, [email protected]
    Thanks.

    It's a Date bean and it is UIX which generates the java script to pop open the dialog box and the UI. I donot think there will be any public document available on the implementation.

  • In the navigation Toolbar following the yellow bookmark star you find a small blue triangle. When you click it a number of bookmarks show up. How can I add new booksmark to be displayed out of my unsorted bookmarks? Thanks.

    Dear Sir, Mam,
    In the navigation toolbar on the right side of the bookmark yellow star you find a small blue triangle. When you click it, some of the selected bookmarks show up and can be called up immediately.
    I have deleted some without problem, but I could not add new ones. I would like to have there at least 10 items.
    Please explain how to add new bookmarked items to this shortcut list. Thank you, sincerely Th. Brandt. [email protected]

    Is that the Bookmarks Menu button ?
    *https://support.mozilla.org/kb/how-do-i-use-bookmarks
    *https://support.mozilla.org/kb/common-questions-after-updating-firefox
    *http://kb.mozillazine.org/Sorting_and_rearranging_bookmarks_-_Firefox
    *https://support.mozilla.org/kb/Sorting+bookmarks

  • Display the second report as modalform and filter with primary key value of first report when you click on first report column link

    Hi All,
    I have two reports.
    1. order report
    2. order detail report
    when you click on the order report column it display the order detail report as a modal form.
    i was done below steps.
    1. In page header i was written the below code
    <link rel="stylesheet" href = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/
    redmond/jquery-ui.css" type="text/css" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"> </script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"> </script>
    <script type="text/javascript">
    $( function() {
    $('#ModalForm1').dialog(
    autoOpen : false ,
    width :470,
    height: 500,
    resize :false,
    function openForm1()
    $('#ModalForm1').dialog('open');
    function closeForm()
    $('#ModalForm1 input[type="text"]').val('');
    $('#ModalForm1').dialog('close');
    </script>
    2. order report.
    3. order detail report
       select * from order_details where order_id = p_order_id;
    region header
    <div id="ModalForm1" title="Ordered Items" style="display:none">
    <p class="msg"></p>
    footer
    </div>
    4. created the hidden item in order detail report.
    5. in order report column attributes i was given link like below.
    javascript:$s('p_order_id','#order_id#');openForm1();
    when i click on the order report column link it passing the row primary key value to hiddent and open the report as modal form. however it is not filter the report with hidden item. it showing the no data found.
    problem is hidden item value is not submitting. once we submit that value it showing the 2nd report with filter data.
    can any help me to achieve above requirement.
    apex: 4.2
    oracle 11g
    Regards,
    Vijay.

    Vijay,
    Issue 1: Your usage of $s() JavaScript API seems to be wrong. For the first parameter, you need to use the name of the hidden page item and not p_order_id.
    javascript:$s('P1_ORDER_ID','#ORDER_ID#');openForm1();
    Issue 2: Seems like you are not setting the hidden page item's value in session state. Assuming your hidden page item is called P1_ORDER_ID, Under "Region Definition" tab of your "Order Detail Report" under "Source" tab, for page items to submit, enter the name of the hidden page item P1_ORDER_ID.
    Thanks!
    JMcG

  • Final cut pro x - lion - mbp 2011 2.0 15 - not responding at all since latest update. Can't open or edit projects, loading window that pops us when you click the app (as it loads) does not go away, says loading compressor support.  Have tried reinstalling

    final cut pro x - lion - mbp 2011 2.0 15 - not responding at all since latest update. Can't open or edit projects, loading window that pops us when you click the app (as it loads) does not go away, says loading compressor support, paralyzed.  Have tried reinstalling, default settings etc
    Appreciate suggestion, working on deadline. Thanks.  

    Here is the start of the crash report:
    Process:         Final Cut Pro [20568]
    Path:            /Applications/Final Cut Pro.app/Contents/MacOS/Final Cut Pro
    Identifier:      com.apple.FinalCut
    Version:         10.0.1 (185673)
    Build Info:      ProEditor-185670300~1
    App Item ID:     424389933
    App External ID: 4138831
    Code Type:       X86-64 (Native)
    Parent Process:  launchd [102]
    Date/Time:       2011-11-11 20:41:32.201 -0800
    OS Version:      Mac OS X 10.7.2 (11C74)
    Report Version:  9
    Interval Since Last Report:          192058 sec
    Crashes Since Last Report:           14
    Per-App Interval Since Last Report:  157161 sec
    Per-App Crashes Since Last Report:   14
    Anonymous UUID:                      DD542B2F-58A0-482E-AAFA-ECADEC76F562
    Crashed Thread:  0  Dispatch queue: com.apple.main-thread
    Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
    Exception Codes: KERN_INVALID_ADDRESS at 0x0000000280000003
    VM Regions Near 0x280000003:
        CG shared images       00000001cbf62000-00000001cc182000 [ 2176K] r--/r-- SM=SHM 
    -->
        STACK GUARD            00007fff5bc00000-00007fff5f400000 [ 56.0M] ---/rwx SM=NUL  stack guard for thread 0
    Application Specific Information:
    objc[20568]: garbage collection is OFF

  • Decorator not changing when you click on listitem

    Dear,
    I'm developing a mobile application for my thesis and I was working with flash builder burrito. I now installed the new SDK and flashbuilder 4.5.
    I changed my code a little bit so it would work with the new SDK.
    But there's one problem I can't solve.
    I have a list with objects in it. When the element is not checked you can see a gray V, when you click on it it should become a green V. So the user can see wich one is checked and wich not. Here for I use a list with an itemrenderer.
    The problem is when he loads the page he can set the decorator correctly. But when you click on a listitem he doesn't change the decorator.
    I've allready tried to debug , and the debugger is going to the itemrenderer and setting the decorator but de decorator doesn't change in my list.
    I made a small example to show:
    <?xml version="1.0" encoding="utf-8"?>
    <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
              xmlns:s="library://ns.adobe.com/flex/spark" title="Home"
              initialize="init()">
         <fx:Script>
              <![CDATA[
                   import mx.collections.ArrayCollection;
                   [Bindable]
                   private var m_list:ArrayCollection = new ArrayCollection();
                   private function init():void
                             for(var i:int = 0 ; i<5 ; i++)
                                  var test:SelectableItem = new SelectableItem("Item"+i);
                                  m_list.addItem(test);
                   protected function list1_clickHandler(event:MouseEvent):void
                        SelectableItem(m_list.getItemAt(listID.selectedIndex)).toggleSelection();                              
              ]]>
         </fx:Script>
         <s:List id="listID"
                   x="0" y="99" width="480" height="596"
                   dataProvider="{m_list}"
                   itemRenderer="views.ListItemRenderer"
                   click="list1_clickHandler(event)"/>
    </s:View>
    This is my class:
    package views
         public class SelectableItem
              private var m_name:String;
              private var m_selected:Boolean;
              public function SelectableItem(name:String,selected:Boolean = false)
                   m_name = name;
                   m_selected = selected;
              public function get name():String
                   return m_name;
              public function set name(value:String):void
                   m_name = value;
              [Bindable]
              public function get selected():Boolean
                   return m_selected;
              public function set selected(value:Boolean):void
                   m_selected = value;
              public function toggleSelection():void
                   selected = !selected;
    and here is my itemrenderer:
    <?xml version="1.0" encoding="utf-8"?>
    <s:IconItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                             xmlns:s="library://ns.adobe.com/flex/spark"  iconWidth="64" iconHeight="64"
                             labelFunction="itemLabelFunction">
         <fx:Script>
              <![CDATA[
                   [Embed(source="checked.png")] 
                   public var checked:Class;
                   [Embed(source="unchecked.png")]
                   public var unchecked:Class;
                   override public function set data(value:Object):void
                        super.data = value;
                        if(value != null)
                             if(value.selected)
                                  decorator = checked;
                                  setStyle("color", "red");
                             else
                                  decorator = unchecked;
                                  setStyle("color", "black");
                   private function itemLabelFunction(item:Object):String
                        return item.name;
              ]]>
         </fx:Script>
    </s:IconItemRenderer>
    As you can see I also use setStyle and change the color when you click it. This is because that works. This is only temporary offcourse.
    And I think that's a strange thing that setStyle does work but setting the decorator to a new image doesn't.
    I hope my question was clear and that someone can help me.
    Thanks in advance.
    Kind regards,
    Thibault Heylen

    I believe this was the bug: http://bugs.adobe.com/jira/browse/SDK-29929
    It will be fixed in the next release of Flex.

  • Hello, i have youtube videos on my iweb site.  but i would like to know if it is possible to get a 'pop-up' affect when you click on a small photo of the video, to open and play the video in a popup?

    hello, i have youtube videos on my iweb site.  but i would like to know if it is possible to get a 'pop-up' affect when you click on a small photo of the video, to open and play the video in a popup?
    we have tried using video light box, but this doesnt seem to work.

    There's an example of one at the buttom of ths page...
    http://www.iwebformusicians.com/Website-Movie-Video/YouTube.html
    Rather than link to the file, the movie is on a separate web page and uses the code shown on this page...
    http://www.iwebformusicians.com/Website-Photos/Image-New-Window.html
    "I may receive some form of compensation, financial or otherwise, from my recommendation or link."

Maybe you are looking for

  • Mountain Lion Problems: Preview, TextEdit, Reminders

    Hi, just updated to Mountain Lion a couple of days ago. Still getting used to it, and as I was poking around seeing how the new stuff works, I noticed that Reminders and Notes wouldn't open, and TextEdit and Preview still continue to not open since t

  • How to read a CSV File

    Hi All, I am new to the forum so i dont know if i can post this message in this section or not but i did not find any related section in the menu so i am posting it here. I want to read a .CSV (comma separated file) in a particular location and see i

  • N80 Working ok except for battery life

    Hi All Just a quick one to say I have not had any of the problems everyone else is complaining about. The software version is 3.0617.0.3 and I am on Orange. My only problem is battery life, lasts a day! so I am about to turn off Bluetooth and the sea

  • How can I fix the top of the volume button that is stuck on my iPad?

    The top of the volume button on my iPad is stuck. How can I fix it?

  • Multiple Clients acess thru same desktop

    I need to investigate for following problem : from one desktop we can connect to multiple different client (different network) by keeping data secure. that is we can open different virtual desktops like VMs and have them secure also controlling priva