?? micropocha.java
字號:
// Insert post-init code here
}//GEN-BEGIN:MVDGetEnd65
return okCommand2;
}//GEN-END:MVDGetEnd65
/** This method returns instance for cancelCommand4 component and should be called instead of accessing cancelCommand4 field directly.//GEN-BEGIN:MVDGetBegin67
* @return Instance for cancelCommand4 component
*/
public Command get_cancelCommand4() {
if (cancelCommand4 == null) {//GEN-END:MVDGetBegin67
// Insert pre-init code here
cancelCommand4 = new Command("Cancel", Command.CANCEL, 1);//GEN-LINE:MVDGetInit67
// Insert post-init code here
}//GEN-BEGIN:MVDGetEnd67
return cancelCommand4;
}//GEN-END:MVDGetEnd67
/** This method returns instance for image3 component and should be called instead of accessing image3 field directly.//GEN-BEGIN:MVDGetBegin69
* @return Instance for image3 component
*/
public Image get_image3() {
if (image3 == null) {//GEN-END:MVDGetBegin69
// Insert pre-init code here
try {//GEN-BEGIN:MVDGetInit69
image3 = Image.createImage("<No Image>");
} catch (java.io.IOException exception) {
}//GEN-END:MVDGetInit69
// Insert post-init code here
}//GEN-BEGIN:MVDGetEnd69
return image3;
}//GEN-END:MVDGetEnd69
/** This method returns instance for imageItem3 component and should be called instead of accessing imageItem3 field directly.//GEN-BEGIN:MVDGetBegin70
* @return Instance for imageItem3 component
*/
public ImageItem get_imageItem3() {
if (imageItem3 == null) {//GEN-END:MVDGetBegin70
class Item /* para compatibilidad con midp1.0 */
{
static final public int LAYOUT_LEFT=1;
static final public int LAYOUT_NEWLINE_AFTER=0x200;
static final public int LAYOUT_NEWLINE_BEFORE=0x100;
static final public int LAYOUT_RIGHT=2;
};
imageItem3 = new ImageItem("Ganador", get_image1(), Item.LAYOUT_LEFT | Item.LAYOUT_NEWLINE_AFTER, "CAMPEON");//GEN-LINE:MVDGetInit70
}//GEN-BEGIN:MVDGetEnd70
return imageItem3;
}//GEN-END:MVDGetEnd70
/** This method returns instance for backCommand2 component and should be called instead of accessing backCommand2 field directly.//GEN-BEGIN:MVDGetBegin74
* @return Instance for backCommand2 component
*/
public Command get_backCommand2() {
if (backCommand2 == null) {//GEN-END:MVDGetBegin74
// Insert pre-init code here
backCommand2 = new Command("Back", Command.BACK, 1);//GEN-LINE:MVDGetInit74
// Insert post-init code here
}//GEN-BEGIN:MVDGetEnd74
return backCommand2;
}//GEN-END:MVDGetEnd74
/** This method returns instance for backCommand3 component and should be called instead of accessing backCommand3 field directly.//GEN-BEGIN:MVDGetBegin75
* @return Instance for backCommand3 component
*/
public Command get_backCommand3() {
if (backCommand3 == null) {//GEN-END:MVDGetBegin75
// Insert pre-init code here
backCommand3 = new Command("Back", Command.BACK, 1);//GEN-LINE:MVDGetInit75
// Insert post-init code here
}//GEN-BEGIN:MVDGetEnd75
return backCommand3;
}//GEN-END:MVDGetEnd75
/** This method returns instance for cancelCarga component and should be called instead of accessing cancelCarga field directly.//GEN-BEGIN:MVDGetBegin77
* @return Instance for cancelCarga component
*/
public Command get_cancelCarga() {
if (cancelCarga == null) {//GEN-END:MVDGetBegin77
// Insert pre-init code here
cancelCarga = new Command("Cancelar", Command.CANCEL, 1);//GEN-LINE:MVDGetInit77
// Insert post-init code here
}//GEN-BEGIN:MVDGetEnd77
return cancelCarga;
}//GEN-END:MVDGetEnd77
/** This method returns instance for reset component and should be called instead of accessing reset field directly.//GEN-BEGIN:MVDGetBegin79
* @return Instance for reset component
*/
public Command get_reset() {
if (reset == null) {//GEN-END:MVDGetBegin79
// Insert pre-init code here
reset = new Command("Menu de Inicio", Command.SCREEN, 1);//GEN-LINE:MVDGetInit79
// Insert post-init code here
}//GEN-BEGIN:MVDGetEnd79
return reset;
}//GEN-END:MVDGetEnd79
/** This method returns instance for screenCommand3 component and should be called instead of accessing screenCommand3 field directly.//GEN-BEGIN:MVDGetBegin81
* @return Instance for screenCommand3 component
*/
public Command get_screenCommand3() {
if (screenCommand3 == null) {//GEN-END:MVDGetBegin81
// Insert pre-init code here
screenCommand3 = new Command("Screen", Command.SCREEN, 1);//GEN-LINE:MVDGetInit81
// Insert post-init code here
}//GEN-BEGIN:MVDGetEnd81
return screenCommand3;
}//GEN-END:MVDGetEnd81
/** crea la pantalla de juego*/
private void creaPartida()
{
//crear partida
java.util.Vector nombres=new java.util.Vector();
nombres.addElement(this.textField1.getString());
if(this.textField2.getString().trim().length()>0)
nombres.addElement(this.textField2.getString());
if(this.textField3.getString().trim().length()>0)
nombres.addElement(this.textField3.getString());
if(this.textField4.getString().trim().length()>0)
nombres.addElement(this.textField4.getString());
if(this.textField5.getString().trim().length()>0)
nombres.addElement(this.textField5.getString());
int reglas;
switch(this.tipoJuego.getSelectedIndex())
{
case 0:
reglas=Partida.POCHA;
break;
case 1:
reglas=Partida.POCHEADA;
break;
case 2:
default:
reglas=Partida.OTRO;
break;
}
String[] nombresA=new String[nombres.size()];
nombres.copyInto(nombresA);
partida=new Partida(nombresA, reglas);
//mostrar tablero
Display display=Display.getDisplay(this);
Command exitCommand = new Command("Salir",Command.SCREEN,2);
tablero=new Tablero(partida, this);
tablero.addCommand(get_pantallaGrafico());
tablero.addCommand(get_SalirDeTablero());
tablero.addCommand(get_GuardarComoCommand());
}
public void startApp()
{
initialize();
}
public void pauseApp()
{
try
{
this.almacen.guardar();
}
catch (IOException ex)
{
ex.printStackTrace();
}
}
public void destroyApp(boolean unconditional)
{
try
{
this.almacen.guardar();
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
/**
* Serializa los datos de la partida en formato xml
* @param destino buffer donde escribe el resultado.
*/
public void toXml(StringBuffer destino)
{
destino.append("<?xml version='1.0' encoding='UTF-8'?>");
destino.append('\n');
destino.append("<app version='3.0'>");
destino.append('\n');
this.partida.toXml(destino);
destino.append('\n');
this.tablero.toXml(destino);
destino.append('\n');
destino.append("</app>");
destino.append('\n');
}
/** metodo no funcioal para probar c?digo
*/
private void sandbox()
{
}
/**
* Construye un juego de Micropocha partiendo de una
* cadena xml que se gener? con el m?todo {@link #toXml}
* @param xml cadena xml generada en {@link #toXml}
* @throws org.xmlpull.v1.XmlPullParserException xml no parseable
* @throws java.io.IOException error rms
*/
public void fromXml(String xml) throws XmlPullParserException, IOException
{
XmlPullParserFactory fabrica=XmlPullParserFactory.newInstance();
XmlPullParser analiazador=fabrica.newPullParser();
fromXml(xml,analiazador);
}
/**
* Construye un juego de Micropocha partiendo de una
* cadena xml que se gener? con el m?todo {@link #toXml}
* @param xml cadena xml{@link #toXml}
* @param analizador analizador xml de tipo pull
* @throws org.xmlpull.v1.XmlPullParserException error de parseado
* @throws java.io.IOException error rms
*/
public void fromXml(String xml,XmlPullParser analizador) throws XmlPullParserException, IOException
{
java.io.ByteArrayInputStream bai=new java.io.ByteArrayInputStream(xml.getBytes());
java.io.InputStreamReader isr=new java.io.InputStreamReader(bai);
analizador.setInput(isr);
while(true)
{
int evt=analizador.next();
if(evt==XmlPullParser.START_TAG)
{
if(analizador.getName().equals(Partida.xmlTag))
{
this.partida=null;
this.partida=new Partida(isr,analizador);
}
if(analizador.getName().equals(Tablero.xmlTag))
{
this.tablero=null;
Command exitCommand = new Command("Salir",Command.SCREEN,2);
this.tablero=new Tablero(this.partida,this,isr,analizador);
tablero.addCommand(get_pantallaGrafico());
tablero.addCommand(get_SalirDeTablero());
tablero.addCommand(get_GuardarComoCommand());
}
}
else if(evt==XmlPullParser.END_TAG)
{
return;
}
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -