RSS Forums RSS
Please support our Java advertiser: Lunarpages Java Web Hosting

First JLIST, used with GUI Inventory

Join Date: May 2007
Location: USA
Posts: 3,176
Reputation: Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold 
Rep Power: 15
Solved Threads: 314
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Posting Sensei

Re: First JLIST, used with GUI Inventory

  #4  
Jul 25th, 2007
		//Instantiate object for JList
		for (currCD = 0; currCD <99; currCD++)
		
		// add values to textFields
		cdNameField.setText(currCD.getcdName());
You cannot call a method on an int variable, which is what you have tried to do here. You really don't even need this loop to try to set up all cds in the list in the first place. You add one when the user clicks 'add'. If you keep currCD updated to point to the current index of the CD in the list, you can access the object with the expression listModel.get(currCD);. You will need to cast it to CdwArtist to use it's methods though:
CdwArtist currentCD = (CdwArtist) listModel.get( currCD );
since the get() method returns the generic type Object.
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 6:02 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC