• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

window closes when it shouldn't

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am making a simple game program and during the create account it askes you for your account name and i type in my account name and when i hit enter for it to accept the name it just closes the window without reading the account name that i enter.

 
chris barr
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
create charater and create files methods are not used at the moment and don'e give me any problems .. i had the program working before with them in...
 
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi


ok, im not clear about what you are trying to achieve and where you have troubles with your code (several pieces are missing: some classes like FileOutput and so on). but i have some tips for you:

- if your Fileinput/outpout classes have some try/catch, make sure you print the exception at least to the console (Exception.printStacktrace()). better would be to pass them on and react on them.
- don't compare Strings using '=='! use the equals() method. in short: '==' compares the reference while equals() compares the state
- when you write to streams (e.g.) a file then make sure you close them in a finally clause. i dont see you closing any stream but perhaps thats encapsulatet in the FileInput/output classes ?
- try to stick with java coding guidelines: the member "AccountName" should start lowercase.
- in your createAccount method you take have an "accountName" parameter but in the end you write the "AccountName" member/field to the file. if this is a null reference, and you "swallow" exceptions in your Fileoutput class, then this could be your problem: NullPointerException.
- your methods return Boolean (wrapper object) according to the signature but you return boolean (primitive). this is no problem because java 1.5 autoboxes/unboxes them.... but i was not sure if you understand the differences ?
- your createAccountPass method does always return "true"... therefore there is no sense in returning anything at all. just make the method "void"


have fun

pascal
[ May 08, 2006: Message edited by: pascal betz ]
 
chris barr
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the program works up until it askes for the username .. i will input the user name and then the program with quit.




the createaccount and createpassword class and methods are above.
 
I have always wanted to have a neighbor just like you - Fred Rogers. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic