Results 1 to 8 of 8

Thread: java BankGUI

  1. #1
    Custom User
    Join Date
    Oct 2001
    Posts
    503

    java BankGUI

    I've got an assignment in uni, and I wanted to see what you think of this program. Oh god...this is getting sad - I'm actually starting to hog the code review forum.

    The program is designed to simulate a basic bank which allows you to create accounts and then deposit/withdraw from those accounts. Some features that are apparent on the program, such as the interest rate (that might actually be the only feature, I'm not sure), are not actually implemented in the program, but I would like you to ignore that (or at least not comment too much on it).

    I was hoping that some people could comment on the design of the gui, and the way that it was coded, and also, that someone could give me an idea of how to get those bloody labels on the account details page to look aligned/tidy.

    Thanks,

    ac

    (and once again, please note that I had to add the .txt extension to be allowed to upload the file)

  2. #2
    Banned
    Join Date
    Aug 2003
    Posts
    130
    Code:
    import javabook.*;
    We need that package in order to compile.


    Code:
    setResizable(false);
    You should always set resizable to false unless you want to make a method that will handle changes in the size of the window(s). Otherwise if the user changes the size of the window the gui components will be everywhere.


    Code:
    super("Bank GUI");
    Could also use:

    Code:
    setTitle("Bank GUI");
    Thats more self explanatory.


    Code:
    bank = new Bank(MAX_ACCOUNTS);
    I don't like it when an instance has the same name as the class. You might capitalize the B, and when you have thousands of lines of code it would be a pain and a waste of time to have to go back and correct all of the errors you made. Of course you could use Find/Replace but i believe its better to have not made the mistake at all.

    I would use:

    Code:
    bbb = new Bank(MAX_ACCOUNTS);

    Thats as far as i have reviewed your code. I could get through more and look at the problem you are having with the labels but i need to be able to compile and see the problem.

  3. #3
    Custom User
    Join Date
    Oct 2001
    Posts
    503
    Sorry bout that. I forgot that I had put a javabook class in it. Javabook is just a set of simple classes provided with a java textbook by thomas wu. I imported it because I didn't want to write my own messagebox when there was already another class that had it.

    I realise that it is a bad idea to give objects the same name as the class. That is just down to me being lazy. (It also doesn't help that one of my lecturers, and I believe java by thomas wu, do that all the time :P)

    I don't understand why you pointed out to me setResizable(false) when I already have that in my program...were you just explaining the reason for it?

    Anyhow...I've attached the javabook classes so that you can compile the program. Thanks for the reply.

    ac

  4. #4
    Custom User
    Join Date
    Oct 2001
    Posts
    503
    After you making the point about javabook, I realised I forgot to attach a few other classes you'll need. Here they are.

  5. #5
    Banned
    Join Date
    Aug 2003
    Posts
    130
    I don't understand why you pointed out to me setResizable(false) when I already have that in my program...were you just explaining the reason for it?
    Yes because i believe it is very important that your gui looks organized and not chaotic which is what a resize can do in Java.

  6. #6
    Banned
    Join Date
    Aug 2003
    Posts
    130
    O man were do i start... Im trying to be as nice as possible but if i seem mean im not trying to be.

    First off you need to correct the deposit and withdraw because i can deposit and withdraw using more than 2 digits after the decimal. I dont know about the uk but in us dollars money value cant go beyond the second digit after the decimal. I would use the DecimalFormat class(duh!!)<-Not making fun of you just the name says it all.

    You need to set up a couple of try-catch blocks.
    1.NumberFormatException: When i enter a string into the account details-deposit/withdraw text box i get a NumberFormatException.
    I can enter a string into the account number box and get a NumberFormatException too.

    2.StringIndexOutOfBoundsException: In the account details when i select No Account Selected and deposit and withdraw a value i get a StringIndexOutOfBounds exception.

    Thats all the errors i have found up to now.
    I will help you tomorrow with your code, but right now i have to get some shut-eye.

  7. #7
    Banned
    Join Date
    Aug 2003
    Posts
    130
    uk
    Im such a dumbass i mean scotland.

  8. #8
    Custom User
    Join Date
    Oct 2001
    Posts
    503
    That's a fair enough point (about being able to enter more than two digits after the decimal), but I should have explained that we were told not to bother implementing any error checking. I did, however, include some try-catch blocks in when I was updating the code two days ago because I had realised that there was a problem.

    Thanks for pointing out the DecimalFormat class...I just hadn't noticed it (have never used it before, and didn't look for it). I actually hadn't thought about the fact that you could enter more than two digits after the decimal point.

    I noticed the StringIndexOutOfBoundsException when doing some testing, but haven't had a chance to fix that. I did fix the problem when you don't enter an account number and try to create an account, or enter something other than a number.

    Could you give me some feedback on the way the gui looks if you have some time? Thanks for the replies, man.

    ac

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •