Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 12th, 2005, 10:12 PM
nabil1983 nabil1983 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 36 nabil1983 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 7 m 44 sec
Reputation Power: 4
Angry Re-Worked Version Still problem !!!

Hello.
As i couldnt work out my problem with my other version, i re-wrote it in a totally different form,
now my program does display all the entries i make,, but the problem now is
how do stop the dialog box from keep coming up.

For example: i input 2 entries and thats all i want to input; i want those two entries to print out and thats it.

in this case i keep getting the input dialog box untill all my array elements are used up....
neone know how i can fix this problem???

All help apreciated.




import javax.swing.*;

public class CdStorage2
{
public static void main (String[] args)

{

CdRecord[] array = new CdRecord[5];

int i;


for(i=0; i<array.length; i++)

{
array[i] = new CdRecord();

}


for (i=0; i<array.length;i++)
{
array[i].printCdRecord();
}

} //end main
}//end class



class CdRecord
{
private String artist_name;
private String album_name;
private int no_of_tracks;


public CdRecord ()
{
String menu_choice;
int menu;

menu_choice =
JOptionPane.showInputDialog("Enter:\n 1: New CD entry\n 2: Print\n 3: Quit");
menu = Integer.parseInt(menu_choice);

artist_name =
JOptionPane.showInputDialog("Enter Artist Name");

album_name =
JOptionPane.showInputDialog("Enter Album Name");

no_of_tracks =
Integer.parseInt(JOptionPane.showInputDialog("Enter Number Of Tracks"));

}
public void printCdRecord ()
{
System.out.println("Artist Name: " +artist_name + "\nAlbum Name: " +album_name+"\nNo. Of Tracks: " +no_of_tracks+"\n");

}
}//end class cdstorage

Reply With Quote
  #2  
Old April 13th, 2005, 08:37 AM
nabil1983 nabil1983 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 36 nabil1983 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 7 m 44 sec
Reputation Power: 4
sorry no need to bother with this post as i
got it working now.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > Re-Worked Version Still problem !!!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT