Re: Writing to a file and a TextArea



zhah99 via JavaKB.com wrote:
Hey there, one more question, if you have time. Let's say I am the user and
I want to enter a name "Alex" and then I sold 5 of Product 2 and I also sold
4 of Product 3. Is there a way I can enter in Alex the number and the
product amount then hit salesman entry done and then put his name in again
Alex but then a different product and amount and when it displays still only
have his name listed once with everything added together?

zhah99 wrote:
Thank you so much for your reply. Everything is running great!! I
appreciate your help very much!!

Sure.. Just added a Number_of input field or better yet use a JSpinner for user to select the number_of. I can pass you code if you have a hard time with that.

I would not use a switch on product for subtotals. In your sample, I would have an array of 2 dimensions call it 'ProductCostArray'. The first Dim is your product code (index++), since this is what the numbers are now. The second dim would be [0]cost_product and [1]sales_amt you multiply. This way you can just loop thru and calculate in three lines of code.

Good place to look for examples is at "The Java Developers Almanac 1.4":
http://javaalmanac.com Just search for the object to see examples.

Take a peek at the JTextComponent. You can do some really neat things with this, it in respect to formating.

Take a look at JGoodies Forms and L&Feel Libs at https://jgoodies.dev.java.net for a layout manager. I find it to have more power than GridBagLayout but with a tenth of the headaches.

Hope this make sense. Not sure where you are going with this but you should start thinking about persistence.

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
.



Relevant Pages

  • Re: Writing to a file and a TextArea
    ... Hey there, one more question, if you have time. ... I want to enter a name "Alex" and then I sold 5 of Product 2 and I also sold ... product amount then hit salesman entry done and then put his name in again ...
    (comp.lang.java.gui)
  • Re: Tickets for Reading on 4th
    ... "In some ways cramp is worse than having a broken leg." ... Alex the Carling Cup game against Reading is being sold online, ...
    (uk.sport.football.clubs.liverpool)
  • Re: Tickets for Reading on 4th
    ... - Kevin Keegan ... Alex the Carling Cup game against Reading is being sold online, ...
    (uk.sport.football.clubs.liverpool)
  • Re: Looking for a 123 driver window
    ... >I called up my friend, he said the parts have already been sold:| ... Prev by Date: ...
    (alt.auto.mercedes)