Sunday, December 6, 2015

J2ME : complete J2ME code for the converter application


j2me converter
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

/**
 * @author RajPalace
 */
public class  Converter extends MIDlet implements CommandListener, ItemCommandListener {

    float flag = 0;
    private boolean midletPaused = false;
    ////GEN-BEGIN:|fields|0|
    private Command exitCommand;
    private Command ConverterImage;
    private Command exitCommand1;
    private Command backCommand;
    private Command itemCommand;
    private Command okCommand;
    private Command BitByte;
    private Command Weight;
    private Command Time;
    private Command Day;
    private Command cancelCommand1;
    private Command cancelCommand;
    private Command itemCommand1;
    private Command okCommand1;
    private Command screenCommand;
    private Command Distance;
    private Form WelCome;
    private StringItem stringItem;
    private ImageItem imageItem;
    private Form Distances;
    private TextField cm_Tf;
    private TextField km_Tf;
    private TextField mm_Tf;
    private TextField mt_Tf;
    private Form BitBytes;
    private TextField mbs_Tf;
    private TextField kbs_Tf;
    private TextField bytes_Tf;
    private TextField bits_Tf;
    private TextField gbs_Tf;
    private TextField tbs_Tf;
    private Form Weights;
    private TextField gm_Tf;
    private TextField mg_Tf;
    private TextField tn_Tf;
    private TextField kg_Tf;
    private Form Times;
    private TextField minutes_Tf;
    private TextField mili_Tf;
    private TextField seconds_Tf;
    private TextField hours_Tf;
    private Form Days;
    private TextField days_Tf;
    private TextField weeks_Tf;
    private TextField years_Tf;
    private TextField months_Tf;
    private Ticker ticker;
    private Image Converter;
    private Ticker o2Sol;
    //
//GEN-END:|fields|0|    public Display disply = null;

    /**
     * The  Converter constructor.
     */
    public  Converter() {
    }

    ////GEN-BEGIN:|methods|0|
    //
//GEN-END:|methods|0|    ////GEN-BEGIN:|0-initialize|0|0-preInitialize
    /**
     * Initilizes the application.
     * It is called only once when the MIDlet is started. The method is called before the startMIDlet method.
     */
    private void initialize() {//GEN-END:|0-initialize|0|0-preInitialize
        // write pre-initialize user code here
//GEN-LINE:|0-initialize|1|0-postInitialize
        // write post-initialize user code here
    }//GEN-BEGIN:|0-initialize|2|
    //
//GEN-END:|0-initialize|2|
    ////GEN-BEGIN:|3-startMIDlet|0|3-preAction
    /**
     * Performs an action assigned to the Mobile Device - MIDlet Started point.
     */
    public void startMIDlet() {//GEN-END:|3-startMIDlet|0|3-preAction
        // write pre-action user code here
        switchDisplayable(null, getWelCome());//GEN-LINE:|3-startMIDlet|1|3-postAction
        // write post-action user code here
    }//GEN-BEGIN:|3-startMIDlet|2|
    //
//GEN-END:|3-startMIDlet|2|
    ////GEN-BEGIN:|4-resumeMIDlet|0|4-preAction
    /**
     * Performs an action assigned to the Mobile Device - MIDlet Resumed point.
     */
    public void resumeMIDlet() {//GEN-END:|4-resumeMIDlet|0|4-preAction
        // write pre-action user code here
//GEN-LINE:|4-resumeMIDlet|1|4-postAction
        // write post-action user code here
    }//GEN-BEGIN:|4-resumeMIDlet|2|
    //
//GEN-END:|4-resumeMIDlet|2|
    ////GEN-BEGIN:|5-switchDisplayable|0|5-preSwitch
    /**
     * Switches a current displayable in a display. The display instance is taken from getDisplay method. This method is used by all actions in the design for switching displayable.
     * @param alert the Alert which is temporarily set to the display; if null, then nextDisplayable is set immediately
     * @param nextDisplayable the Displayable to be set
     */
    public void switchDisplayable(Alert alert, Displayable nextDisplayable) {//GEN-END:|5-switchDisplayable|0|5-preSwitch
        // write pre-switch user code here
        Display display = getDisplay();//GEN-BEGIN:|5-switchDisplayable|1|5-postSwitch
        if (alert == null) {
            display.setCurrent(nextDisplayable);
        } else {
            display.setCurrent(alert, nextDisplayable);
        }//GEN-END:|5-switchDisplayable|1|5-postSwitch
        // write post-switch user code here
    }//GEN-BEGIN:|5-switchDisplayable|2|
    //
//GEN-END:|5-switchDisplayable|2|
    ////GEN-BEGIN:|7-commandAction|0|7-preCommandAction
    /**
     * Called by a system to indicated that a command has been invoked on a particular displayable.
     * @param command the Command that was invoked
     * @param displayable the Displayable where the command was invoked
     */
    public void commandAction(Command command, Displayable displayable) {//GEN-END:|7-commandAction|0|7-preCommandAction
        // write pre-action user code here
        try {
            if (displayable == BitBytes) {//GEN-BEGIN:|7-commandAction|1|52-preAction
                if (command == backCommand) {//GEN-END:|7-commandAction|1|52-preAction
                    // write pre-action user code here
                    switchDisplayable(null, getWelCome());//GEN-LINE:|7-commandAction|2|52-postAction
                    // write post-action user code here
                } else if (command == cancelCommand) {//GEN-LINE:|7-commandAction|3|131-preAction
                    // write pre-action user code here
                    bits_Tf.setString("");
                    bytes_Tf.setString("");
                    kbs_Tf.setString("");
                    mbs_Tf.setString("");
                    tbs_Tf.setString("");
                    gbs_Tf.setString("");
//GEN-LINE:|7-commandAction|4|131-postAction
                    // write post-action user code here
                } else if (command == okCommand) {//GEN-LINE:|7-commandAction|5|130-preAction
                    // write pre-action user code here
                    try {
                        float ibits = 0, ibytes = 0, ikbs = 0, imbs = 0, igbs = 0, itbs = 0;

                        String sbits = bits_Tf.getString();
                        String sbytes = bytes_Tf.getString();
                        String skbs = kbs_Tf.getString();
                        String smbs = mbs_Tf.getString();
                        String sgbs = gbs_Tf.getString();
                        String stbs = tbs_Tf.getString();

                        if (sbits.length() > 0) {
                            ibits = Float.parseFloat(sbits);
                            ibytes = ibits / 8;
                            ikbs = ibytes / 1024;
                            imbs = ikbs / 1024;
                            igbs = imbs / 1024;
                            itbs = igbs / 1024;
                        } else if (sbytes.length() > 0) {
                            ibytes = Float.parseFloat(sbytes);
                            ibits = ibytes * 8;
                            ikbs = ibytes / 1024;
                            imbs = ikbs / 1024;
                            igbs = imbs / 1024;
                            itbs = igbs / 1024;
                        } else if (skbs.length() > 0) {
                            ikbs = Float.parseFloat(skbs);
                            ibytes = ikbs * 1024;
                            ibits = ibytes * 8;
                            imbs = ikbs / 1024;
                            igbs = imbs / 1024;
                            itbs = igbs / 1024;
                        } else if (smbs.length() > 0) {
                            imbs = Float.parseFloat(smbs);
                            ikbs = imbs * 1024;
                            ibytes = ikbs * 1024;
                            ibits = ibytes * 8;
                            igbs = imbs / 1024;
                            itbs = igbs / 1024;
                        } else if (sgbs.length() > 0) {
                            igbs = Float.parseFloat(sgbs);
                            itbs = igbs / 1024;
                            imbs = igbs * 1024;
                            ikbs = imbs * 1024;
                            ibytes = ikbs * 1024;
                            ibits = ibytes * 8;
                        } else if (stbs.length() > 0) {
                            itbs = Float.parseFloat(stbs);
                            imbs = itbs * 1024;
                            igbs = imbs / 1024;
                            ikbs = imbs * 1024;
                            ibytes = ikbs * 1024;
                            ibits = ibytes * 8;
                        }

                        bits_Tf.setString("" + ibits);
                        bytes_Tf.setString("" + ibytes);
                        kbs_Tf.setString("" + ikbs);
                        mbs_Tf.setString("" + imbs);
                        gbs_Tf.setString("" + igbs);
                        tbs_Tf.setString("" + itbs);
                    } catch (Exception e) {
                        Alert error = new Alert("Ups !!", "Invalid Value !!", null, AlertType.ERROR);
                        switchDisplayable(error, displayable);
                    }
//GEN-LINE:|7-commandAction|6|130-postAction
                    // write post-action user code here
                }//GEN-BEGIN:|7-commandAction|7|118-preAction
            } else if (displayable == Days) {
                if (command == backCommand) {//GEN-END:|7-commandAction|7|118-preAction
                    // write pre-action user code here
                    switchDisplayable(null, getWelCome());//GEN-LINE:|7-commandAction|8|118-postAction
                    // write post-action user code here
                } else if (command == cancelCommand) {//GEN-LINE:|7-commandAction|9|127-preAction

                    weeks_Tf.setString("");
                    years_Tf.setString("");
                    months_Tf.setString("");
                    days_Tf.setString("");
                    // write pre-action user code here
//GEN-LINE:|7-commandAction|10|127-postAction
                    // write post-action user code here
                } else if (command == okCommand) {//GEN-LINE:|7-commandAction|11|124-preAction
                    // write pre-action user

                    try {
                        float idays = 0, iweeks = 0, imonths = 0, iyears = 0;
                        String sdays = days_Tf.getString();
                        String sweeks = weeks_Tf.getString();
                        String smonths = months_Tf.getString();
                        String syears = years_Tf.getString();

                        if (sdays.length() > 0) {
                            idays = Float.parseFloat(sdays);
                            iweeks = idays / 7;
                            imonths = idays / 30;
                            iyears = idays / 365;
                            weeks_Tf.setString("" + iweeks);
                            months_Tf.setString("" + imonths);
                            years_Tf.setString("" + iyears);
                        } else if (sweeks.length() > 0) {
                            iweeks = Float.parseFloat(sweeks);
                            idays = iweeks * 7;
                            imonths = idays / 30;
                            iyears = idays / 365;
                            days_Tf.setString("" + idays);
                            months_Tf.setString("" + imonths);
                            years_Tf.setString("" + iyears);
                        } else if (smonths.length() > 0) {
                            imonths = Float.parseFloat(smonths);
                            idays = imonths * 30;
                            iweeks = idays / 7;
                            imonths = idays / 30;
                            iyears = idays / 365;
                            days_Tf.setString("" + idays);
                            weeks_Tf.setString("" + iweeks);
                            years_Tf.setString("" + iyears);
                        } else if (syears.length() > 0) {
                            iyears = Float.parseFloat(syears);
                            idays = iyears * 365;
                            iweeks = idays / 7;
                            imonths = idays / 30;
                            iyears = idays / 365;
                            days_Tf.setString("" + idays);
                            weeks_Tf.setString("" + iweeks);
                            months_Tf.setString("" + imonths);

                        }
                    } catch (Exception e) {
                        Alert error = new Alert("Ups !!", "Invalid Value !!", null, AlertType.ERROR);
                        switchDisplayable(error, displayable);
                    }
//GEN-LINE:|7-commandAction|12|124-postAction
                    // write post-action user code here
                }//GEN-BEGIN:|7-commandAction|13|37-preAction
            } else if (displayable == Distances) {
                if (command == backCommand) {//GEN-END:|7-commandAction|13|37-preAction
                    // write pre-action user code here
                    switchDisplayable(null, getWelCome());//GEN-LINE:|7-commandAction|14|37-postAction
                    // write post-action user code here
                } else if (command == cancelCommand) {//GEN-LINE:|7-commandAction|15|123-preAction
                    // write pr
                    mm_Tf.setString("");
                    cm_Tf.setString("");
                    mt_Tf.setString("");
                    km_Tf.setString("");
//GEN-LINE:|7-commandAction|16|123-postAction
                    // write post-action user code here
                } else if (command == okCommand) {//GEN-LINE:|7-commandAction|17|121-preAction
                    // write pre-action user code here

                    try {
                        String smm = (mm_Tf.getString());
                        String scm = (cm_Tf.getString());
                        String smt = (mt_Tf.getString());
                        String skm = (km_Tf.getString());
                        float imm = 0, icm = 0, imt = 0, ikm = 0;

                        if (smm.length() > 0) {
                            imm = Float.parseFloat("" + smm);
                            icm = (imm * 100) / 1000;
                            cm_Tf.setString("" + icm);
                            mt_Tf.setString("" + (imm / 1000));
                            imt = Float.parseFloat(mt_Tf.getString());
                            km_Tf.setString("" + (imt / 1000));
                        } else if (scm.length() > 0) {
                            icm = Float.parseFloat("" + scm);
                            imm = (icm * 1000) / 100;
                            mm_Tf.setString("" + imm);
                            mt_Tf.setString("" + (imm / 1000));
                            imt = Float.parseFloat(mt_Tf.getString());
                            km_Tf.setString("" + (imt / 1000));
                        } else if (smt.length() > 0) {

                            imt = Float.parseFloat(mt_Tf.getString());
                            km_Tf.setString("" + (imt / 1000));
                            imm = imt * 1000;
                            mm_Tf.setString("" + (imm));
                            icm = (imm * 100) / 1000;
                            cm_Tf.setString("" + icm);

                        } else if (skm.length() > 0) {

                            ikm = Float.parseFloat(km_Tf.getString());
                            mt_Tf.setString("" + (ikm * 1000));
                            imt = Float.parseFloat(mt_Tf.getString());
                            imm = imt * 1000;
                            mm_Tf.setString("" + (imm));
                            icm = (imm * 100) / 1000;
                            cm_Tf.setString("" + icm);

                        }
                    } catch (Exception e) {
                        Alert error = new Alert("Ups !!", "Invalid Value !!", null, AlertType.ERROR);
                        switchDisplayable(error, displayable);
                    }


//GEN-LINE:|7-commandAction|18|121-postAction
                    // write post-action user code here
                }//GEN-BEGIN:|7-commandAction|19|100-preAction
            } else if (displayable == Times) {
                if (command == backCommand) {//GEN-END:|7-commandAction|19|100-preAction
                    // write pre-action user code here
                    switchDisplayable(null, getWelCome());//GEN-LINE:|7-commandAction|20|100-postAction
                    // write post-action user code here
                } else if (command == cancelCommand) {//GEN-LINE:|7-commandAction|21|129-preAction
                    // write pre-action user code here
                    mili_Tf.setString("");
                    seconds_Tf.setString("");
                    minutes_Tf.setString("");
                    hours_Tf.setString("");
//GEN-LINE:|7-commandAction|22|129-postAction
                    // write post-action user code here
                } else if (command == okCommand) {//GEN-LINE:|7-commandAction|23|128-preAction
                    // write pre-action user code here
                    try {
                        float isecs = 0, imins = 0, imilis = 0, ihours = 0;
                        String ssecs = seconds_Tf.getString();
                        String smilis = mili_Tf.getString();
                        String smins = minutes_Tf.getString();
                        String shours = hours_Tf.getString();

                        if (smilis.length() > 0) {
                            imilis = Float.parseFloat(smilis);
                            isecs = imilis / 1000;
                            imins = isecs / 60;
                            ihours = imins / 60;


                        } else if (ssecs.length() > 0) {
                            isecs = Float.parseFloat(ssecs);
                            imilis = isecs * 1000;
                            imins = isecs / 60;
                            ihours = imins / 60;

                        } else if (smins.length() > 0) {
                            imins = Float.parseFloat(smins);
                            isecs = imins * 60;
                            imilis = isecs * 1000;
                            ihours = imins / 60;


                        } else if (shours.length() > 0) {
                            ihours = Float.parseFloat(shours);
                            imins = ihours * 60;
                            isecs = imins * 60;
                            imilis = isecs * 1000;



                        }

                        mili_Tf.setString("" + imilis);
                        seconds_Tf.setString("" + isecs);
                        minutes_Tf.setString("" + imins);
                        hours_Tf.setString("" + ihours);
                    } catch (Exception e) {
                        Alert error = new Alert("Ups !!", "Invalid Value !!", null, AlertType.ERROR);
                        switchDisplayable(error, displayable);
                    }
//GEN-LINE:|7-commandAction|24|128-postAction
                    // write post-action user code here
                }//GEN-BEGIN:|7-commandAction|25|76-preAction
            } else if (displayable == Weights) {
                if (command == backCommand) {//GEN-END:|7-commandAction|25|76-preAction
                    // write pre-action user code here
                    switchDisplayable(null, getWelCome());//GEN-LINE:|7-commandAction|26|76-postAction
                    // write post-action user code here
                } else if (command == cancelCommand) {//GEN-LINE:|7-commandAction|27|133-preAction
                    // write pre-action user code here
                    mg_Tf.setString("");
                    gm_Tf.setString("");
                    kg_Tf.setString("");
                    tn_Tf.setString("");
//GEN-LINE:|7-commandAction|28|133-postAction
                    // write post-action user code here
                } else if (command == okCommand) {//GEN-LINE:|7-commandAction|29|132-preAction
                    // write pre-action user code here
                    try {
                        float img = 0, igm = 0, ikg = 0, itn = 0;
                        String smg = mg_Tf.getString();
                        String sgm = gm_Tf.getString();
                        String skg = kg_Tf.getString();
                        String stn = tn_Tf.getString();

                        if (smg.length() > 0) {
                            img = Float.parseFloat(smg);
                            igm = img / 1000;
                            ikg = igm / 1000;
                            itn = ikg / 1000;

                        } else if (sgm.length() > 0) {
                            igm = Float.parseFloat(sgm);
                            img = igm * 1000;
                            ikg = igm / 1000;
                            itn = ikg / 1000;


                        } else if (skg.length() > 0) {
                            ikg = Float.parseFloat(skg);
                            igm = ikg * 1000;
                            img = igm * 1000;
                            itn = ikg / 1000;

                        } else if (stn.length() > 0) {
                            itn = Float.parseFloat(stn);
                            ikg = itn * 1000;
                            igm = ikg * 1000;
                            img = img * 1000;

                        }
                        tn_Tf.setString("" + itn);
                        mg_Tf.setString("" + img);
                        gm_Tf.setString("" + igm);
                        kg_Tf.setString("" + ikg);
                    } catch (Exception e) {
                        Alert error = new Alert("Ups !!", "Invalid Value !!", null, AlertType.ERROR);
                        switchDisplayable(error, displayable);
                    }
//GEN-LINE:|7-commandAction|30|132-postAction
                    // write post-action user code here
                }//GEN-BEGIN:|7-commandAction|31|47-preAction
            } else if (displayable == WelCome) {
                if (command == BitByte) {//GEN-END:|7-commandAction|31|47-preAction
                    // write pre-action user code here
                    switchDisplayable(null, getBitBytes());//GEN-LINE:|7-commandAction|32|47-postAction
                    // write post-action user code here
                } else if (command == Day) {//GEN-LINE:|7-commandAction|33|108-preAction
                    // write pre-action user code here
                    switchDisplayable(null, getDays());//GEN-LINE:|7-commandAction|34|108-postAction
                    // write post-action user code here
                } else if (command == Distance) {//GEN-LINE:|7-commandAction|35|146-preAction
                    // write pre-action user code here
                    switchDisplayable(null, getDistances());//GEN-LINE:|7-commandAction|36|146-postAction
                    // write post-action user code here
                } else if (command == Time) {//GEN-LINE:|7-commandAction|37|98-preAction
                    // write pre-action user code here
                    switchDisplayable(null, getTimes());//GEN-LINE:|7-commandAction|38|98-postAction
                    // write post-action user code here
                } else if (command == Weight) {//GEN-LINE:|7-commandAction|39|71-preAction
                    // write pre-action user code here
                    switchDisplayable(null, getWeights());//GEN-LINE:|7-commandAction|40|71-postAction
                    // write post-action user code here
                } else if (command == exitCommand) {//GEN-LINE:|7-commandAction|41|19-preAction
                    // write pre-action user code here
                    exitMIDlet();//GEN-LINE:|7-commandAction|42|19-postAction
                    // write post-action user code here
                }//GEN-BEGIN:|7-commandAction|43|7-postCommandAction
            }//GEN-END:|7-commandAction|43|7-postCommandAction
            // wri
        } catch (Exception e) {
            Alert error = new Alert("Ups !!", "Invalid Value !!", null, AlertType.ERROR);
            switchDisplayable(error, Distances);
        }
    }//GEN-BEGIN:|7-commandAction|44|
    //
//GEN-END:|7-commandAction|44|

    ////GEN-BEGIN:|18-getter|0|18-preInit
    /**
     * Returns an initiliazed instance of exitCommand component.
     * @return the initialized component instance
     */
    public Command getExitCommand() {
        if (exitCommand == null) {//GEN-END:|18-getter|0|18-preInit
            // write pre-init user code here
            exitCommand = new Command("Exit", Command.EXIT, 0);//GEN-LINE:|18-getter|1|18-postInit
            // write post-init user code here
        }//GEN-BEGIN:|18-getter|2|
        return exitCommand;
    }
    //
//GEN-END:|18-getter|2|
    ////GEN-BEGIN:|14-getter|0|14-preInit
    /**
     * Returns an initiliazed instance of WelCome component.
     * @return the initialized component instance
     */
    public Form getWelCome() {
        if (WelCome == null) {//GEN-END:|14-getter|0|14-preInit
            // write pre-init user code here
            WelCome = new Form("Welcome", new Item[] { getStringItem(), getImageItem() });//GEN-BEGIN:|14-getter|1|14-postInit
            WelCome.setTicker(getTicker());
            WelCome.addCommand(getExitCommand());
            WelCome.addCommand(getBitByte());
            WelCome.addCommand(getWeight());
            WelCome.addCommand(getTime());
            WelCome.addCommand(getDay());
            WelCome.addCommand(getDistance());
            WelCome.setCommandListener(this);//GEN-END:|14-getter|1|14-postInit
            // write post-init user code here
        }//GEN-BEGIN:|14-getter|2|
        return WelCome;
    }
    //
//GEN-END:|14-getter|2|
    ////GEN-BEGIN:|16-getter|0|16-preInit
    /**
     * Returns an initiliazed instance of stringItem component.
     * @return the initialized component instance
     */
    public StringItem getStringItem() {
        if (stringItem == null) {//GEN-END:|16-getter|0|16-preInit
            // write pre-init user code here
            stringItem = new StringItem("O2 Solutions ", "Conveter Application.");//GEN-LINE:|16-getter|1|16-postInit
            // write post-init user code here
        }//GEN-BEGIN:|16-getter|2|
        return stringItem;
    }
    //
//GEN-END:|16-getter|2|
    ////GEN-BEGIN:|22-getter|0|22-preInit
    /**
     * Returns an initiliazed instance of ticker component.
     * @return the initialized component instance
     */
    public Ticker getTicker() {
        if (ticker == null) {//GEN-END:|22-getter|0|22-preInit
            // write pre-init user code here
            ticker = new Ticker("O2 Solutions [RK]");//GEN-LINE:|22-getter|1|22-postInit
            // write post-init user code here
        }//GEN-BEGIN:|22-getter|2|
        return ticker;
    }
    //
//GEN-END:|22-getter|2|
    ////GEN-BEGIN:|23-getter|0|23-preInit
    /**
     * Returns an initiliazed instance of imageItem component.
     * @return the initialized component instance
     */
    public ImageItem getImageItem() {
        if (imageItem == null) {//GEN-END:|23-getter|0|23-preInit
            // write pre-init user code here
// imageItem = new ImageItem("Converter", getConverter(),ImageItem.LAYOUT_CENTER|ImageItem.LAYOUT_VCENTER, "", //Item.PLAIN);//GEN-BEGIN:|23-getter|1|23-postInit
imageItem= new ImageItem("Converter",getConverter(),ImageItem.LAYOUT_CENTER|ImageItem.LAYOUT_VCENTER, "Converter");

            imageItem.addCommand(getConverterImage());
            imageItem.setItemCommandListener(this);//GEN-END:|23-getter|1|23-postInit
            // write post-init user code here
        }//GEN-BEGIN:|23-getter|2|
        return imageItem;
    }
    //
//GEN-END:|23-getter|2|    //

    ////GEN-BEGIN:|26-getter|0|26-preInit
    /**
     * Returns an initiliazed instance of Converter component.
     * @return the initialized component instance
     */
    public Image getConverter() {

        if (Converter == null) {//GEN-END:|26-getter|0|26-preInit
            // write pre-init user code here
            try {//GEN-BEGIN:|26-getter|1|26-@java.io.IOException
                Converter = Image.createImage("/Images/Converter.png");
  // Converter= new ImageItem("Converter",Converter,ImageItem.LAYOUT_CENTER|ImageItem.LAYOUT_VCENTER, "Converter");

            } catch (java.io.IOException e) {//GEN-END:|26-getter|1|26-@java.io.IOException
                e.printStackTrace();
            }//GEN-LINE:|26-getter|2|26-postInit
            // write post-init user code here
        }//GEN-BEGIN:|26-getter|3|
        return Converter;
    }
    //
//GEN-END:|26-getter|3|

    ////GEN-BEGIN:|27-getter|0|27-preInit
    /**
     * Returns an initiliazed instance of ConverterImage component.
     * @return the initialized component instance
     */
    public Command getConverterImage() {
        if (ConverterImage == null) {//GEN-END:|27-getter|0|27-preInit
            // write pre-init user code here
            ConverterImage = new Command("Types", Command.SCREEN, 0);//GEN-LINE:|27-getter|1|27-postInit
            // write post-init user code here
        }//GEN-BEGIN:|27-getter|2|
        return ConverterImage;
    }
    //
//GEN-END:|27-getter|2|
    ////GEN-BEGIN:|32-getter|0|32-preInit
    /**
     * Returns an initiliazed instance of exitCommand1 component.
     * @return the initialized component instance
     */
    public Command getExitCommand1() {
        if (exitCommand1 == null) {//GEN-END:|32-getter|0|32-preInit
            // write pre-init user code here
            exitCommand1 = new Command("Exit", Command.EXIT, 0);//GEN-LINE:|32-getter|1|32-postInit
            // write post-init user code here
        }//GEN-BEGIN:|32-getter|2|
        return exitCommand1;
    }
    //
//GEN-END:|32-getter|2|
    ////GEN-BEGIN:|36-getter|0|36-preInit
    /**
     * Returns an initiliazed instance of backCommand component.
     * @return the initialized component instance
     */
    public Command getBackCommand() {
        if (backCommand == null) {//GEN-END:|36-getter|0|36-preInit
            // write pre-init user code here
            backCommand = new Command("Back", Command.BACK, 0);//GEN-LINE:|36-getter|1|36-postInit
            // write post-init user code here
        }//GEN-BEGIN:|36-getter|2|
        return backCommand;
    }
    //
//GEN-END:|36-getter|2|    //

    ////GEN-BEGIN:|29-getter|0|29-preInit
    /**
     * Returns an initiliazed instance of Distances component.
     * @return the initialized component instance
     */
    public Form getDistances() {
        if (Distances == null) {//GEN-END:|29-getter|0|29-preInit
            // write pre-init user code here
            Distances = new Form("Distance", new Item[] { getMm_Tf(), getCm_Tf(), getMt_Tf(), getKm_Tf() });//GEN-BEGIN:|29-getter|1|29-postInit
            Distances.setTicker(getO2Sol());
            Distances.addCommand(getBackCommand());
            Distances.addCommand(getOkCommand());
            Distances.addCommand(getCancelCommand());
            Distances.setCommandListener(this);//GEN-END:|29-getter|1|29-postInit
            // write post-init user code here
        }//GEN-BEGIN:|29-getter|2|
        return Distances;
    }
    //
//GEN-END:|29-getter|2|
    ////GEN-BEGIN:|41-getter|0|41-preInit
    /**
     * Returns an initiliazed instance of okCommand component.
     * @return the initialized component instance
     */
    public Command getOkCommand() {
        if (okCommand == null) {//GEN-END:|41-getter|0|41-preInit
            // write pre-init user code here
            okCommand = new Command("Ok", Command.OK, 0);//GEN-LINE:|41-getter|1|41-postInit
            // write post-init user code here
        }//GEN-BEGIN:|41-getter|2|
        return okCommand;
    }
    //
//GEN-END:|41-getter|2|
    ////GEN-BEGIN:|43-getter|0|43-preInit
    /**
     * Returns an initiliazed instance of itemCommand component.
     * @return the initialized component instance
     */
    public Command getItemCommand() {
        if (itemCommand == null) {//GEN-END:|43-getter|0|43-preInit
            // write pre-init user code here
            itemCommand = new Command("Item", Command.ITEM, 0);//GEN-LINE:|43-getter|1|43-postInit
            // write post-init user code here
        }//GEN-BEGIN:|43-getter|2|
        return itemCommand;
    }
    //
//GEN-END:|43-getter|2|
    ////GEN-BEGIN:|46-getter|0|46-preInit
    /**
     * Returns an initiliazed instance of BitByte component.
     * @return the initialized component instance
     */
    public Command getBitByte() {
        if (BitByte == null) {//GEN-END:|46-getter|0|46-preInit
            // write pre-init user code here
            BitByte = new Command("BitByte", Command.ITEM, 0);//GEN-LINE:|46-getter|1|46-postInit
            // write post-init user code here
        }//GEN-BEGIN:|46-getter|2|
        return BitByte;
    }
    //
//GEN-END:|46-getter|2|
    ////GEN-BEGIN:|48-getter|0|48-preInit
    /**
     * Returns an initiliazed instance of BitBytes component.
     * @return the initialized component instance
     */
    public Form getBitBytes() {
        if (BitBytes == null) {//GEN-END:|48-getter|0|48-preInit
            // write pre-init user code here
            BitBytes = new Form("Bit Bytes", new Item[] { getBits_Tf(), getBytes_Tf(), getKbs_Tf(), getMbs_Tf(), getGbs_Tf(), getTbs_Tf() });//GEN-BEGIN:|48-getter|1|48-postInit
            BitBytes.setTicker(getO2Sol());
            BitBytes.addCommand(getBackCommand());
            BitBytes.addCommand(getOkCommand());
            BitBytes.addCommand(getCancelCommand());
            BitBytes.setCommandListener(this);//GEN-END:|48-getter|1|48-postInit
            // write post-init user code here
        }//GEN-BEGIN:|48-getter|2|
        return BitBytes;
    }
    //
//GEN-END:|48-getter|2|    //

    ////GEN-BEGIN:|60-getter|0|60-preInit
    /**
     * Returns an initiliazed instance of bits_Tf component.
     * @return the initialized component instance
     */
    public TextField getBits_Tf() {
        if (bits_Tf == null) {//GEN-END:|60-getter|0|60-preInit
            // write pre-init user code here
            bits_Tf = new TextField("Bits", null, 32, TextField.ANY);//GEN-LINE:|60-getter|1|60-postInit
            // write post-init user code here
        }//GEN-BEGIN:|60-getter|2|
        return bits_Tf;
    }
    //
//GEN-END:|60-getter|2|    //

    ////GEN-BEGIN:|61-getter|0|61-preInit
    /**
     * Returns an initiliazed instance of bytes_Tf component.
     * @return the initialized component instance
     */
    public TextField getBytes_Tf() {
        if (bytes_Tf == null) {//GEN-END:|61-getter|0|61-preInit
            // write pre-init user code here
            bytes_Tf = new TextField("Bytes", null, 32, TextField.ANY);//GEN-LINE:|61-getter|1|61-postInit
            // write post-init user code here
        }//GEN-BEGIN:|61-getter|2|
        return bytes_Tf;
    }
    //
//GEN-END:|61-getter|2|    //

    ////GEN-BEGIN:|62-getter|0|62-preInit
    /**
     * Returns an initiliazed instance of kbs_Tf component.
     * @return the initialized component instance
     */
    public TextField getKbs_Tf() {
        if (kbs_Tf == null) {//GEN-END:|62-getter|0|62-preInit
            // write pre-init user code here
            kbs_Tf = new TextField("KiloBytes", null, 32, TextField.ANY);//GEN-LINE:|62-getter|1|62-postInit
            // write post-init user code here
        }//GEN-BEGIN:|62-getter|2|
        return kbs_Tf;
    }
    //
//GEN-END:|62-getter|2|    //

    ////GEN-BEGIN:|63-getter|0|63-preInit
    /**
     * Returns an initiliazed instance of mbs_Tf component.
     * @return the initialized component instance
     */
    public TextField getMbs_Tf() {
        if (mbs_Tf == null) {//GEN-END:|63-getter|0|63-preInit
            // write pre-init user code here
            mbs_Tf = new TextField("MegaBytes", null, 32, TextField.ANY);//GEN-LINE:|63-getter|1|63-postInit
            // write post-init user code here
        }//GEN-BEGIN:|63-getter|2|
        return mbs_Tf;
    }
    //
//GEN-END:|63-getter|2|    //

    ////GEN-BEGIN:|64-getter|0|64-preInit
    /**
     * Returns an initiliazed instance of gbs_Tf component.
     * @return the initialized component instance
     */
    public TextField getGbs_Tf() {
        if (gbs_Tf == null) {//GEN-END:|64-getter|0|64-preInit
            // write pre-init user code here
            gbs_Tf = new TextField("GigaBytes", null, 32, TextField.ANY);//GEN-LINE:|64-getter|1|64-postInit
            // write post-init user code here
        }//GEN-BEGIN:|64-getter|2|
        return gbs_Tf;
    }
    //
//GEN-END:|64-getter|2|    //

    ////GEN-BEGIN:|65-getter|0|65-preInit
    /**
     * Returns an initiliazed instance of tbs_Tf component.
     * @return the initialized component instance
     */
    public TextField getTbs_Tf() {
        if (tbs_Tf == null) {//GEN-END:|65-getter|0|65-preInit
            // write pre-init user code here
            tbs_Tf = new TextField("TeraBytes", null, 32, TextField.ANY);//GEN-LINE:|65-getter|1|65-postInit
            // write post-init user code here
        }//GEN-BEGIN:|65-getter|2|
        return tbs_Tf;
    }
    //
//GEN-END:|65-getter|2|
    ////GEN-BEGIN:|66-getter|0|66-preInit
    /**
     * Returns an initiliazed instance of mm_Tf component.
     * @return the initialized component instance
     */
    public TextField getMm_Tf() {
        if (mm_Tf == null) {//GEN-END:|66-getter|0|66-preInit
            // write pre-init user code here
            mm_Tf = new TextField("Mili Meter", null, 32, TextField.ANY);//GEN-LINE:|66-getter|1|66-postInit
            // write post-init user code here
        }//GEN-BEGIN:|66-getter|2|
        return mm_Tf;
    }
    //
//GEN-END:|66-getter|2|    //

    ////GEN-BEGIN:|67-getter|0|67-preInit
    /**
     * Returns an initiliazed instance of mt_Tf component.
     * @return the initialized component instance
     */
    public TextField getMt_Tf() {
        if (mt_Tf == null) {//GEN-END:|67-getter|0|67-preInit
            // write pre-init user code here
            mt_Tf = new TextField("Meter", null, 32, TextField.ANY);//GEN-LINE:|67-getter|1|67-postInit
            // write post-init user code here
        }//GEN-BEGIN:|67-getter|2|
        return mt_Tf;
    }
    //
//GEN-END:|67-getter|2|    //

    ////GEN-BEGIN:|68-getter|0|68-preInit
    /**
     * Returns an initiliazed instance of cm_Tf component.
     * @return the initialized component instance
     */
    public TextField getCm_Tf() {
        if (cm_Tf == null) {//GEN-END:|68-getter|0|68-preInit
            // write pre-init user code here
            cm_Tf = new TextField("Centi Meter", null, 32, TextField.ANY);//GEN-LINE:|68-getter|1|68-postInit
            // write post-init user code here
        }//GEN-BEGIN:|68-getter|2|
        return cm_Tf;
    }
    //
//GEN-END:|68-getter|2|
    ////GEN-BEGIN:|69-getter|0|69-preInit
    /**
     * Returns an initiliazed instance of km_Tf component.
     * @return the initialized component instance
     */
    public TextField getKm_Tf() {
        if (km_Tf == null) {//GEN-END:|69-getter|0|69-preInit
            // write pre-init user code here
            km_Tf = new TextField("Kilo Meter", null, 32, TextField.ANY);//GEN-BEGIN:|69-getter|1|69-postInit
            km_Tf.setItemCommandListener(this);//GEN-END:|69-getter|1|69-postInit
            // write post-init user code here
        }//GEN-BEGIN:|69-getter|2|
        return km_Tf;
    }
    //
//GEN-END:|69-getter|2|
    ////GEN-BEGIN:|70-getter|0|70-preInit
    /**
     * Returns an initiliazed instance of Weight component.
     * @return the initialized component instance
     */
    public Command getWeight() {
        if (Weight == null) {//GEN-END:|70-getter|0|70-preInit
            // write pre-init user code here
            Weight = new Command("Weight", Command.ITEM, 0);//GEN-LINE:|70-getter|1|70-postInit
            // write post-init user code here
        }//GEN-BEGIN:|70-getter|2|
        return Weight;
    }
    //
//GEN-END:|70-getter|2|
    ////GEN-BEGIN:|72-getter|0|72-preInit
    /**
     * Returns an initiliazed instance of Weights component.
     * @return the initialized component instance
     */
    public Form getWeights() {
        if (Weights == null) {//GEN-END:|72-getter|0|72-preInit
            // write pre-init user code here
            Weights = new Form("Weights", new Item[] { getMg_Tf(), getGm_Tf(), getKg_Tf(), getTn_Tf() });//GEN-BEGIN:|72-getter|1|72-postInit
            Weights.setTicker(getO2Sol());
            Weights.addCommand(getBackCommand());
            Weights.addCommand(getOkCommand());
            Weights.addCommand(getCancelCommand());
            Weights.setCommandListener(this);//GEN-END:|72-getter|1|72-postInit
            // write post-init user code here
        }//GEN-BEGIN:|72-getter|2|
        return Weights;
    }
    //
//GEN-END:|72-getter|2|
    ////GEN-BEGIN:|78-getter|0|78-preInit
    /**
     * Returns an initiliazed instance of gm_Tf component.
     * @return the initialized component instance
     */
    public TextField getGm_Tf() {
        if (gm_Tf == null) {//GEN-END:|78-getter|0|78-preInit
            // write pre-init user code here
            gm_Tf = new TextField("Gram", null, 32, TextField.ANY);//GEN-LINE:|78-getter|1|78-postInit
            // write post-init user code here
        }//GEN-BEGIN:|78-getter|2|
        return gm_Tf;
    }
    //
//GEN-END:|78-getter|2|
    ////GEN-BEGIN:|79-getter|0|79-preInit
    /**
     * Returns an initiliazed instance of mg_Tf component.
     * @return the initialized component instance
     */
    public TextField getMg_Tf() {
        if (mg_Tf == null) {//GEN-END:|79-getter|0|79-preInit
            // write pre-init user code here
            mg_Tf = new TextField("Mili Gram", null, 32, TextField.ANY);//GEN-LINE:|79-getter|1|79-postInit
            // write post-init user code here
        }//GEN-BEGIN:|79-getter|2|
        return mg_Tf;
    }
    //
//GEN-END:|79-getter|2|
    ////GEN-BEGIN:|80-getter|0|80-preInit
    /**
     * Returns an initiliazed instance of kg_Tf component.
     * @return the initialized component instance
     */
    public TextField getKg_Tf() {
        if (kg_Tf == null) {//GEN-END:|80-getter|0|80-preInit
            // write pre-init user code here
            kg_Tf = new TextField("Kilo Gram", null, 32, TextField.ANY);//GEN-LINE:|80-getter|1|80-postInit
            // write post-init user code here
        }//GEN-BEGIN:|80-getter|2|
        return kg_Tf;
    }
    //
//GEN-END:|80-getter|2|
    ////GEN-BEGIN:|81-getter|0|81-preInit
    /**
     * Returns an initiliazed instance of tn_Tf component.
     * @return the initialized component instance
     */
    public TextField getTn_Tf() {
        if (tn_Tf == null) {//GEN-END:|81-getter|0|81-preInit
            // write pre-init user code here
            tn_Tf = new TextField("Tone", null, 32, TextField.ANY);//GEN-LINE:|81-getter|1|81-postInit
            // write post-init user code here
        }//GEN-BEGIN:|81-getter|2|
        return tn_Tf;
    }
    //
//GEN-END:|81-getter|2|
    ////GEN-BEGIN:|97-getter|0|97-preInit
    /**
     * Returns an initiliazed instance of Time component.
     * @return the initialized component instance
     */
    public Command getTime() {
        if (Time == null) {//GEN-END:|97-getter|0|97-preInit
            // write pre-init user code here
            Time = new Command("Time", Command.ITEM, 0);//GEN-LINE:|97-getter|1|97-postInit
            // write post-init user code here
        }//GEN-BEGIN:|97-getter|2|
        return Time;
    }
    //
//GEN-END:|97-getter|2|    //

