User Name Password Register
DaniWeb IT Discussion Community
All
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
Reply
Join Date: Jul 2007
Posts: 186
Reputation: no1zson is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
no1zson's Avatar
no1zson no1zson is offline Offline
Junior Poster

Re: First JLIST, used with GUI Inventory

  #51  
Jul 27th, 2007
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.
I never drew first, but I drew first blood.
I'm no ones son, unforgiven.
Reply With Quote  
Join Date: May 2007
Location: USA
Posts: 2,847
Reputation: Ezzaral is a name known to all Ezzaral is a name known to all Ezzaral is a name known to all Ezzaral is a name known to all Ezzaral is a name known to all Ezzaral is a name known to all 
Rep Power: 12
Solved Threads: 283
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Posting Maven

Re: First JLIST, used with GUI Inventory

  #52  
Jul 27th, 2007
You cannot call a method on an int.
Reply With Quote  
Join Date: Jul 2007
Posts: 186
Reputation: no1zson is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
no1zson's Avatar
no1zson no1zson is offline Offline
Junior Poster

Re: First JLIST, used with GUI Inventory

  #53  
Jul 27th, 2007
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 never drew first, but I drew first blood.
I'm no ones son, unforgiven.
Reply With Quote  
Join Date: May 2007
Location: USA
Posts: 2,847
Reputation: Ezzaral is a name known to all Ezzaral is a name known to all Ezzaral is a name known to all Ezzaral is a name known to all Ezzaral is a name known to all Ezzaral is a name known to all 
Rep Power: 12
Solved Threads: 283
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Posting Maven

Re: First JLIST, used with GUI Inventory

  #54  
Jul 27th, 2007
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.
Reply With Quote  
Join Date: Jul 2007
Posts: 186
Reputation: no1zson is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
no1zson's Avatar
no1zson no1zson is offline Offline
Junior Poster

Re: First JLIST, used with GUI Inventory

  #55  
Jul 27th, 2007
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.
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.
Reply With Quote  
Join Date: May 2007
Location: USA
Posts: 2,847
Reputation: Ezzaral is a name known to all Ezzaral is a name known to all Ezzaral is a name known to all Ezzaral is a name known to all Ezzaral is a name known to all Ezzaral is a name known to all 
Rep Power: 12
Solved Threads: 283
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Posting Maven

Re: First JLIST, used with GUI Inventory

  #56  
Jul 27th, 2007
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.
Reply With Quote  
Join Date: Jul 2007
Posts: 186
Reputation: no1zson is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
no1zson's Avatar
no1zson no1zson is offline Offline
Junior Poster

Re: First JLIST, used with GUI Inventory

  #57  
Jul 27th, 2007
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"
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.
Reply With Quote  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,467
Reputation: peter_budo is a jewel in the rough peter_budo is a jewel in the rough peter_budo is a jewel in the rough peter_budo is a jewel in the rough 
Rep Power: 11
Solved Threads: 296
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: First JLIST, used with GUI Inventory

  #58  
Jul 27th, 2007
JTextArea jta = new JTextArea();
jta.append("CD Description");
//Or you can do
jta.setText("CD Description");
Preferences up to you just look up API
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.
Reply With Quote  
Join Date: Jul 2007
Posts: 186
Reputation: no1zson is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
no1zson's Avatar
no1zson no1zson is offline Offline
Junior Poster

Re: First JLIST, used with GUI Inventory

  #59  
Jul 27th, 2007
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 never drew first, but I drew first blood.
I'm no ones son, unforgiven.
Reply With Quote  
Join Date: Jul 2007
Posts: 186
Reputation: no1zson is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
no1zson's Avatar
no1zson no1zson is offline Offline
Junior Poster

Re: First JLIST, used with GUI Inventory

  #60  
Jul 28th, 2007
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Java Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the Java Forum

All times are GMT -4. The time now is 1:29 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC