Advertisement
MerAll

Bare basics of ListResourceBundle

Sep 2nd, 2014
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. import java.util.ListResourceBundle;
  2. import java.util.Locale;
  3. import java.util.ResourceBundle;
  4.  
  5.  
  6. public class LResBundle_en_US extends ListResourceBundle{
  7.  
  8.     private Object[][] contents ={{"WELCOME","Welcome, you."},{"LOCATION","Murica"}};
  9.     public LResBundle_en_US (){
  10.        
  11.     }
  12.  
  13.     @Override
  14.     protected Object[][] getContents() {
  15.         return contents;
  16.     }
  17.    
  18.  
  19.     public static void main(String[] args)
  20.     {
  21.        
  22.         ResourceBundle myBundle=ResourceBundle.getBundle("LResBundle_en_US",new Locale("en", "US"));
  23.         String usWelcome = myBundle.getString("WELCOME");
  24.         String usLocation=myBundle.getString("LOCATION");
  25.         System.out.println(usWelcome+","+usLocation);
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement