Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Java - Exit Stand-Alone Application?


  • Please log in to reply

#1
Spider-Man

Spider-Man

    Member

  • Member
  • PipPipPip
  • 167 posts
Hello, having a slight problem with my Java project.

I've got an ActionCommand if statement, the first part of the loop which 'listens' for the action command of the 'Start Game' button. There are two buttons on the first panel, Start Game and Quit. The Start Game button works as expected and takes you to the second panel, which contains a Quit button - which works as expected(ie.the application closes). However, the quit button on the first panel doesn't seem to work. This is the same piece of code I've got in both panels for both buttons.

If (e.getsource=("quit")) {

System.exit(0);

}


Is this the correct way to 'exit' from a stand-alone program?

Now that I've pretty much got the program working,with the exception of the Quit button, I wondered if it's possible to save the program(I use JCreator) so that the file becomes an executable file. Just like in Visual Basic when you save the file as an Application and you can just locate the file on your hard drive, double click it and it will run, without having to open any other programs - is there any easy way to do this with Java?

If you can help me, thanks :whistling:
  • 0

Advertisements


#2
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 875 posts
are you still having a problem?

observation #1:

If (e.getsource=("quit")) {

should be:

If (e.getsource==("quit")) {


...........................................

if you are still having problems, send more code
  • 0

#3
Spider-Man

Spider-Man

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 167 posts
In a word, no. I eventually got the Exit button working. Then, a couple of days later, I lost my memory stick - my entire project down the drain. I was planning to back up all my hard drives and memory sticks to my new hard drive when it arrived, but I lost the memory stick the day before the new hard drive arrived - and I've got no backups of any of my work. Gutted. Thanks for your help anyway:)
  • 0

#4
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 875 posts
glad to hear you got it working.

it's ok to backup often.

too late for the advice.

good luck in the future.

hang in with java - it's the best
  • 0

#5
swordofdestiny

swordofdestiny

    Member

  • Member
  • PipPip
  • 23 posts
yeah, Java's fun and thanks to the AP test I have 3 free elective credits at utd (when I go there)
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP