•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 426,974 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,413 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 3692 | Replies: 59 | Solved
![]() |
OK, you have to be talking about currCD that I kept trying to stick everywhere.
Now that I think I know the right place to put it I cannot get it to work.
return ("Artist: " + currCD.getArtist() +
I have tried it three or four different ways thinking I just had the syntax wrong, but I am now beginning to thing that maybe once again I am just using the wrong one.
Now that I think I know the right place to put it I cannot get it to work.
return ("Artist: " + currCD.getArtist() +
I have tried it three or four different ways thinking I just had the syntax wrong, but I am now beginning to thing that maybe once again I am just using the wrong one.
I never drew first, but I drew first blood.
I'm no ones son, unforgiven.
I'm no ones son, unforgiven.
of course not, if you could I would be a programming genious, because I try it 10 times a day it seams.
I also tried putting
CdwArtist currentCD = (CdwArtist) listModel.get( currCD );
back into my inventory class, and calling
return ("Artist: " + (listModel.get(currCD)artist)
but it errors also.
I think I am just grabbing at straws now that I am in the 11th hour and this project is due any minute now.
I also tried putting
CdwArtist currentCD = (CdwArtist) listModel.get( currCD );
back into my inventory class, and calling
return ("Artist: " + (listModel.get(currCD)artist)
but it errors also.
I think I am just grabbing at straws now that I am in the 11th hour and this project is due any minute now.
I never drew first, but I drew first blood.
I'm no ones son, unforgiven.
I'm no ones son, unforgiven.
toString() is a method of the CdwArtist class. You do not need to access the list at all - it's purpose is to return information about the object instance itself. Methods that need that information call aCdObject.toString() to get it's string value. You seem to be running yourself in circles there but I cannot see why. You had a working toString() on the class so I'm not sure what you are trying to change.
Right now, each time I add a cd it lists it in the panel. When I add the next one, it keeps the first one in the panel and lists the second one underneath it.
I only want one listed at a time. When I hit add, I want the last one out of the panel and ONLY the new one in there.
I thought that would be accomplished by fiddling with the toString, but now that you say that it seems like more of a panel issue.
I only want one listed at a time. When I hit add, I want the last one out of the panel and ONLY the new one in there.
I thought that would be accomplished by fiddling with the toString, but now that you say that it seems like more of a panel issue.
Last edited by no1zson : Jul 27th, 2007 at 6:54 pm.
I never drew first, but I drew first blood.
I'm no ones son, unforgiven.
I'm no ones son, unforgiven.
Well, that is because it is a JList, which is suppose to display multiple items. toString() merely determines what the list displays for each item you add to it.
If you just want to show a single description then all you need is a text area or a label to show the description for a particular object.
If you just want to show a single description then all you need is a text area or a label to show the description for a particular object.
Text area?
I have never heard of this.
Can I make it display the full contents of the currCD, whichever one that may be?
Care to quickly show? Or is this a long drawn out process that will only confuse me further.
This is the final step of this project, "The GUI should display the information one product at a time"
I have never heard of this.
Can I make it display the full contents of the currCD, whichever one that may be?
Care to quickly show? Or is this a long drawn out process that will only confuse me further.
This is the final step of this project, "The GUI should display the information one product at a time"
Last edited by no1zson : Jul 27th, 2007 at 7:12 pm.
I never drew first, but I drew first blood.
I'm no ones son, unforgiven.
I'm no ones son, unforgiven.
•
•
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,467
Reputation:
Rep Power: 11
Solved Threads: 296
JTextArea jta = new JTextArea();
jta.append("CD Description");
//Or you can do
jta.setText("CD Description"); Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Thanks Peter, but I think that is going to be too little too late. I need to get my project submitted, do not really have the time to try and learn and impliment that.
I do not want to sit here and just beg for code so I am going to close this thread.
Hopefully next week will be a better week.
I appreciate everyones help.
I do not want to sit here and just beg for code so I am going to close this thread.
Hopefully next week will be a better week.
I appreciate everyones help.
I never drew first, but I drew first blood.
I'm no ones son, unforgiven.
I'm no ones son, unforgiven.
Even after I turned it in I kept working on it. I did discover one interesting piece of information, you can use html tags to format toString output. <br> being a newline command in html.
public String toString()
{
return "<html>Artist: " + artist +
" CD Name: " + name +
"<br> Item Number: " + itemno +
" Price: " + formatter.format(getPrice()) +
"<br> In Stock: " + nstock +
" Stock Value: " + formatter.format(getValue()) +
"<br> Restocking Fee: $" + restock +
"<br> Total Inventory Value: " + formatter.format(getTotal())+ "</html>";
} I never drew first, but I drew first blood.
I'm no ones son, unforgiven.
I'm no ones son, unforgiven.
![]() |
•
•
•
•
•
•
•
•
DaniWeb Java Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Previous Thread: Keyword search in a web page
- Next Thread: Please help!!



Linear Mode