viernes, 29 de julio de 2011

Cambio de Skin y Idiomas permanentes en Java


Hoy veremos como cambiar los temas o skin de nuestras aplicaciones java ytambiénel cambio de idioma de laaplicaciónque es muy utilizada en aplicaciones que van hacer distribuidas por todo el mundo,pero para hacer los cambios permanentes al iniciar o ejecutar de nuevo laaplicaciónyaparezcanlos cambios,esto se deben de guardar en un archivocomenzamos.

la claseconfiguración: es la encargada de realizar lacreacióny lectura del fichero(archivo)


private StringLeer_configuracion() throws FileNotFoundException, IOException{
String tmp_c="";
fr = new FileReader(archivo);
br = new BufferedReader(fr);
String linea = null;
while ((linea = br.readLine()) != null) {
tmp_c = tmp_c + linea;
}
fr.close();
return tmp_c;
}
private void token(String s){
StringTokenizer tokens = new StringTokenizer(s,"/");
while(tokens.hasMoreTokens()){
vector.addElement(tokens.nextToken());
}
}

public booleanGuardar_Configuracion(String t){
boolean ok = false;
try {
fichero = new FileWriter(archivo_de_configuracion);
pw = new PrintWriter(fichero);
pw.println(t);
ok = true;
fichero.close();
} catch (IOException ex) {
Logger.getLogger(configuracion.class.getName()).log(Level.SEVERE, null, ex);
}
return ok;
}

la clase lenguaje: se encarga de leer los archivos .properties muyutilizadospara configuraciones


public lenguaje(String idioma){
if(idioma.equals("Español")){//español
getProperties("español.properties");
}else if(idioma.equals("Inglish")){//Ingles
getProperties("ingles.properties");
System.out.println("ENTRO EN INGLES");
}else{//sino por default idioma español
getProperties("Español");
}
}

/* se leen las propiedades */
private void getProperties(String idioma) {
try {
this.load( getClass().getResourceAsStream(idioma) );
} catch (IOException ex) {
}
}

y la clase principal:en cargada de lainterfazde usuario y de ejecutar losmétodosy funciones par el cambio de las configuraciones


public void dame_idioma(String id)
{
len=new lenguaje(id);
eti_skin.setText(len.getProperty("skin"));
eti_lenguaje.setText(len.getProperty("idio"));
eti_nombre.setText(len.getProperty("nomb"));
eti_apellido.setText(len.getProperty("apell"));
boto_guardar.setText(len.getProperty("bt_guar"));
boto_acerca.setText(len.getProperty("bt_acer"));
joptio=len.getProperty("JOP");
}


confi.Guardar_Configuracion("/"+skin+"/"+combo_idioma.getSelectedItem().toString());

Si lo imaginas,lo programas

MESOTHELIOMA LAW FIRMDONATE CAR TO CHARITY CALIFORNIAHARDDRIVE DATA RECOVERY SERVICESDONATE A CAR IN MARYLAND DONATING A CAR IN MARYLAND,DONATE CARS ILLINOIS,CRIMINAL DEFENSE ATTORNEYS FLORIDA ,BEST CRIMINAL LAWYER IN ARIZONASTRUCTURED ANNUITY SETTLEMENT,ASBESTOS LAWYERS,NUNAVUT CULTURE,DAYTON FREIGHT LINES ,Bextra Bankruptcy Dental Plan Private JetMundial Football Mesothelioma law firm,mega life and health FIFA World Cup es un buen servicio en las distintas naciones trans union pero resulto que tenia cancer y fui a asbestos cancer y me dijeron en asbestos mesothelioma que tambien padecia de prostate cancer treatment y un daño tremendo a mi organismo fui a malignant pleural mesothelioma,asi que hice un prestamo en credit repair y otro en chase credit pero de pronto un anti spam software asi que decido un auto en rental car in costa rica me registre en Facebook en internet domain registration y tambien obtuve un domain registration,Selling annuity payments for cash,Selling annuity payments for cash,Sell my structured settlement,Sell structured settlement,Structured settlement,Structured settlement companies,Sell my annuity payments lump sum,Car accident lawyer Denver,Accident injury attorneys,Sell my annuity

No hay comentarios:

Publicar un comentario