Main Logo
Articles   Members Online:
-Article/Tip Search
-News Group Search over 800,000 Borland news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
JBuilder: How to construct a Recourse Bundle and list Keys and associated pairs Part 2
Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to construct a Recourse Bundle and list Keys and associated pairs Part 2 Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
Recsource Bundles Currency convertors first steps 27-Jun-05
Category
Java-API
Language
JBuilder All Versions
Views
233
User Rating
5
# Votes
1
Replies
0
Publisher:
Harrington, Mark
Reference URL:
			1   
2   import java.io.*;
3   import java.util.*;
4   
5   
6   /* Demonstration of how Resource Bundle works By MD Harrington 19 June 2005 */
7   
8   /* A Simple console demonstration to show how we can use a resource Bundle to list
9    Known Key pairs  */ 
10  
11  /* 1: What would we use this for lanaguage converters 
12     2: Currency Converters 
13     3: Populating Option Select objects in an Html Form
14     4: Military applications for Coding of words Every time you whish to reencode a 
15  word  you might use
16        a Rescource Bundle to do this 
17     5: Scientific uses 
18  
19      Thats Five i can think of straight away 
20  
21  */ 
22     
23  
24  
25  
26  public class DemoResourceBundle 
27  {
28  	public static void main(String[] args) 
29  	{
30  		// this where we create the resource bundle object
31  
32       ResourceBundle res = ResourceBundle.getBundle("CurrencyConverstions");
33  
34          // if you know the key you can return the associated string ;
35  		System.out.println(" If you know the key then get  associated string with key  ");
36  		System.out.println(" Here is the String association with known Key = AFA " + 
37  res.getString("AFA"));
38  	
39  	// Now of course your starting to think further than this and  if we don't know 
40  the key lets list it
41  
42      // what can we do with this you might ask   
43  
44  	// How about populating a Option select Box on an html page sounds quite good 
45  doesn't it !!
46  
47  	// Now lets see what we have in the bundle 
48  
49  	
50  	
51  	Enumeration enum = res.getKeys(); // get an enumeration object of the bundle keys
52  	
53  		while (enum.hasMoreElements())
54  		{
55  		String myKey = (String)enum.nextElement(); // cast the Object to a String type 
56  Object 
57  		// Now lets get each association with the key and list the key + the association 
58  		System.out.println("Key = " +  myKey + " Country = " + res.getString(myKey) );
59  	 
60  		}
61      
62      
63  
64  
65  	}// end static main 	
66  	
67  } 


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC
Advertisement


Share this page
Advertisement
Copyright © 2017 by No Limit Solutions LLC