    ////GEN-BEGIN:|99-getter|0|99-preInit
    /**
     * Returns an initiliazed instance of Times component.
     * @return the initialized component instance
     */
    public Form getTimes() {
        if (Times == null) {//GEN-END:|99-getter|0|99-preInit
            // write pre-init user code here
            Times = new Form("Times", new Item[] { getMili_Tf(), getSeconds_Tf(), getMinutes_Tf(), getHours_Tf() });//GEN-BEGIN:|99-getter|1|99-postInit
            Times.setTicker(getO2Sol());
            Times.addCommand(getBackCommand());
            Times.addCommand(getOkCommand());
            Times.addCommand(getCancelCommand());
            Times.setCommandListener(this);//GEN-END:|99-getter|1|99-postInit
            // write post-init user code here
        }//GEN-BEGIN:|99-getter|2|
        return Times;
    }
    //
//GEN-END:|99-getter|2|    //

    ////GEN-BEGIN:|102-getter|0|102-preInit
    /**
     * Returns an initiliazed instance of minutes_Tf component.
     * @return the initialized component instance
     */
    public TextField getMinutes_Tf() {
        if (minutes_Tf == null) {//GEN-END:|102-getter|0|102-preInit
            // write pre-init user code here
            minutes_Tf = new TextField("Minutes", null, 32, TextField.ANY);//GEN-LINE:|102-getter|1|102-postInit
            // write post-init user code here
        }//GEN-BEGIN:|102-getter|2|
        return minutes_Tf;
    }
    //
//GEN-END:|102-getter|2|    //

    ////GEN-BEGIN:|103-getter|0|103-preInit
    /**
     * Returns an initiliazed instance of mili_Tf component.
     * @return the initialized component instance
     */
    public TextField getMili_Tf() {
        if (mili_Tf == null) {//GEN-END:|103-getter|0|103-preInit
            // write pre-init user code here
            mili_Tf = new TextField("Mili Seconds", null, 32, TextField.ANY);//GEN-LINE:|103-getter|1|103-postInit
            // write post-init user code here
        }//GEN-BEGIN:|103-getter|2|
        return mili_Tf;
    }
    //
//GEN-END:|103-getter|2|    //

    ////GEN-BEGIN:|104-getter|0|104-preInit
    /**
     * Returns an initiliazed instance of seconds_Tf component.
     * @return the initialized component instance
     */
    public TextField getSeconds_Tf() {
        if (seconds_Tf == null) {//GEN-END:|104-getter|0|104-preInit
            // write pre-init user code here
            seconds_Tf = new TextField("Seconds", null, 32, TextField.ANY);//GEN-LINE:|104-getter|1|104-postInit
            // write post-init user code here
        }//GEN-BEGIN:|104-getter|2|
        return seconds_Tf;
    }
    //
//GEN-END:|104-getter|2|    //

    ////GEN-BEGIN:|105-getter|0|105-preInit
    /**
     * Returns an initiliazed instance of hours_Tf component.
     * @return the initialized component instance
     */
    public TextField getHours_Tf() {
        if (hours_Tf == null) {//GEN-END:|105-getter|0|105-preInit
            // write pre-init user code here
            hours_Tf = new TextField("Hours", null, 32, TextField.ANY);//GEN-LINE:|105-getter|1|105-postInit
            // write post-init user code here
        }//GEN-BEGIN:|105-getter|2|
        return hours_Tf;
    }
    //
//GEN-END:|105-getter|2|
    ////GEN-BEGIN:|107-getter|0|107-preInit
    /**
     * Returns an initiliazed instance of Day component.
     * @return the initialized component instance
     */
    public Command getDay() {
        if (Day == null) {//GEN-END:|107-getter|0|107-preInit
            // write pre-init user code here
            Day = new Command("Day", Command.ITEM, 0);//GEN-LINE:|107-getter|1|107-postInit
            // write post-init user code here
        }//GEN-BEGIN:|107-getter|2|
        return Day;
    }
    //
//GEN-END:|107-getter|2|
    ////GEN-BEGIN:|109-getter|0|109-preInit
    /**
     * Returns an initiliazed instance of Days component.
     * @return the initialized component instance
     */
    public Form getDays() {
        if (Days == null) {//GEN-END:|109-getter|0|109-preInit
            // write pre-init user code here
            Days = new Form("Days", new Item[] { getDays_Tf(), getWeeks_Tf(), getMonths_Tf(), getYears_Tf() });//GEN-BEGIN:|109-getter|1|109-postInit
            Days.setTicker(getO2Sol());
            Days.addCommand(getBackCommand());
            Days.addCommand(getOkCommand());
            Days.addCommand(getCancelCommand());
            Days.setCommandListener(this);//GEN-END:|109-getter|1|109-postInit
            // write post-init user code here
        }//GEN-BEGIN:|109-getter|2|
        return Days;
    }
    //
//GEN-END:|109-getter|2|
    ////GEN-BEGIN:|110-getter|0|110-preInit
    /**
     * Returns an initiliazed instance of days_Tf component.
     * @return the initialized component instance
     */
    public TextField getDays_Tf() {
        if (days_Tf == null) {//GEN-END:|110-getter|0|110-preInit
            // write pre-init user code here
            days_Tf = new TextField("Days", null, 32, TextField.ANY);//GEN-BEGIN:|110-getter|1|110-postInit
            days_Tf.setLayout(ImageItem.LAYOUT_DEFAULT);//GEN-END:|110-getter|1|110-postInit
            // write post-init user code here
        }//GEN-BEGIN:|110-getter|2|
        return days_Tf;
    }
    //
//GEN-END:|110-getter|2|
    ////GEN-BEGIN:|111-getter|0|111-preInit
    /**
     * Returns an initiliazed instance of weeks_Tf component.
     * @return the initialized component instance
     */
    public TextField getWeeks_Tf() {
        if (weeks_Tf == null) {//GEN-END:|111-getter|0|111-preInit
            // write pre-init user code here
            weeks_Tf = new TextField("Weeks", null, 32, TextField.ANY);//GEN-LINE:|111-getter|1|111-postInit
            // write post-init user code here
        }//GEN-BEGIN:|111-getter|2|
        return weeks_Tf;
    }
    //
//GEN-END:|111-getter|2|    //

    ////GEN-BEGIN:|112-getter|0|112-preInit
    /**
     * Returns an initiliazed instance of months_Tf component.
     * @return the initialized component instance
     */
    public TextField getMonths_Tf() {
        if (months_Tf == null) {//GEN-END:|112-getter|0|112-preInit
            // write pre-init user code here
            months_Tf = new TextField("Months", null, 32, TextField.ANY);//GEN-LINE:|112-getter|1|112-postInit
            // write post-init user code here
        }//GEN-BEGIN:|112-getter|2|
        return months_Tf;
    }
    //
//GEN-END:|112-getter|2|    //

