Source Code : Load resources based upon client environment at startup

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

Load resources based upon client environment at startup

        

import javax.swing.JCheckBox;

public class Main {
  public static void main(String[] argv) {
    System.out.println((JCheckBox) MyResources.rb.getObject("aCheckbox"));
    MyResources.rb.getString("aButton");
    MyResources.rb.getObject("vButton");
  }
}

[MyResources.java (default resources)]

import java.text.DecimalFormat;
import java.util.ListResourceBundle;
import java.util.ResourceBundle;

import javax.swing.JButton;
import javax.swing.JCheckBox;

public class MyResources extends ListResourceBundle {
  public static ResourceBundle rb = ResourceBundle.getBundle("MyResources");

  public Object [][] getContents() {
    return contents;
  }

  static final Object[][] contents =  {
       { "aCheckbox", new JCheckBox("Yes") } ,
       { "aButton"  , "Today {0,date,long}"},
       { "vButton"  , new JButton("Validate number")},
  };
}

[MyResources_en.java (english language resources)]

import java.util.ListResourceBundle;

public class MyResources_en extends ListResourceBundle {
  public Object [][] getContents() {
    return contents;
  }
  static final Object[][] contents =  {
    { "aLabel"     , "a Label (en)" }
  };
}

[MyResources_fr.java (french language resources)]

import java.util.ListResourceBundle;

import javax.swing.JButton;
import javax.swing.JCheckBox;

public class MyResources_fr extends ListResourceBundle {
  public Object [][] getContents() {
    return contents;
  }

  static final Object[][] contents =  {
    { "aLabel"     , "une tiquette (fr)" } ,
    { "aCheckbox", new JCheckBox("Oui (fr)")} ,
    { "vButton" , new JButton("Validation du nombre")},
    { "numOK" , "Valide!"},
    { "numERR", "Invalide"}
  };
}

[MyResources_fr_CA.java (french language (for Canada) resources)]

import java.util.ListResourceBundle;

public class MyResources_fr_CA extends ListResourceBundle {
  public Object [][] getContents() {
    return contents;
  }

  static final Object[][] contents =  {
    { "aLabel"     , "une tiquette (fr CA)" } ,
  };
}

   
    
    
    
    
    
    
    
  

Thank with us