📄 listsettings.java
字号:
/**
* Class : short description
* @author Michele 'Miccar' Cardinale miccar@gmail.com
* @author Natale Vinto ebballon@interfree.it
* @version 1.0
*/
/*
* goText : text messaging over GPRS
* Copyright (C) 2006 Natale Vinto <ebballon@interfree.it>
* OpenJLab Group www.openjlab.org
* Copyright (C) 2006 Michele Cardinale 'Miccar' <miccar@gmail.com>
* www.miccar.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
import javax.microedition.lcdui.*;
public class ListSettings extends List implements CommandListener {
protected goText gotext;
protected Lang l;
private Command command_back;
public ListSettings(goText gotext) {
super("",List.IMPLICIT);
this.gotext=gotext;
l=new Lang(gotext.lang);
this.setTitle(l.MC_SETTINGS);
this.start();
}
private void start(){
String[] menu_string={l.LMS_TITLE,l.LS_ADDRESSBOOK,l.LS_SETTINGS};
Image[] menu_image=null;
try {
Image ico1 = Image.createImage("/img/servizi.png");
Image ico2 = Image.createImage("/img/rubrica.png");
Image ico3 = Image.createImage("/img/opzioni.png");
menu_image= new Image[] {ico1,ico2,ico3};
} catch (java.io.IOException err) {}
for(int i=0;i<menu_string.length;i++){
this.append(menu_string[i], menu_image[i]);
}
command_back=new Command(l.COMMAND_BACK,Command.BACK,1);
this.addCommand(command_back);
this.setCommandListener(this);
this.show();
}
public void show(){
gotext.display.setCurrent(this);
}
public void commandAction(Command c, Displayable d){
if (c==List.SELECT_COMMAND){
switch (this.getSelectedIndex()) {
case 0:
new ListModServices(gotext);
break;
case 1:
new ListModContacts(gotext);
break;
case 2:
new FormOptions();
break;
}
}else if (c==command_back){
gotext.mc=new MainCanvas(gotext);
}
}
public class FormOptions extends Form implements CommandListener{
private Command command_app,command_back;
private ChoiceGroup choicegroup_lang;
private ChoiceGroup choicegroup_connectionmethod;
private ChoiceGroup choicegroup_charscounter;
public FormOptions() {
super("Opzioni");
this.start();
}
private void start(){
String[] array1_string={"Italiano","English","Espanol"};
String[] array2_string={l.LS_ACTIVE};
String[] array3_string={"Post","Get"};
Image[] array1_img={null,null,null};
try{
array1_img[0]=Image.createImage("/img/ita.png");
array1_img[1]=Image.createImage("/img/eng.png");
array1_img[2]=Image.createImage("/img/esp.png");
}catch(Exception e){}
choicegroup_lang=new ChoiceGroup(l.LS_LANGUAGE,Choice.EXCLUSIVE, array1_string,array1_img);
choicegroup_lang.setSelectedIndex(gotext.lang, true);
choicegroup_charscounter=new ChoiceGroup(l.LS_CHARSCOUNTER,Choice.MULTIPLE, array2_string,null);
choicegroup_charscounter.setSelectedIndex(0, gotext.options.getCharsCounter()>0?true:false);
choicegroup_connectionmethod=new ChoiceGroup(l.LS_CMETHOD,Choice.EXCLUSIVE, array3_string,null);
choicegroup_connectionmethod.setSelectedIndex(gotext.options.getConnectionMethod(), true);
this.append(choicegroup_lang);
this.append(choicegroup_charscounter);
//this.append(new StringItem("Avanzate:\n", null));
this.append(choicegroup_connectionmethod);
command_app=new Command(l.COMMAND_APP,Command.SCREEN,1);
command_back=new Command(l.COMMAND_BACK,Command.BACK,2);
this.addCommand(command_app);
this.addCommand(command_back);
this.setCommandListener(this);
this.show();
}
public void show(){
gotext.display.setCurrent(this);
}
public void commandAction(Command c, Displayable d){
if (c==command_app){
gotext.options.setCharsCounter(choicegroup_charscounter.isSelected(0)?1:0);
gotext.options.setConnectionMethod(choicegroup_connectionmethod.getSelectedIndex());
if(gotext.options.setLang(choicegroup_lang.getSelectedIndex())==1){
gotext.lang=choicegroup_lang.getSelectedIndex();
}
new ListSettings(gotext);
} else if (c==command_back){
new ListSettings(gotext);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -