Only exit the current program, not both!

hi, i have a problem with a timer program.
When it "time's out", it starts a new program called reminder2. When you exit reminder2 ( system.exit(1); ) it's quit the program that started it (takati) .
Takati:
class RemindTask  extends TimerTask {
                  public void run() {
                              new reminder2();
                              timer.cancel();
              }Remind2:
          block2++;
          if(block2==2)
          System.exit(11);
          }Thanks in advance!

Sorry for this stupid question, how do i stop it?
i tried with return; but it don't work. It's a gui program , here is the code:
import javax.sound.sampled.*;
import java.applet.*;
import java.util.*;
import java.util.Timer;
import java.util.TimerTask;
import sun.audio.*;   
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
* Summary description for reminder
public class reminder2 extends JFrame
     // Variables declaration
     Timer timer;
     private JLabel jLabel1;
     private JLabel jLabel2;
     private JLabel jLabel4;
     private JPanel contentPane;
     int block;
     int block2;
     int x;
     int y;
     // End of variables declaration
     public reminder2()
          super();
          initializeComponent();
          // TODO: Add any constructor code after initializeComponent call
          this.setVisible(true);
      * This method is called from within the constructor to initialize the form.
      * WARNING: Do NOT modify this code. The content of this method is always regenerated
      * by the Windows Form Designer. Otherwise, retrieving design might not work properly.
      * Tip: If you must revise this method, please backup this GUI file for JFrameBuilder
      * to retrieve your design properly in future, before revising this method.
     private void initializeComponent()
       x = Toolkit.getDefaultToolkit().getScreenSize().width;
          y = Toolkit.getDefaultToolkit().getScreenSize().height;
          jLabel1 = new JLabel();
          jLabel2 = new JLabel();
          jLabel4 = new JLabel();
          contentPane = (JPanel)this.getContentPane();
    block = 0;
          block2 = 0;
                               try {
                 // From file
        AudioInputStream stream = AudioSystem.getAudioInputStream(new File("ljud\\danger.au"));
        AudioFormat format = stream.getFormat();
        if (format.getEncoding() != AudioFormat.Encoding.PCM_SIGNED) {
            format = new AudioFormat(
                    AudioFormat.Encoding.PCM_SIGNED,
                    format.getSampleRate(),
                    format.getSampleSizeInBits()*2,
                    format.getChannels(),
                    format.getFrameSize()*2,
                    format.getFrameRate(),
                    true);        // big endian
            stream = AudioSystem.getAudioInputStream(format, stream);
        // Create the clip
        DataLine.Info info = new DataLine.Info(
            Clip.class, stream.getFormat(), ((int)stream.getFrameLength()*format.getFrameSize()));
        Clip clip = (Clip) AudioSystem.getLine(info);
        // This method does not return until the audio file is completely loaded
        clip.open(stream);
        // Start playing
        clip.loop(Clip.LOOP_CONTINUOUSLY);
    } catch (IOException e) {
    } catch (LineUnavailableException e) {
    } catch (UnsupportedAudioFileException e) {
          // Stream to read file
          FileInputStream fin;          
               try
                   // Open an input stream
                   fin = new FileInputStream ("lib\\msg.txt");
                   // Read a line of text
                   String finS = new DataInputStream(fin).readLine();
             jLabel2.setText(finS);
                         this.setTitle(finS);
                   // Close our input stream
                   fin.close();          
               // Catches any error conditions
               catch (IOException e)
                    System.err.println ("Unable to read from file");
                    System.exit(-1);
          // jLabel1
          jLabel1.setIcon(new ImageIcon("bilder\\maskot.gif"));
          // jLabel2
          jLabel2.setBackground(new Color(255, 0, 0));
          jLabel2.setForeground(new Color(255, 255, 254));
          // jLabel4
          jLabel4.setIcon(new ImageIcon("bilder\\frame.PNG"));
          jLabel4.addMouseListener(new MouseAdapter() {
               public void mouseClicked(MouseEvent e)
                    jLabel4_mouseClicked(e);
               public void mousePressed(MouseEvent e)
                    jLabel4_mousePressed(e);
          // contentPane
          contentPane.setLayout(null);
          contentPane.setBackground(new Color(254, 254, 255));
          addComponent(contentPane, jLabel1, 155,9,50,39);
          addComponent(contentPane, jLabel2, 15,19,147,19);
          addComponent(contentPane, jLabel4, 0,-3,221,66);
          // reminder
    this.setUndecorated(true);
          this.setLocation(new Point(x - 240 , y - 100));
          this.setSize(new Dimension(219, 60));
          this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
          this.setResizable(false);
          this.addMouseListener(new MouseAdapter() {
               public void mouseClicked(MouseEvent e)
                    this_mouseClicked(e);
               public void mousePressed(MouseEvent e)
                    this_mousePressed(e);
     /** Add Component Without a Layout Manager (Absolute Positioning) */
     private void addComponent(Container container,Component c,int x,int y,int width,int height)
          c.setBounds(x,y,width,height);
          container.add(c);
     // TODO: Add any appropriate code in the following Event Handling Methods
     private void jLabel4_mouseClicked(MouseEvent e)
          System.out.println("\njLabel4_mouseClicked(MouseEvent e) called.");
          // TODO: Add any handling code here
          block++;
          if(block==2)
          return;
     private void jLabel4_mousePressed(MouseEvent e)
          System.out.println("\njLabel4_mousePressed(MouseEvent e) called.");
          // TODO: Add any handling code here
          block2++;
          if(block2==2)
          return;
     private void this_mouseClicked(MouseEvent e)
          System.out.println("\nthis_mouseClicked(MouseEvent e) called.");
          // TODO: Add any handling code here
     private void this_mousePressed(MouseEvent e)
          System.out.println("\nthis_mousePressed(MouseEvent e) called.");
          // TODO: Add any handling code here
     // TODO: Add any method code to meet your needs in the following area
     public static void main(String[] args)
          JFrame.setDefaultLookAndFeelDecorated(true);
          JDialog.setDefaultLookAndFeelDecorated(true);
          try
               UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
          catch (Exception ex)
               System.out.println("Failed loading L&F: ");
               System.out.println(ex);
          new reminder2();
//= End of Testing =
}Thanks, you're so nice!

Similar Messages

  • On imac 10.6.8 using current version of Aperture.  How can I access the Aperture Library  on my external hard drive that I use with time machine for backup?  I can only access the application but not the library..

    On imac 10.6.8 using current version of Aperture.  How can I access the Aperture Library  on my external hard drive that I use with time machine for backup?  I can only access the application but not the library..

    Go into Time Machine (the program not the bundle on the extrnal disk) and using Time Machine's browser go to the Folder where the library lives. You could look in the library bundle in Time Machine but that won't really tell you much,
    If you want to make sure it truely has backed up your library you will need to restore it and open the restored library with Aperture.
    If all this still has you confused you need to read up on Time Machine in order to get a feel for how it works, for what it is doing and for how to restore files from it.

  • How do I adjust the page orientation in Pages?  I want to keep the pages above the section break as portrait, and the ones below I want to change into landscape.  Is this possible?  I can only get it to be one or the other but not both.

    I want to keep the pages above the section break as portrait, and the ones below I want to change into landscape.  Is this possible?  I can only get it to be one or the other but not both.

    The work around is to do two documents, one in portrait format and one in landscape format. When finished export to Pdf. open in Preview by select both files and use Cmd + O or doubleclick. You can now in Previews thumbnail column the pages from one document into the other and then save.
    If you have created only one with i.e. all pages in portrait format but with the content for the landscape pages rotated on the pages, you can rotate the pages in Preview. Two ways to get the same result.

  • I can only print the current page of downloaded pdf's.  Not able to print "all".  I'm using a Macbook air.

    I can only print the current page of downloaded pdf's.  Not able to print "all".  I'm using a Macbook air.

    it says "the document could not be printed".  "There were no ages selected to print".
    I selected "all".  I always tried selecting pages "1-3".
    The only choice that works is current page.  Very strange.

  • My Menu Bar will not recognize Firefox as the current program?

    I am having trouble with my Mac Menu Bar. Firefox is not in Full Screen mode, and the Menu Bar is visible, but it is not registering Firefox as being the current program, causing me to loose things such as "Bookmarks" and "History" or even "Force Quit". Does anyone know how to fix this?

    You can try to do some maintenance.
    Repair the disk permissions:
    *http://thexlab.com/faqs/repairprocess.html
    Remove the Firefox plist file (org.mozilla.firefox.plist).
    *http://www.macfixit.com/article.php?story=20060606082246983 How .plist files become corrupt and troubleshooting the results
    Go to "~/Library/Preferences" and remove the plist file for Firefox (org.mozilla.firefox.plist)

  • Time Machine only shows the current copy of the file I am trying to restore. There is none of the time machine backup histories shown. I am running OSX 10.7.5. I see the backup files on my external Time Machine hard drive. Help

    Time Machine only shows the current copy of the file I am trying to restore. There is none of the time machine backup histories shown. I am running OSX 10.7.5. I see the backup files on my external Time Machine hard drive in the Backups.backupdb folder.
    Time Machine does show the history of my Macintosh HD, but when I try to navigate to the folder I wish to restore the backup history disappears. I've been searching for answers and I have not found one that works for me.

    Time Machine only shows the current copy of the file I am trying to restore. There is none of the time machine backup histories shown. I am running OSX 10.7.5. I see the backup files on my external Time Machine hard drive in the Backups.backupdb folder.
    Time Machine does show the history of my Macintosh HD, but when I try to navigate to the folder I wish to restore the backup history disappears. I've been searching for answers and I have not found one that works for me.

  • HT4356 Mavric doesn't support my 5 years old Big Screen Display, OR? Tried to connect my Mac Book Pro after installing Mavric, The Screen didn't work as before. I could only see the Desktop but not the movies for example. What can I do?

    Mavric doesn't support my 5 years old Big Screen Display, OR? Tried to connect my Mac Book Pro after installing Mavric, The Screen didn't work as before. I could only see the Desktop but not the movies for example.
    <E-mail Edited by Host>

    It appears what happened is the installer though it was looking at a empty drive and just went ahead and installed.
    I of course am assuming here you didn't use Disk Utility to format the drive first before installing, that would wipe out your files and programs for sure.
    So what to do, what to do.
    Well there is hope for you as long as the drive wasn't Filevaulted.
    I'll explain. When a hard drive writes data for the first time to a drive, it starts at the very top and works it's way down.
    When OS X was installed the first time, it was at the top of the drive, unless you upgraded then the upgraded OS X could have been written elsewhere.
    Now when you just reinstalled OS X, the new OS went on the top of the drive, overwriting any data that was there previously, so what was there you have lost forever which is about 8GB or so. If it was the previous OS there, then your more in luck because only the old OS X was overwritten.
    The remaining space on the drive still can have a copy of your files, provided it's not overwritten yet.
    It's because when a hard drive deletes data or reformats, it doesn't remove the data off the drive or overwrites it immediately, it's just made so it's SPACE is available for new files to be written there.
    So technically one can recover the deleted data off a non-encrypted/scrubbed hard drive with special software.
    The way it does this is it reads the 1's and 0's of the files themselves, and through a lot of figuring out, can tell what that file is and what it belongs too.
    So what you will have to do is this:
    Create a data recovery/undelete external boot drive
    or if you don't have the skills, then take it to a local PC/Mac tech and they can do a direct image of the drive and then you can run Data Rescue on it to rebuild your files.

  • How do I create both endnotes and footnotes in same doc in Pages? I have iWork 2008. I understand how to create one or the other, but not both.

    How do I create both endnotes and footnotes in same doc in Pages? I have iWork 2008. I understand how to create one or the other, but not both.

    You have to select one or the other.
    Try making two documents and see if you can merge the .pdfs, but their will be problems with page flow, making the pages shift. Can't see it working really.
    Pages is not the only solution out there or the best for most jobs (let alone the safest). Try Word for Mac, LibreOffice (free) or any App that has the features you need.
    Peter

  • When I facetime the ipad (email address) it calls my phone. The accounts are completely separate. How can I get this to only call the ipad and not my phone as well?

    When I facetime the ipad (email address) it calls my phone. The accounts are completely separate. How can I get this to only call the ipad and not my phone as well?
    It calls both the ipad and iphone when calling the associated email address for the ipad. However, when I call the iphone it does not call the IPAD.
    Thanks for your help

    Are you trying to message another Apple device?
    Using FaceTime http://support.apple.com/kb/ht4319
    Troubleshooting FaceTime http://support.apple.com/kb/TS3367
    The Complete Guide to FaceTime + iMessage: Setup, Use, and Troubleshooting
    http://tinyurl.com/a7odey8
    Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/TS4268
    Using FaceTime and iMessage behind a firewall
    http://support.apple.com/kb/HT4245
    iOS: About Messages
    http://support.apple.com/kb/HT3529
    Set up iMessage
    http://www.apple.com/ca/ios/messages/
    Troubleshooting Messages
    http://support.apple.com/kb/TS2755
    Setting Up Multiple iOS Devices for iMessage and Facetime
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
    FaceTime and iMessage not accepting Apple ID password
    http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/
    Unable to use FaceTime and iMessage with my apple ID
    https://discussions.apple.com/thread/4649373?tstart=90
     Cheers, Tom

  • Calling another program from the current program

    Hi all,
    In our requirement we are calling another program from our current program .
    In the current program( from which we are calling ) we are giving file name in the selection screen
    and when we run the current program we are successfully going to other program but our main requirement is to higlight the file name which we had given earlier .
    Note :  The called program doesnt have any selection screen.

    HI
    use EXPORT and IMPORT key words for passing data from one program to another program.
    as the called program is available in the same session you can use above key words which means you are accessing ABAP MEMORY.
    You can also use SET and GET key words which means SAP memory
    take F1 help there are examples tooo and detailes explanation abou the same
    Regards
    Ramchander Rao.K
    Edited by: Ramchander Krishnamraju on Dec 24, 2008 7:05 AM

  • How do I set upmy Imac to allow using both my computer speakers and a Bose SoundLink system as outputs at the same time.  I can use one or the other, but not both.

    how do I set up my Imac to allow using both my computer speakers and a Bose SoundLink system as outputs at the same time.  I can use one or the other, but not both.  From systems Preferences I must select one or the other.  I want both to work all the time.

    Hi,
    I would recommend you to use 0FI_AP_4 rather using both, particularly for many reasons -
    1. DS: 0FI_AP_4  replaces DataSource 0FI_AP_3 and still uses the same extraction structure. For more details refer to the OSS note 410797.
    2. You can run the 0FI_AP_4 independent of any other FI datasources like 0FI_AR_4 and 0FI_GL_4 or even 0FI_GL_14. For more details refer to the OSS note: 551044.
    3. Map the 0FI_AP_4 to DSO: 0FIAP_O03 (or create a Z one as per your requirement).
    4. Load the same to a InfoCube (0FIAP_C03).
    Hope this helps.
    Thanks.
    Nazeer

  • I used to have a close tab for exiting the current site I was on instead of closing all of firefox. How do I get it back?

    I used to have a close tab for exiting the current site I was on instead of closing all of firefox. It was a red box with an x in it. How do I get it back?

    Click in a blank space on a toolbar & open 'customize'. You'll find that there is a gray "x" (on my browser it's gray) that is for closing a tab. Drag it up to wherever you want on the toolbar & it should work fine.

  • HT5858 In the control center I can change the mute or the rotation but not both.  How do I fix this.  In settings I can not uncheck both the mute and rotation lock.

    In the control center I can change the mute or the rotation but not both.  In the settings area therefore I can't uncheck the mute and rotation settings at the same time.

    Check your settings. The iPads have a small switch on the right edge. It can be used as a rotation lock to keep the screen from automatically reorienting itself as you move around, but you need to have the tablet’s settings configured properly. That same switch, right above the volume buttons, can also be set to function instead as a mute button to silence certain types of audio.
    If the switch is set to work as a mute button, you can change its purpose to “screen-rotation lock” by tapping the Settings icon on the home screen. On the Settings screen, tap General on the left side, and on the right side of the screen flick down to “Use Side Switch to.” Tap to select Lock Rotation or Mute to set the button’s function. Even if you set the side switch for your preferred use, you can still mute the Mini or lock the screen. Just double-click the Home button, and when the panel of apps appears along the bottom edge of the screen, flick the row from left to right with your finger. Tap the icon on the far left side of the row to either lock the iPad’s screen or mute the iPad’s alerts, notifications and sound effects. Music, podcasts and video are not muted unless you turn the volume all the way down.
     Cheers, Tom

  • In Outbound Delivery, PGI to be allowed only to the Current Date(System dt)

    Dear Friends,
    Kindly provide me the options to check that the PGI to be done only for the Current date ( System Date ) in Outbound Delivery.
    Thanks & Regards
    T.Arulvanan

    Hi,
    Please ellorate your question in more detail.
    Normally the system does the PGI date is the current date.You can check in Actual Goods Movement Date.
    Thanks & Regards,
    Hemant Patil

  • I started to learn HTML, and I'm using text edit and everything is going fine, when I save the file with a .html extension and open it with safari I only view the code and not the webpage that was supposed to be created.

    I started to learn HTML, and I'm using text edit and everything is going fine, when I save the file with a .html extension and open it with safari I only view the code and not the webpage that was supposed to be created.

    That is because you don't have a web server configured and running to serve the html page. In order to see the page in a browser you need to access it using a url similar to http://localhost/~yourUserName if you are serving the page from your user account.
    Prior to Mountain Lion you could go into web sharing and turn on the web server. With Mountain Lion there is no option, other than using terminal, to turn on the web server. The web sharing menu item has been removed in Mountain Lion. Apache is still on your computer but it will take a little searching these forums or the Internet to find how to turn it on.
    If you want a graphic user interface to turn on/off the Apache server you could download and install a server application like xampp, http://www.apachefriends.org/en/xampp.html. I use this and it works well.

Maybe you are looking for