    ////GEN-BEGIN:|113-getter|0|113-preInit
    /**
     * Returns an initiliazed instance of years_Tf component.
     * @return the initialized component instance
     */
    public TextField getYears_Tf() {
        if (years_Tf == null) {//GEN-END:|113-getter|0|113-preInit
            // write pre-init user code here
            years_Tf = new TextField("Years", null, 32, TextField.ANY);//GEN-LINE:|113-getter|1|113-postInit
            // write post-init user code here
        }//GEN-BEGIN:|113-getter|2|
        return years_Tf;
    }
    //
//GEN-END:|113-getter|2|
    ////GEN-BEGIN:|114-getter|0|114-preInit
    /**
     * Returns an initiliazed instance of o2Sol component.
     * @return the initialized component instance
     */
    public Ticker getO2Sol() {
        if (o2Sol == null) {//GEN-END:|114-getter|0|114-preInit
            // write pre-init user code here
            o2Sol = new Ticker("O2 Solutions [RK].");//GEN-LINE:|114-getter|1|114-postInit
            // write post-init user code here
        }//GEN-BEGIN:|114-getter|2|
        return o2Sol;
    }
    //
//GEN-END:|114-getter|2|
    ////GEN-BEGIN:|122-getter|0|122-preInit
    /**
     * Returns an initiliazed instance of cancelCommand component.
     * @return the initialized component instance
     */
    public Command getCancelCommand() {
        if (cancelCommand == null) {//GEN-END:|122-getter|0|122-preInit
            // write pre-init user code here
            cancelCommand = new Command("Clear", Command.CANCEL, 0);//GEN-LINE:|122-getter|1|122-postInit
            // write post-init user code here
        }//GEN-BEGIN:|122-getter|2|
        return cancelCommand;
    }
    //
//GEN-END:|122-getter|2|
    ////GEN-BEGIN:|125-getter|0|125-preInit
    /**
     * Returns an initiliazed instance of cancelCommand1 component.
     * @return the initialized component instance
     */
    public Command getCancelCommand1() {
        if (cancelCommand1 == null) {//GEN-END:|125-getter|0|125-preInit
            // write pre-init user code here
            cancelCommand1 = new Command("Cancel", Command.CANCEL, 0);//GEN-LINE:|125-getter|1|125-postInit
            // write post-init user code here
        }//GEN-BEGIN:|125-getter|2|
        return cancelCommand1;
    }
    //
//GEN-END:|125-getter|2|
    ////GEN-BEGIN:|134-getter|0|134-preInit
    /**
     * Returns an initiliazed instance of screenCommand component.
     * @return the initialized component instance
     */
    public Command getScreenCommand() {
        if (screenCommand == null) {//GEN-END:|134-getter|0|134-preInit
            // write pre-init user code here
            screenCommand = new Command("Screen", Command.SCREEN, 0);//GEN-LINE:|134-getter|1|134-postInit
            // write post-init user code here
        }//GEN-BEGIN:|134-getter|2|
        return screenCommand;
    }
    //
//GEN-END:|134-getter|2|
    ////GEN-BEGIN:|136-getter|0|136-preInit
    /**
     * Returns an initiliazed instance of itemCommand1 component.
     * @return the initialized component instance
     */
    public Command getItemCommand1() {
        if (itemCommand1 == null) {//GEN-END:|136-getter|0|136-preInit
            // write pre-init user code here
            itemCommand1 = new Command("Item", Command.ITEM, 0);//GEN-LINE:|136-getter|1|136-postInit
            // write post-init user code here
        }//GEN-BEGIN:|136-getter|2|
        return itemCommand1;
    }
    //
//GEN-END:|136-getter|2|
    ////GEN-BEGIN:|143-getter|0|143-preInit
    /**
     * Returns an initiliazed instance of okCommand1 component.
     * @return the initialized component instance
     */
    public Command getOkCommand1() {
        if (okCommand1 == null) {//GEN-END:|143-getter|0|143-preInit
            // write pre-init user code here
            okCommand1 = new Command("Ok", Command.OK, 0);//GEN-LINE:|143-getter|1|143-postInit
            // write post-init user code here
        }//GEN-BEGIN:|143-getter|2|
        return okCommand1;
    }
    //
//GEN-END:|143-getter|2|
    ////GEN-BEGIN:|145-getter|0|145-preInit
    /**
     * Returns an initiliazed instance of Distance component.
     * @return the initialized component instance
     */
    public Command getDistance() {
        if (Distance == null) {//GEN-END:|145-getter|0|145-preInit
            // write pre-init user code here
            Distance = new Command("Distance", Command.ITEM, 0);//GEN-LINE:|145-getter|1|145-postInit
            // write post-init user code here
        }//GEN-BEGIN:|145-getter|2|
        return Distance;
    }
    //
//GEN-END:|145-getter|2|
    ////GEN-BEGIN:|17-itemCommandAction|0|17-preItemCommandAction
    /**
     * Called by a system to indicated that a command has been invoked on a particular item.
     * @param command the Command that was invoked
     * @param displayable the Item where the command was invoked
     */
    public void commandAction(Command command, Item item) {//GEN-END:|17-itemCommandAction|0|17-preItemCommandAction
        // write pre-action user code here
        if (item == imageItem) {//GEN-BEGIN:|17-itemCommandAction|1|28-preAction
            if (command == ConverterImage) {//GEN-END:|17-itemCommandAction|1|28-preAction
                // write pre-action user code here
//GEN-LINE:|17-itemCommandAction|2|28-postAction
                // write post-action user code here
            }//GEN-BEGIN:|17-itemCommandAction|3|17-postItemCommandAction
        }//GEN-END:|17-itemCommandAction|3|17-postItemCommandAction
        // write post-action user code here
    }//GEN-BEGIN:|17-itemCommandAction|4|
    //
//GEN-END:|17-itemCommandAction|4|




    /**
     * Returns a display instance.
     * @return the display instance.
     */
    public Display getDisplay() {
        return Display.getDisplay(this);
    }

    /**
     * Exits MIDlet.
     */
    public void exitMIDlet() {
        switchDisplayable(null, null);
        destroyApp(true);
        notifyDestroyed();
    }

    /**
     * Called when MIDlet is started.
     * Checks whether the MIDlet have been already started and initialize/starts or resumes the MIDlet.
     */
    public void startApp() {
        if (midletPaused) {
            resumeMIDlet();
        } else {
            initialize();
            startMIDlet();
        }
        midletPaused = false;
    }

    /**
     * Called when MIDlet is paused.
     */
    public void pauseApp() {
        midletPaused = true;
    }

    /**
     * Called to signal the MIDlet to terminate.
     * @param unconditional if true, then the MIDlet has to be unconditionally terminated and all resources has to be released.
     */
    public void destroyApp(boolean unconditional) {
    }
}

No comments:

Post a Comment