Results 1 to 6 of 6
  1. #1
    AWJustAGuy is offline Member
    Join Date
    Apr 2012
    Posts
    12
    Rep Power
    0

    Default Swing, MVC, and Files, oh my!

    Hello, I suck at introductions so I'll get right into this. I don't really have a coding question, I'm just not sure what Java is capable of.
    I'm trying to make a basic file editor using a Java Swing GUI. I filter in a list of accounts with an ID#, Name, and money value. Then, I'm supposed to be able to edit these things in the GUI and save the file edits through the GUI. I guess I'm just confused on the whole files set up. I have a GUI class and a file reading class that makes the accounts and sends it to the GUI, but the GUI (so far) is just breaking down the accounts into individual variables and doing all sorts of sorting hijinks just to treat each account as one entity.

    Is there an easier way to set this up? Is there a way I can edit a whole struct (whatever that is in Java, I'm used to C++) in the GUI? I want a drop down list displaying the account names which I can then click to have access and edit the whole account.

    Thanks for taking a look at this, and let me know if I need to be more descriptive, I'm trying not to make this a wall of text.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Swing, MVC, and Files, oh my!

    Quote Originally Posted by AWJustAGuy View Post
    Hello, I suck at introductions so I'll get right into this. I don't really have a coding question, I'm just not sure what Java is capable of.
    And welcome to the Java-Forums.org!

    I'm trying to make a basic file editor using a Java Swing GUI. I filter in a list of accounts with an ID#, Name, and money value. Then, I'm supposed to be able to edit these things in the GUI and save the file edits through the GUI. I guess I'm just confused on the whole files set up. I have a GUI class and a file reading class that makes the accounts and sends it to the GUI, but the GUI (so far) is just breaking down the accounts into individual variables and doing all sorts of sorting hijinks just to treat each account as one entity.
    You might want to go into a bit more detail on just what "hijinks" are going on.

    Is there an easier way to set this up? Is there a way I can edit a whole struct (whatever that is in Java, I'm used to C++) in the GUI? I want a drop down list displaying the account names which I can then click to have access and edit the whole account.
    The program can do whatever you code it to do, no more and no less. I think of a GUI as little more than a dumb viewer for the brains behind the scene, the model, and that's where you should put most of your energies -- creating classes for manipulating multiple accounts, for getting lists of these accounts, for extracting an account from this list, for manipulating the extracted account, and so forth. Then create your GUI to interact with the model, to respond to its changes of state, and to allow interaction with the model through the GUI's control -- through its listeners.

  3. #3
    AWJustAGuy is offline Member
    Join Date
    Apr 2012
    Posts
    12
    Rep Power
    0

    Default Re: Swing, MVC, and Files, oh my!

    Great! That is actually very helpful. I just needed a direction to go into, I was sort of lost in the woods using 3-year-old C++ knowledge to try and hack this together. Now I can begin the searching and learning... woo. Thanks for the fast response!

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Swing, MVC, and Files, oh my!

    Quote Originally Posted by AWJustAGuy View Post
    Great! That is actually very helpful. I just needed a direction to go into, I was sort of lost in the woods using 3-year-old C++ knowledge to try and hack this together. Now I can begin the searching and learning... woo. Thanks for the fast response!
    You're welcome, and best of luck with this project and your Java education. Just out of curiosity, are you a university student? Or a hack like me just programming for the hellavit?

  5. #5
    AWJustAGuy is offline Member
    Join Date
    Apr 2012
    Posts
    12
    Rep Power
    0

    Default Re: Swing, MVC, and Files, oh my!

    Quote Originally Posted by Fubarable View Post
    You're welcome, and best of luck with this project and your Java education. Just out of curiosity, are you a university student? Or a hack like me just programming for the hellavit?
    Haha, actually doing both at once. I'm in my last semester of university doing Computer Science but I'm realizing that all this education has been mostly pointless so I'm doing a bunch of my own projects so I can have some skills to put on a resume.

  6. #6
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default Re: Swing, MVC, and Files, oh my!

    Your GUI will be breaking things up into fields on the screen.
    Do not confuse this with your model, which is what would be passed to your GUI to display.
    When the user has changed some data and hit the 'save' button (or whatever) then the GUI will pass the edited object back to the business layer (the controller) which will save it.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 11
    Last Post: 12-04-2011, 10:10 PM
  2. Replies: 2
    Last Post: 06-11-2011, 01:54 PM
  3. Replies: 4
    Last Post: 04-13-2011, 03:35 AM
  4. Replies: 8
    Last Post: 07-30-2010, 05:47 PM
  5. Create view of files in java-Swing
    By Albert in forum AWT / Swing
    Replies: 1
    Last Post: 07-06-2007, 06:06 PM

Posting Permissions

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