Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to convert string to lots of list  RSS feed

 
shaon husain
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do i seperate a string to use, extract of code
when user clicks CheckBtn, the before information should stay therefore the ., what i need is somehow to extract the info from the information text area, and use it to do calculation, someone told me arraylist and Jlist but have no idea.

eg
i need to get it to save the key and quantity for each row, so i can do things with it later, and be able to do
 
Greg Charles
Sheriff
Posts: 3014
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi shaon, welcome to JavaRanch!

The code in your first listing from line 7 - 13 should be part of your actionPerformed(ActionEvent) method. Instead of sticking the new data directly into the TextArea, you should create an object from the four pieces of data. (You will need to create a class to hold this data.) I think an ArrayList is a good idea. You can add the object to that ArrayList. Finally, you need to iterate through the ArrayList and use it to populate the TextArea. Try to solve those problems one at a time, and don't go on to the next one until you get one working perfectly.

I don't think you need JList, but I'd suggest using a JTextArea. TextArea comes from AWT, and all the "J" components come from Swing. I haven't done Java GUI programing for a long time, but I remember mixing AWT and Swing components caused annoying problems.
 
shaon husain
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how would i set up the array list, thanks and line 7-13 is in actionPerformed bit
 
shaon husain
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
PurchaseItem.java

ive attached a zip folder of the files im trying to use JList but can join two windows together. its on dropbox
 
Greg Charles
Sheriff
Posts: 3014
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shaon husain wrote:how would i set up the array list, thanks and line 7-13 is in actionPerformed bit


Maybe I'm not understanding your question, but:


You have to define the Order class to have the four pieces of information that you want to report.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!