Re: Writing to a file and a TextArea
- From: IchBin <weconsul@xxxxxxx>
- Date: Fri, 24 Feb 2006 22:47:08 -0500
zhah99 via JavaKB.com wrote:
Hey there, one more question, if you have time. Let's say I am the user andSure.. 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 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!!
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-)
.
- References:
- Writing to a file and a TextArea
- From: zhah99
- Re: Writing to a file and a TextArea
- From: IchBin
- Re: Writing to a file and a TextArea
- From: zhah99 via JavaKB.com
- Re: Writing to a file and a TextArea
- From: zhah99 via JavaKB.com
- Writing to a file and a TextArea
- Prev by Date: Re: How to make Image size as the label has?
- Next by Date: does java has any api for compressing files or folders by tar and gzip?
- Previous by thread: Re: Writing to a file and a TextArea
- Next by thread: Re: Writing to a file and a TextArea
- Index(es):
Relevant Pages
|
|