Problems with a simple stop watch program

I would appreciate help sorting out a problem with a simple stop watch program. The problem is that it throws up inappropriate values. For example, the first time I ran it today it showed the best time at 19 seconds before the actual time had reached 2 seconds. I restarted the program and it ran correctly until about the thirtieth time I started it again when it was going okay until the display suddenly changed to something like '-50:31:30:50-'. I don't have screenshot because I had twenty thirteen year olds suddenly yelling at me that it was wrong. I clicked 'Stop' and then 'Start' again and it ran correctly.
I have posted the whole code (minus the GUI section) because I want you to see that the program is very, very simple. I can't see where it could go wrong. I would appreciate any hints.
public class StopWatch extends javax.swing.JFrame implements Runnable {
    int startTime, stopTime, totalTime, bestTime;
    private volatile Thread myThread = null;
    /** Creates new form StopWatch */
    public StopWatch() {
     startTime = 0;
     stopTime = 0;
     totalTime = 0;
     bestTime = 0;
     initComponents();
    public void run() {
     Thread thisThread = Thread.currentThread();
     while(myThread == thisThread) {
         try {
          Thread.sleep(100);
          getEnd();
         } catch (InterruptedException e) {}
    public void start() {
     if(myThread == null) {
         myThread = new Thread(this);
         myThread.start();
    public void getStart() {
     Calendar now = Calendar.getInstance();
     startTime = (now.get(Calendar.MINUTE) * 60) + now.get(Calendar.SECOND);
    public void getEnd() {
     Calendar now1 = Calendar.getInstance();
     stopTime = (now1.get(Calendar.MINUTE) * 60) + now1.get(Calendar.SECOND);
     totalTime = stopTime - startTime;
     setLabel();
     if(bestTime < totalTime) bestTime = totalTime;
    public void setLabel() {
     if((totalTime % 60) < 10) {
         jLabel1.setText(""+totalTime/60+ ":0"+(totalTime % 60));
     } else {
         jLabel1.setText(""+totalTime/60 + ":"+(totalTime % 60));
     if((bestTime % 60) < 10) {
         jLabel3.setText(""+bestTime/60+ ":0"+(bestTime % 60));
     } else {
         jLabel3.setText(""+bestTime/60 + ":"+(bestTime % 60));
    private void ButtonClicked(java.awt.event.ActionEvent evt) {                              
     JButton temp = (JButton) evt.getSource();
     if(temp.equals(jButton1)) {
         start();
         getStart();
     if(temp.equals(jButton2)) {
         getEnd();
         myThread = null;
     * @param args the command line arguments
    public static void main(String args[]) {
     java.awt.EventQueue.invokeLater(new Runnable() {
         public void run() {
          new StopWatch().setVisible(true);
    // Variables declaration - do not modify                    
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JPanel jPanel1;
    // End of variables declaration                  
}

Although I appreciate this information, it still doesn't actually solve the problem. I can't see an error in the logic (or the code). The fact that the formatting works most of the time suggests that the problem does not lie there. As well, I use the same basic code for other time related displays e.g. countdown timers where the user sets a maximum time and the computer stops when zero is reached. I haven't had an error is these programs.
For me, it is such a simple program and the room for errors seem small. I am guessing that I have misunderstood something about dates, but I obviously don't know.
Again, thank you for taking the time to look at the problem and post a reply.

Similar Messages

  • HT204152 hello i have a problem with app store cant download program get this error verification required and no accept my visa card

    hello i have a problem with app store cant download program get this error verification required and no accept my visa card

    what i can start to download and updated programs

  • Problem with a simple GRE tunnel

    Hello everyone:
    I have a problem with a simple GRE tunnel, and can not make it work, the problem lies in the instruction "tunnel source loopback-0" if I use this command does not work, now if I use "tunnel source <ip wan >" if it works, someone can tell me why?
    Thanks for your help
    Router 1: 2811
    version 12.4
    no service password-encryption
    hostname cisco2811
    no aaa new-model
    ip cef
    interface Loopback0
    ip address 2.2.2.2 255.255.255.255
    interface Tunnel0
    ip address 10.10.1.1 255.255.255.0
    tunnel source Loopback0
    tunnel destination 217.127.XXX.188
    interface Tunnel1
    ip address 10.10.2.1 255.255.255.0
    tunnel source Loopback0
    tunnel destination 80.32.XXX.125
    interface FastEthernet0/0
    description LOCAL LAN Interface
    ip address 192.168.1.254 255.255.255.0
    ip nat inside
    ip virtual-reassembly
    duplex auto
    speed auto
    interface FastEthernet0/1
    description WAN Interface
    ip address 195.77.XXX.70 255.255.255.248
    ip nat outside
    ip virtual-reassembly
    duplex auto
    speed auto
    ip forward-protocol nd
    ip route 0.0.0.0 0.0.0.0 195.77.XXX.65
    ip route 192.168.3.0 255.255.255.0 Tunnel0
    ip route 192.168.4.0 255.255.255.0 Tunnel1
    ip nat inside source route-map salida-fibra interface FastEthernet0/1 overload
    access-list 120 deny ip 192.168.1.0 0.0.0.255 192.168.3.0 0.0.0.255
    access-list 120 deny ip 192.168.1.0 0.0.0.255 192.168.4.0 0.0.0.255
    access-list 120 permit ip 192.168.1.0 0.0.0.255 any
    route-map salida-fibra permit 10
    match ip address 120
    Router 2: 2811
    version 12.4
    service password-encryption
    ip cef
    no ip domain lookup
    multilink bundle-name authenticated
    username admin privilege 15 password 7 104CXXXXx13
    interface Loopback0
    ip address 4.4.4.4 255.255.255.255
    interface Tunnel0
    ip address 10.10.1.2 255.255.255.0
    tunnel source Loopback0
    tunnel destination 195.77.XXX.70
    interface Ethernet0
    ip address 192.168.3.251 255.255.255.0
    ip nat inside
    ip virtual-reassembly
    hold-queue 100 out
    interface ATM0
    no ip address
    no ip route-cache cef
    no ip route-cache
    no atm ilmi-keepalive
    dsl operating-mode auto
    interface ATM0.1 point-to-point
    ip address 217.127.XXX.188 255.255.255.192
    ip nat outside
    ip virtual-reassembly
    no ip route-cache
    no snmp trap link-status
    pvc 8/32
    encapsulation aal5snap
    ip route 0.0.0.0 0.0.0.0 ATM0.1
    ip route 192.168.1.0 255.255.255.0 Tunnel0
    ip nat inside source route-map nonat interface ATM0.1 overload
    access-list 100 permit ip 192.168.3.0 0.0.0.255 192.168.1.0 0.0.0.255
    access-list 120 deny ip 192.168.3.0 0.0.0.255 192.168.1.0 0.0.0.255
    access-list 120 permit ip 192.168.3.0 0.0.0.255 any
    route-map nonat permit 10
    match ip address 120

    Hello, thank you for the answer, as to your question, I have no connectivity within the tunnel, whether from Router 1, I ping 10.10.1.2 not get response ...
    Now both routers remove the loopback, and the interface tunnel 0 change the tunnel source to "tunnel source " tunnel works perfectly, the problem is when I have to use the loopback. Unfortunately achieved when the tunnel work, this will have to endure multicast, and all the examples found carrying a loopback as' source '... but this is a step back ..
    Tunnel0 is up, line protocol is up
    Hardware is Tunnel
    Internet address is 10.10.1.1/24
    MTU 1514 bytes, BW 9 Kbit, DLY 500000 usec,
    reliability 255/255, txload 1/255, rxload 1/255
    Encapsulation TUNNEL, loopback not set
    Keepalive not set
    Tunnel source 2.2.2.2 (Loopback0), destination 217.127.XXX.188
    Tunnel protocol/transport GRE/IP
    Key disabled, sequencing disabled
    Checksumming of packets disabled
    Tunnel TTL 255
    Fast tunneling enabled
    Tunnel transmit bandwidth 8000 (kbps)
    Tunnel receive bandwidth 8000 (kbps)
    Last input 09:04:38, output 00:00:19, output hang never
    Last clearing of "show interface" counters never
    Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
    Queueing strategy: fifo
    Output queue: 0/0 (size/max)
    5 minute input rate 0 bits/sec, 0 packets/sec
    5 minute output rate 0 bits/sec, 0 packets/sec
    0 packets input, 0 bytes, 0 no buffer
    Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
    0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
    11101 packets output, 773420 bytes, 0 underruns
    0 output errors, 0 collisions, 0 interface resets
    0 unknown protocol drops
    0 output buffer failures, 0 output buffers swapped out

  • Why is itunes saying "there is a problem with this installer package. a program required for this install to complete could not be run. contact your support personnel or package vendor."

    why is itunes saying "there is a problem with this installer package. a program required for this install to complete could not be run. contact your support personnel or package vendor."

    Go to START > ALL PROGRAMS > Apple Software Update. If it offers you a newer version of Apple Software Update, do it but Deselect any other software offered at the same time. Once done, try another iTunes install
    If you can't find ASU, go to Control Panel:
    XP - Add n Remove Programs
    Win7/Vista - Programs n Features
    Highlight ASU, click change then Repair.

  • Problem with Submit statement into print program for delivery

    Hi all,
    i got a problem with the SUBMIT statement that i put into a print program associated to a delivery output message.
    If i print the message by VL02N or VL71, everything works.
    But if i associate the output with RV56ABST, the SUBMIT instruction isn't accepted and i get the message
    "Processor ABAP: POSTING_ILLEGAL_STATEMENT"
    There is any solution to this situation?
    Why i cannot use the SUBMIT statement in this case?

    Hi Simone,
    you could try to do the operation in a separate task (call a function in starting new task). This will decouple your current process from the new task.
    Cheers,
    Stefan.

  • Problem with InDesing hiding and other programs can not be opened on screen at the same time.

    I have just installed InDesign on my Mac today. When opened it takes up all the screen and then when I try to open any other programs like a browser, it hides. I would like to make the InDesign window smaller, so I can follow instructions from a website, but the minimize window size buttons are not showing up at all. Any idea how I can fix the InDesing window size and show it along with the browser? Also how to detach it from Finder bar on the top of my screen?

    Hi Guys,
    Thank you so much for all your help. I was now able to fix it. It was after all the problem with the application frame being Off by dafout. It was showing up, but taking my whole descktop. Now when I followed your advice and checket it on under "Window" , it become much smaller and I am not able to resize it and the buttons to minimize or close it are now showing up (they were invisible before). Thank you so much to all of you who have helped me here.
    If I may have one more question, I have enocuntered another problem with using this Trial version of inDesign. When I wanted to access Bridge from the Bridge icon inside the program, I got an message that I need to download it from Creative Clowd. I found it strange since I have Photoshop CS6 and Brigge is part of this program, so I don't want to pay for it via Clowd service.
    I was able to open Bridge by just clicking on the program from my software launch screen, so it is now working along InDesign, but I wanted it to be part of the InDesign workspcace, so it would show along the program frame on the right of InDesign window and then could be attached there and moved along with it. In such set up I won't need to move each program frame separatelly when they are in my way while I work.  I wonder if it could be fixed and how. Any ideas? I would appreciate very much your reply.

  • Am getting the following message when trying to download latest upgrade. "a problem with Windows Installer Package, a program run as part of the setup did not finish as expected" Upgrade did not happen. Any suggestions ?

    Am getting a message when downloading latest iTunes upgrade:
    "There is a problem with this Windows Installer Package.
    A program run as part of the setup did not finish as expected"
    It doesn't give me any specific information about what or where the problem is.
    Any Suggestions

    Repair your Apple Software Update.
    Go to START/ALL PROGRAMS/Apple Software Update. If it offers you a newer version of Apple Software Update, do it but Deselect any other software offered at the same time. Once done, try another iTunes install
    If you don't find ASU in All Program, go to Control Panel, Add & Remove programs and repair it.

  • New problem with QT Pro, stopped recognizing .mpg sound files (Muxed)

    Have been playing .mpg & .mpeg files just fine with QT Pro. Today I can only get video, no sound output, and the video 'freeze frames' while the progress bar cursor continues to track. This is with ALL .mpg and .mpeg files. Sound is apparently there because the graphic sound visual is active. The freeze frame will start again by clicking the mouse button, or double strike of the spacebar (pause/unpause) but stops again later. All the files play normally in MPlayer. MOV files play fine for both sound and video with QT Pro. No improvement with re-installing QT Pro (new download). FirstAid - no problems. Currently running new version of Disk Warrior over entire disk but don't expect much improvement.

    That may be a problem with the timecode. Try to fix that with the timecode correction menu item. May not work but this is a freeware:Mpeg StreamClip

  • Problem with AR in NewCustomer Interface Program

    I had a problem with importing data into Main Interface tables
    i have created a Staging table
    This r the columns i have selected and inserted data into this Manulley AR_ATPL_SAMPLE_STG(Staging table) from this i have done validations to Import data into Interface tables
    The problem is the data is inserting into RA_CUSTOMERS_INTERFACE_ALL but the columns which belongs to this (CUSTOMER_PROFILE_CLASS_NAME,CREDIT_HOLD) RA_CUSTOMER_PROFILES_INT_ALL(table) is not (data) inserting into this.
    I have done the validations for this tables RA_CUSTOMERS_INTERFACE_ALL,RA_CUSTOMER_PROFILES_INT_ALL
    the data is not inserting and i have deleted the validations which belongs to the RA_CUSTOMER_PROFILES_INT_ALL ,still i am not inserting the data into profiles interface.
    would u plz tell wat the reason is that.
    any columns i have to include.
    RA_CUSTOMERS_INTERFACE_ALL,RA_CUSTOMER_PROFILES_INT_ALL
    CUSTOMER_NAME
    ,orig_system_customer_ref
    ,CUSTOMER_STATUS
    ,SITE_USE_CODE
    ,ORIG_SYSTEM_ADDRESS_REF
    ,ORG_ID
    ,PRIMARY_SITE_USE_FLAG
    ,LOCATION
    ,ADDRESS1
    ,ADDRESS2
    ,ADDRESS3
    ,CITY
    ,STATE
    ,COUNTRY
    ,CUSTOMER_CATEGORY_CODE
    ,CUSTOMER_CLASS_CODE
    ,BILL_TO_ORIG_ADDRESS_REF
    ,INSERT_UPDATE_FLAG
    ,LAST_UPDATED_BY
    ,LAST_UPDATE_DATE
    ,CREATED_BY
    ,CREATION_DATE
    ,CUSTOMER_NUMBER
    ,CUSTOMER_PROFILE_CLASS_NAME
    ,CREDIT_HOLD
    ,STATUS
    ,ERROR_MSG
    BEGIN
    BEGIN
    SELECT COUNT(LOOKUP_CODE)
    INTO v_custcate
    FROM AR_LOOKUPS
    WHERE LOOKUP_TYPE ='CUSTOMER_CATEGORY'
    AND UPPER(lookup_code) = UPPER(r_arstg.customer_category_code);
    IF v_custcate = 0 THEN
    UPDATE ar_atpl_sample_stg
    SET status = 'FAIL',
    error_msg = 'Must Exist in Customer class Category in AR_LOOKUPS'
    WHERE ROWID = r_arstg.rowid;
    COMMIT;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    v_custcate := 0;
    UPDATE ar_atpl_sample_stg
    SET status = 'FAIL',
    error_msg = 'Must Exist in Customer class Category in AR_LOOKUPS'
    WHERE ROWID = r_arstg.rowid;
    COMMIT;
    END;
    BEGIN
    INSERT INTO RA_CUSTOMERS_INTERFACE_ALL
    ( CUSTOMER_NAME
    ,ORIG_SYSTEM_CUSTOMER_REF
    ,CUSTOMER_STATUS
    ,SITE_USE_CODE
    ,ORIG_SYSTEM_ADDRESS_REF
    ,ORG_ID
    ,PRIMARY_SITE_USE_FLAG
    ,LOCATION
    ,ADDRESS1
    ,ADDRESS2
    ,ADDRESS3
    ,CITY
    ,STATE
    ,COUNTRY
    ,CUSTOMER_CATEGORY_CODE
    ,CUSTOMER_CLASS_CODE
    ,BILL_TO_ORIG_ADDRESS_REF
    ,INSERT_UPDATE_FLAG
    ,LAST_UPDATED_BY
    ,LAST_UPDATE_DATE
    ,CREATED_BY
    ,CREATION_DATE
    ,CUSTOMER_NUMBER
    VALUES
    ( r_arstg.CUSTOMER_NAME
    ,r_arstg.ORIG_SYSTEM_CUSTOMER_REF
    ,r_arstg.customer_status
    ,r_arstg.SITE_USE_CODE
    ,r_arstg.ORIG_SYSTEM_ADDRESS_REF
    ,r_arstg.org_id
    ,NVL(r_arstg.PRIMARY_SITE_USE_FLAG,'N')
    ,r_arstg.location
    ,r_arstg.ADDRESS1
    ,r_arstg.ADDRESS2
    ,r_arstg.ADDRESS3
    ,r_arstg.CITY
    ,r_arstg.STATE
    ,r_arstg.COUNTRY
    ,r_arstg.CUSTOMER_CATEGORY_CODE
    ,r_arstg.CUSTOMER_CLASS_CODE
    ,r_arstg.BILL_TO_ORIG_ADDRESS_REF
    ,r_arstg.INSERT_UPDATE_FLAG
    ,-1
    ,SYSDATE
    ,-1
    ,SYSDATE
    ,r_arstg.CUSTOMER_NUMBER
    INSERT INTO RA_CUSTOMER_PROFILES_INT_ALL
    ( ORIG_SYSTEM_CUSTOMER_REF
    ,ORIG_SYSTEM_ADDRESS_REF
    ,INSERT_UPDATE_FLAG
    ,CUSTOMER_PROFILE_CLASS_NAME
    ,CREDIT_HOLD
    ,ORG_ID
    ,LAST_UPDATED_BY
    ,LAST_UPDATE_DATE
    ,CREATED_BY
    ,CREATION_DATE
    VALUES
    ( r_arstg.ORIG_SYSTEM_CUSTOMER_REF
    ,r_arstg.ORIG_SYSTEM_ADDRESS_REF
    ,'I'
    ,r_arstg.CUSTOMER_PROFILE_CLASS_NAME
    ,'N'
    ,r_arstg.ORG_ID
    ,-1
    ,SYSDATE
    ,-1
    ,SYSDATE
    COMMIT;
    END;
    END;
    Thanks in Advance
    Regards
    Seenu

    The problem is that the ZIP file format has not standarized way to handle file name encodings (i.e. there's no standardized way to handle non-ASCII characters).
    Java implemented it in one way and WinZIP/WinRAR implemented it another way.

  • Lenovo x230: Problems with Login and Startup of programs

    Hello,  Lenovo or Lenovo Users 
    I have a few problems with my Lenovo X230 Laptop
    1.
    Every time when i'm pressing Win + L to lock my account for windows. It will go smoothly to the lock screen and when I return to my laptop. And I press ctrl + alt + del  to unlock the laptop it's going to a blue screen and the mouse is still visible and I can move it around. ( The laptop is not crashing it is not a BSOD ) its just go's to a blue screen and then I must restart the Laptop if I want to use it again
    have someone the same issues?  And is there a solution for this problem?
    And i meant the background screen color of qquestion  ( 3. ) with blue screen
    2.
    And when I'm starting a application in Windows 8 and not 8.1  it's starts. And then I will close automatically there our no errors or problems will be displayed in a box or something like that 
    someone have the same problems and is there a solution for this problem?
    3.
    end i have another problem with login in to windows  when i have type in my username and password And then i press enter to login. It will not login it will get stuck on this screen Welcome  and then i must restart the laptop end when i have restarted my laptop it will work perfect    i have this problem only when i have turned af my pc end start him the next day op 
    do someone else have this problem to ? And how do you solved the problem 
    I thought its was maybe a driver issue. But i have update every driver that was available for my laptop
    oke but if someone else have the same issues i want to hear how you have solved you problem because i have 5 laptop with the same issues   
    and i'm thinking to go back to Windows 7 but windows 8 was pre-install on the laptop and i think it's maybe a Windows 8 issues
    and i have another question can Windows 8.1 solve all the problems ?  Because i think Windows 8 i the problem

    Our company also has almost the same problems with our Lenovo 2324CTO series. Any help with the problem please because it might also solve one of the biggest problems for us and it is holding us back with buying new laptops in this series.

  • Problem with a SIMPLE SaveDialog program.. Did I found a Java bug?

    When I run the follower program:
         /** Dialog test */
         public static void main(String args[]) {
              JFileChooser fileChooser = new JFileChooser(new File("Sem nome"));
              fileChooser.addChoosableFileFilter(new JLFileFilter());
              // mostra saveDialog
              int returnVal = fileChooser.showSaveDialog(App.getJFrame());
              // Se confirmado..
              if (returnVal == JFileChooser.APPROVE_OPTION) {
                   System.out.println("OK!");
              } else {
                   System.out.println("Canceled!");
         }it runs ok, but if I run on Eclipse's Debug Mode, I can't see the files and folders on my docs folder in the dialog... why??
    I'm running Windows XP SP3 with JDK6update4
    Edited by: wellington7 on Aug 13, 2008 11:35 AM
    Edited by: wellington7 on Aug 14, 2008 7:30 AM

    Hmmm, not really. Since a Table (ie MyTable) would be part of a larger whole (like inside a JFrame) Only the program that puts all those elements together has to be lunched on the EDT because everything inside that program would, by default, be created there as well.
    public class MyProgram {
         public MyProgram() {
              //all of these will be created on EDT because MyProgram is created there.
              JFrame f = new JFrame();
              JButton b = new JButton("hi");
              JTextField t = new JTextField();
              MyTable tbl = new MyTable();
              //place items on Frame
              f.add(t, BorderLayout.NORTH);
              f.add(b, BorderLayout.CENTER);
              f.add(tbl, BorderLayout.SOUTH);
              //show the window
              f.setVisible(true);
              f.pack();
          * @param args
         public static void main(String[] args) {
              //create MyProgram on EDT
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        new MyProgram();
    }Only the items created, explicitly, inside the main method would need to be created on the EDT.
    -D-

  • Problem with a simple RMI program

    I'm trying to get a simple RMI program to work, by following the instructions in this link:
    http://developer.java.sun.com/developer/technicalArticles/RMI/CreatingApps/index.html#dro
    When it gets to this line:
    Lookup look_obj = (Lookup)Naming.lookup(name);this exception is generated:
    java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
    What's wrong, eh?

    Canadian, eh?
    Looks like your security settings on you computer are set to not allow a socket connection.
    Specifically is is saying that access to port 1099 on your local machine (127.0.0.1 is the loopback address) is being denied.
    There are two main reasons this could happen (off the top of my head), though someone else might know from the message exaclty which one.
    1. Your java security permissions do not allow an out going socket connection (are you writing an applet?)
    2. Your computer protects access to port 1099.

  • Problems with a simple Midlet

    Hi , i'm trying to run a simple Midlet with a list, but appear the following errors:
    Error running executable C:\WTK22\bin\zayit
    java.net.SocketException: No buffer space available (maximum connections reached?): JVM_Bind
         at java.net.PlainSocketImpl.socketBind(Native Method)
         at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
         at java.net.ServerSocket.bind(ServerSocket.java:319)
         at java.net.ServerSocket.<init>(ServerSocket.java:185)
         at java.net.ServerSocket.<init>(ServerSocket.java:97)
         at com.sun.kvem.Lime.runClient(Unknown Source)
         at com.sun.kvem.KVMBridge.runKVM(Unknown Source)
         at com.sun.kvem.KVMBridge.runKVM(Unknown Source)
         at com.sun.kvem.midp.MIDP$4.run(Unknown Source)
    the code of the Midlet is so simple and i don't know what happen.
    i hope that you can help me
    thanks

    the code is:
    package componentes;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    public class InterfazMid extends MIDlet implements CommandListener {
    private Display display;
    private List menu;
    private List lista;
    private TextBox cajaTexto;
    private Form form;
    private DateField campoFecha;
    private Gauge indicador;
    private TextField campoTexto;
    private Ticker ticker;
    private Alert aviso;
    private Image imagen;
    private Command atras;
    private Command menuPrincipal;
    private Command salir;
    String menuActual = null;
    public InterfazMid() {
    form = new Form( "Formulario" );
    indicador = new Gauge( "Indicador",false,50,20 );
    campoTexto = new TextField( "Campo de texto","abc",40,0 );
    ticker = new Ticker( "Componentes de la intefaz MIDP" );
    aviso = new Alert( "Aviso Sonoro" );
    imagen = Image.createImage( "/error.png" );
    } catch( Exception e ) {}
    atras = new Command( "Atr�s",Command.BACK,0 );
    menuPrincipal = new Command( "Men� Ppal",Command.SCREEN,1 );
    salir = new Command( "Salir",Command.STOP,2 );
    protected void startApp() {
    display = Display.getDisplay( this );
    menu = new List( "Interfaz MIDP",Choice.IMPLICIT );
    menu.append( "Caja de texto",null );
    menu.append( "Fecha",null );
    menu.append( "Lista",null );
    menu.append( "Aviso",null );
    menu.append( "Formulario",null );
    menu.addCommand( salir );
    menu.setCommandListener( this );
    menu.setTicker( ticker );
    mainMenu();
    protected void pauseApp() {}
    protected void destroyApp( boolean flag ) {}
    public void mainMenu() {
    menuActual = "Men� Ppal";
    display.setCurrent( menu );
    public void testTextBox() {
    cajaTexto = new TextBox( "Teclea algo:","",10,TextField.ANY );
    cajaTexto.setTicker( new Ticker("Probando TextBox") );
    cajaTexto.addCommand( atras );
    cajaTexto.setCommandListener( this );
    cajaTexto.setString( "ABC" );
    display.setCurrent( cajaTexto );
    menuActual = "texto";
    public void testList() {
    lista = new List( "Seleciona:",Choice.MULTIPLE );
    lista.setTicker( new Ticker("Probando List") );
    lista.addCommand( atras );
    lista.setCommandListener( this );
    lista.append( "Opci�n 1",null );
    lista.append( "Opci�n 2",null );
    lista.append( "Opci�n 3",null );
    lista.append( "Opci�n 4",null );
    display.setCurrent(lista);
    menuActual = "lista";
    public void testAlert() {
    aviso.setType( AlertType.ERROR );
    aviso.setImage( imagen );
    aviso.setString( " ** ERROR **" );
    display.setCurrent( aviso );
    public void testDate() {
    java.util.Date fecha = new java.util.Date();
    campoFecha = new DateField( "Hoy es: ",DateField.DATE );
    campoFecha.setDate( fecha );
    Form f = new Form( "Fecha" );
    f.append( campoFecha );
    f.addCommand( atras );
    f.setCommandListener( this );
    display.setCurrent( f );
    menuActual = "fecha";
    public void testForm() {
    form.append( campoTexto );
    form.append( indicador );
    form.addCommand( atras );
    form.setCommandListener( this );
    display.setCurrent( form );
    menuActual = "form";
    public void commandAction( Command c,Displayable d ) {
    String label = c.getLabel();
    if( label.equals("Salir") ) {
    destroyApp( true );
    notifyDestroyed();
    else if (label.equals("Atr�s")) {
    if( menuActual.equals( "lista" ) ||
    menuActual.equals( "texto" ) ||
    menuActual.equals( "fecha" ) ||
    menuActual.equals( "form" ) ) {
    mainMenu();
    else {
    List l = (List)display.getCurrent();
    switch( l.getSelectedIndex() ) {
    case 0:
    testTextBox();
    break;
    case 1:
    testDate();
    break;
    case 2:
    testList();
    break;
    case 3:
    testAlert();
    break;
    case 4:
    testForm();
    break;
    the code is so simple. i think that the problem is on the j2me wirless toolkit but i don't know.
    thank you
    bye

  • Problem with drivers/ sound stopping / vista32bit/ xfi fatal

    i have an xfi fatality, installed the latest drivers and since then, sound will stop at random times usually happens when i am pausing something on media player (videos) and it might come back when i reopen the video
    sometimes i will watch a video on firefox, and i might not get any sounds at all (sounds completely stop, not only per application)
    sound will come back, on its own, at random times. some times i need to restart
    i uninstalled the audio console, uninstalled the driver from system, and installed the previous version and i am still getting this problem (i wasnt getting it before)
    any solution
    thanks a lot.

    Is there anybody with any idea what the problem might be?

  • Problems with Bootcamp partition solved using program: iPartition

    I Had real BOOTCAMP partition problems:
    1. I couldn’t see the partition in the startup list
    2. I got an error message “missing operating system”
    3. All this was a result of adding an extra Mac partition for Mavericks
    4. I fixed it all with a program called iPartition from “Coriolis Systems” in the United Kingdom!!!!!!!!!!!!!

    Well, you're not alone. Many other users are having the same problem,and it appears that Apple is ignoring the problem. I bought my iMac 27" in June 2010 and installed Bootcamp 3.1 running Windows 7. About every other reboot the gray screen will freeze during bootup and I have to do a hard reboot. Sometimes I get the Disk Read Failure. It is very, very frustrating. The only reason I bought the iMac 27" is that I like the look of it and the big screen; I have no desire to switch to a Mac, as I have too much money invested in Windows development software. I've installed multiple dual-boot systems in other non-Mac systems and never had any problems. I hope Apple stops ignoring the problem and comes out with a fix real soon.

Maybe you are looking for

  • My ipod touch 4th gen wont sync with itunes 11

    My ipod touch 4th gen wont sync with itunes 11, keeps getting so far then times out. Ive tried resetting it but doesnt seem to help.

  • Window for selection file in a filesystem

    Hi, I am looking for a class which would allow me to select a file on my filesystem (with somwe window). Any idea ? Sincerely, Olivier Matt

  • PURCHASED iTUNES NOT AUTHORIZED FOR DIGITAL EXPORT

    I am trying in vein to burn the songs I have bought in the iTunes store to a CD so I can play them in my car. However they come with a small padlock symbol in the top left corner. If I try to burn them onto a CD, a message comes up saying the song is

  • If I delete iTunes on my computer ...

    I have a problem with iTunes on my computer. It won't let me open iTunes saying I am missing some file. So, I tried to fix it but it still won't work. I want to delete iTunes and then install it again. Will this make me lose all my music??

  • Server update 2.2.5 still showing in AppStore Updates

    Hi OS X 10.8.5 with Server  I've installed the server 2.2.5 update but AppStore still shows it as an available update.  Restarted the system, same result.  Does this mean that the update hasn't installed correctly or is it just an error in AppStore?