Blackberry JAVA DEVELOPMENT ENVIRONMENT - - CRYPTOGRAPHIC SMART CARD DRIVER - DEVELOPMENT GUIDE Guía para resolver problemas Pagina 241

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 286
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 240
241
16: Localizing applications
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.system.*;
import net.rim.device.api.i18n.*;
import com.rim.samples.docs.resource.*;
/* This sample demonstrates how to store text strings in separate resource
files for specific locales rather than providing text strings directly
in the code. In your source code, you retrieve the string from the resource
to display the appropriate text for the user locale. */
public class CountryInfo extends UiApplication {
public static void main(String[] args) {
CountryInfo theApp = new CountryInfo();
theApp.enterEventDispatcher();
}
public CountryInfo() {
pushScreen(new HelloWorldScreen());
}
}
final class HelloWorldScreen extends MainScreen implements CountryInfoResource {
private InfoScreen _infoScreen;
private ObjectChoiceField choiceField;
private int select;
private static ResourceBundle _resources = ResourceBundle.getBundle(
CountryInfoResource.BUNDLE_ID, CountryInfoResource.BUNDLE_NAME);
public HelloWorldScreen() {
super();
LabelField title = new LabelField(_resources.getString(APPLICATION_TITLE),
LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
setTitle(title);
add(new RichTextField(_resources.getString(FIELD_TITLE)));
String choices[] = _resources.getStringArray(FIELD_COUNTRIES);
choiceField = new ObjectChoiceField(
_resources.getString(FIELD_CHOICE), choices);
add(choiceField);
}
public boolean onClose() {
Dialog.alert(_resources.getString(CLOSE));
System.exit(0);
return true;
}
private MenuItem _viewItem = new MenuItem(_resources, MENUITEM_VIEW, 110, 10) {
public void run() {
select = choiceField.getSelectedIndex();
_infoScreen = new InfoScreen();
UiApplication.getUiApplication().pushScreen(_infoScreen);
}
};
private MenuItem _closeItem = new MenuItem(_resources, MENUITEM_CLOSE,
200000, 10) {
public void run() {
Vista de pagina 240
1 2 ... 236 237 238 239 240 241 242 243 244 245 246 ... 285 286

Comentarios a estos manuales

Sin comentarios