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 427,488 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 3,418 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: 1375 | Replies: 3
Reply
Join Date: Aug 2006
Posts: 3
Reputation: kssprabhu is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
kssprabhu kssprabhu is offline Offline
Newbie Poster

Change Image based on user Input

  #1  
Aug 19th, 2006
Dear friends.
Please give me the logic or code to display image based on number(in database) entered in the text box by the user.
thanks in advance
prabhu.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2004
Posts: 732
Reputation: Phaelax is on a distinguished road 
Rep Power: 6
Solved Threads: 31
Phaelax Phaelax is offline Offline
Master Poster

Re: Change Image based on user Input

  #2  
Aug 20th, 2006
JTextField imageField = new JTextField(4);
Image[] images = new Image[42]; //array of images

int index = Integer.parseInt(imageField.getText());

Image image = images(index);
Reply With Quote  
Join Date: Aug 2006
Posts: 3
Reputation: kssprabhu is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
kssprabhu kssprabhu is offline Offline
Newbie Poster

Re: Change Image based on user Input

  #3  
Aug 20th, 2006
please send me the code for implementing in JSP...
thanks in advance
prabhu.



Originally Posted by Phaelax
JTextField imageField = new JTextField(4);
Image[] images = new Image[42]; //array of images

int index = Integer.parseInt(imageField.getText());

Image image = images(index);
Reply With Quote  
Join Date: Jun 2004
Posts: 604
Reputation: freesoft_2000 is an unknown quantity at this point 
Rep Power: 6
Solved Threads: 6
freesoft_2000 freesoft_2000 is offline Offline
Practically a Master Poster

Re: Change Image based on user Input

  #4  
Aug 20th, 2006
Hi everyone,

Originally Posted by kssprabhu
please send me the code for implementing in JSP.


I don't mean to be bad, but the solution phaelax gave you can be implemented in most languages. His alogarithm is simple to use.

You can read up on arrays and this will most probably give you an idea of what he is doing but i doubt anyone will plonk down the answers for you

Richard west
Microsoft uses "One World, One Web, One Program" as a slogan.
Doesn’t that sound like "Ein Volk, Ein Reich, Ein Führer" to you, too?
— Eric S. Raymond

Tell me what type of software do you like and what would you pay for it

http://www.daniweb.com/techtalkforums/thread19660.html
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

Similar Threads
Other Threads in the Java Forum

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