Passing data in to a GUI using java

Discussion in 'Scripting & Programming' started by Colin1, Jun 6, 2007.

  1. Colin1

    Colin1 Byte Poster

    143
    0
    38
    Hello my supremely intelligent, all powerful, all knowing programming dudes hope you are all well? I am in a spot of bother with my java assignment for college. I have managed to progress slightly with it but as hbroomhall will tell you, programming and especially java aint my strong point :x I will explain this to you in short parts because I dont want to bombard you with my java woes all at once, so here goes:

    1) I have created an object called customer, and assigned it the following variables - Name, address, DOB, Occupation. Right so thats the easy bit out the way.

    2) I have also created an object called loan, and assigned it the following variables - loan Amount, loan type, loan duration, monthly pay, total pay, interest rate. Ok thats the second bit done... sorry if this is annoying guys but i am really stuck

    I have also tested these with testcustomer and testloan objects that get this data when javac'd. The problem is I have created 2 GUIs and cannot get this information to pass in to:

    1) GUI1 which gets all the customer info, and when clicked shows GUI2.

    2)GUI2 should get the info from GUI1 and when the user enters the other stuff (loan Amount, loan type, loan duration, monthly pay, total pay, interest rate) a calculate button which I have not yet finished :oops: should calculate all these factors and produce the cost of a loan.

    I am not asking for anyone to do the assignment for me I am just asking for advice on how to get my data from 2 objects in to m y GUIs

    Cheers guys sorry again

    C :p
     
    Certifications: Cisco IT Essentials,
    WIP: IT degree, CIW (Web), A+, N+
  2. supag33k

    supag33k Kilobyte Poster

    461
    19
    49
    Are you using a java gui to develope this? - or is it all done by text methods?

    From memory [about 5 years now] you have to specify classes and/or invoke classes for textframe and pictureframe, as java of course is full WYSIWYG capable once the correct frames are invoked.

    Note that all my course notes are packed at home somewhere.

    btw - check out this Visual Java GUI builder - makes life here easier but your lecurer will prob frown on you using it!....

    http://www.jvider.com/

    supa
     
    Certifications: MCSE (NT4/2000/2003/Messaging), MCDBA
    WIP: CCNA, MCTS SQL, Exchange & Security stuff
  3. dmarsh
    Honorary Member 500 Likes Award

    dmarsh Petabyte Poster

    4,305
    503
    259
    These are all programming fundamentals.

    Your application however simple has a design, in this case it sounds like you've got an application class, a couple gui classes and a couple business classes (cust, loan).

    These objects have different lifetimes in terms of memory and persistent storage.

    The application object should typically get created and destroyed on application startup. It then performs all other duties. It should manage the display and overall program control. Look at the MVC pattern if you wanna get more info but this is a basic prog so don't worry too much for now.

    The application object will own the two display objects and probably create them as required.

    The business objects lifetimes will be related to the use cases you have like register customer etc. You typically create a blank customer object in the main program and then pass it to the form by reference, the form populates the object, the filled in values are left after the method call.
     
  4. Colin1

    Colin1 Byte Poster

    143
    0
    38
    Hy supa , I am using a jdk (java development kit) and then compiling the programs from a CMD. The GUI itself is created using the java import.swing awt action and the actionlistener event. The program I have written uses the flo manager action and rows are added by using add.pane (label name or textfield). It is just a basic form that I have created but unfortunately I have to wrtite the whole bloody thing in Java (code that is). Bring back VB thats what a say

    Cheers m8 :p
     
    Certifications: Cisco IT Essentials,
    WIP: IT degree, CIW (Web), A+, N+
  5. dmarsh
    Honorary Member 500 Likes Award

    dmarsh Petabyte Poster

    4,305
    503
    259
    Yes its rather clunky building it by hand but as I mentioned before, building things from the ground up allows you to understand whats really going on and later you can learn the RAD techniques.

    Most computer science courses teach algorithms and datastructues, very few people should write their own datastructures or algorithms but the point is you now know whats happening when you make those library calls !

    Doing it this way you learn patterns, (MVC, Chain responsibility, Command, Observer etc), calling conventions, memory management, dependencies, design etc.

    Its the Mr Miyagi 'Wax on, Wax Off', its unlikely you will understand as a newbie why your lecturers do some of the things they do...
    Keep working on it and looking for the meaning and it will come.

    Many people hack in VB for years and never learn these fundamentals.
     
  6. Colin1

    Colin1 Byte Poster

    143
    0
    38
    Hy D thanks for the reply m8, yeah I know what you mean bout java GUIs there horrible to build but I no it makes for a better programmer! I would like to get in to programming as I think the concept behind it is interesting but I dont think I am cut out for it, plus I would not have time to learn it with other commitments. Learning java and C, C++ is a course on its own m8 isnt it? and I would never learn what I need to know whilst I am ploughing away at A+, N+, CIW, CCNA,

    Thanks for the help m8 much appreciated

    C :p
     
    Certifications: Cisco IT Essentials,
    WIP: IT degree, CIW (Web), A+, N+

Share This Page

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.