Results 1 to 2 of 2
  1. #1
    histamineblkr is offline Member
    Join Date
    Oct 2013
    Rep Power

    Default Suggest the Proper Time to Ask, Populate TextAreas, and Read a File

    Hello all,

    This is my first post here and I'll try to do it as well as I can and not mess to much up.

    Background to Present

    I wrote a stock percentage calculator in python about 2 years ago because I wanted to know how much total value change had occured with my 7 stocks at any given time and I had never written anything in python so it was a good learning experience. I wrote it so that it ran from the command line with all text prompts. I now want to update it, port it to Java, and have a graphical user interface (GUI).

    I should start with where I am at right now. I have created an algorithm of what I would like to accomplish with this program (my algorithm skills are not well developed but it should help to illustrate what I'd like to accomplish so you all can effectively help me with my questions). I also created a visual of what I'd like the GUI to look like. I did this to illustrate (and because GIMP is fun ) if I will be able to dynamically populate the GUI according to a text file that is read with stock information (jFileChooser) or with a jOptionPane that runs before intializing the GUI that can populate how many stocks the user wants to calculate. I think it would be possible to open a blank GUI and have an "add stock" button that created fields until the user had as many as they wanted and could calculate their percentage, but I'm not sure if that would be easier or harder than just populating 3 columns per stock inputed by the user.

    I have included the two files at the end of this post.

    Problems and Questions

    An immediate problem that arises for me is the proper time and place to call the jOptionPane/jFileChooser. I would want to call it before I create the top level window but it isn't as easy as that. I have used NetBeans and it often creates some very ugly and unreadable GUI code, but you do get the ease of using an editor. That option doesn't seem viable since I want to dynamically create a window according to the text file or user input. I'm not adept at writing my own GUI code but I have done it before and had decent results. My two fold question is where would be an effective place to call the jOptionPane/jFileChooser and can you point me in the right direction (Article/API) that would help create those fields dynamically inside that window? Or will it just be iterating through a for loop and creating the fields and labels?

    I'm familar with layouts and can research any suggested layouts you think will work. I'm thinking GridLayout or SpringLayout will accomplish this so has anyone done something like this?

    Thank you for all and any help to get me on the right path and started.


    Stock Percentage Calculator

    1. Ask whether to read a text file with all stock names and purchased prices or ask how many stocks to input.
    Text file example:

    ABC Stock
    DEF Stock

    2. Populate the User Interface with TextLabels and TextFields according to that information.


    Suggest the Proper Time to Ask, Populate TextAreas, and Read a File-spcexample.png

    3. Calculate the percentage change in all stocks and then sum the total change.

    4. Display the total percentage change in value.

    GUI Example

    Suggest the Proper Time to Ask, Populate TextAreas, and Read a File-windowforstockpc-w-total2.jpg
    Last edited by histamineblkr; 10-18-2013 at 09:30 AM. Reason: Improper image displays

  2. #2
    histamineblkr is offline Member
    Join Date
    Oct 2013
    Rep Power

    Default Re: Suggest the Proper Time to Ask, Populate TextAreas, and Read a File

    This thread has had quite a few views but no replies, is there something I am missing or does anyone just not have suggestions?

Similar Threads

  1. Replies: 10
    Last Post: 04-01-2013, 02:50 PM
  2. how to append data entered by user to XML file in proper format using JSP
    By gurpreet.singh in forum JavaServer Pages (JSP) and JSTL
    Replies: 8
    Last Post: 03-09-2011, 12:22 PM
  3. Replies: 2
    Last Post: 04-07-2009, 07:25 AM
  4. To populate the data processed into a .csv or excel file
    By jaiminparikh in forum Advanced Java
    Replies: 2
    Last Post: 02-27-2009, 12:56 AM

Posting Permissions

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