Program does not Work

I have a for loop in which I am reading the content of an array.Also a method is called within the for loop the purpose of this method is to be able to jump to a another array index.
I have written the program as shown below but it does not work.
private class Executionionhandler implements ActionListener
{ public void actionPerformed(ActionEvent event)
{ for(int i=0;i<62;i++)
{ int x=array[i];
int k=x+2;
look(x);
public void look(int j)
{ if(j==0)
button.setText(�Readyl�);
else if(j=1)
button.setText(�Go�);
else if(j=2)
button.setText(�Stop�);
else if(j==5)
i=20;
else button.setText(�Successful�);
Any idea why or how can I achieve this?

http://forum.java.sun.com/thread.jsp?thread=265406&forum=31&message=1006380
http://forum.java.sun.com/thread.jsp?thread=265328&forum=31&message=1006048
http://forum.java.sun.com/thread.jsp?thread=265310&forum=31&message=1005982
http://forum.java.sun.com/thread.jsp?thread=265307&forum=31&message=1005979
http://forum.java.sun.com/thread.jsp?thread=265307&forum=31&message=1005969

Similar Messages

  • TS1702 Maps program does not work. In standard it only shows a grid. If I ask for a route it shows start and end point and three route boxes but nothing else. It does show directions. If I switch to hybrid it shows to routes but no roads. Background is a

    Maps program does not work. In standard it only shows a grid. If I ask for a route it shows start and end point and three route boxes but nothing else. It does show directions. If I switch to hybrid it shows to routes but no roads. Background is a blur.

    Do you have a question? This is a user to user help forum. Apple is not here only other users like yourself. You don't report problems to Apple here.
    By the way, it might help if you indicated where you are located.
    To complain to Apple use http://www.apple.com/feedback/ipad.html

  • I just signed up for a subscription to adobe reader paying EUR 24.40. The program does not work, and I can not even go to my personal page .... help ...?

    I just signed up for a subscription to adobe reader paying EUR 24.40.
    The program does not work, and I can not even go to my personal page .... help ...?

    Adobe Reader is free; it does not require a subscription.
    Did you subscribe to an online service like ExportPDF, PDF Pack, ...?
    What exactly does "not work" mean?

  • Hello Since yesterday evening. My itunse program does not work my mobile. Note  I update the program to ios7 Please help me Thank you

    hi
    Hello
    Since yesterday evening. My itunse program does not work my mobile.
    Note
    I update the program to ios7
    Please help me
    Thank you

    I found this strange glitch that wouldn't let me open my iTunes Store. I tried all the reset options and still iTunes would close a second after it opened. I fixed this. Instead of using the iTunes Store icon on your home page to open it. Go into music and click on store. It will say "Cannot Connect To Store". Just tap ok. Then tap on "featured" on the bottom of the screen. That will take you to the store front page. After that is loaded. Back out and the icon for iTunes Store on the home page should work just fine. Hope that helps.

  • I purchased a program on Mac App store and the program does not act as it should,  also was required to pay up front whereas had I went to the web site, ibank 4 I would have had 30 days free trial an would have found that the program does not work.?

    I purchased a program on Mac App store and the program does not act as it should,  also was required to pay up front whereas had I went to the web site, ibank 4 I would have had 30 days free trial an would have found that the program does not work.?

    Free trials are not available through the Mac App Store.
    Apple is not here. Apple does not answer questions here. This is a user to user support forum. There are only folks here who use Apple products.

  • Now a few of programs does not work with mountian lion. what to do?

    now a few of programs does not work with mountian lion. what to do?

    espons printer/scanner, toast titanum 5.2.1, intuos 4 wacom, appleworks, already updated ms office & order the upgrade for reunion which I hope it will work. 
    thank you mr michael allbritton for your help!

  • My program does not work properly. I run the program but it is not capable of adding any of my ebooks and when I connect my ereader, it recognises the device but  it does not add any ebook either.  I uninstalled the program and reinstalled again but nothi

    my program does not work properly. I run the program but it is not capable of adding any of my ebooks and when I connect my ereader, it recognises the device but  it does not add any ebook either.
    I uninstalled the program and reinstalled again but nothing gone better-
    What should I do?
    Best regards

    Do you have Logitech gaming software installed on the PC? If so, perhaps try the suggestion from the following post:
    Re: Everytime I close Itunes it loads back up

  • Program does not work after build

    Hi,
    I have built a program today that builds fine (no errors or warnings) but it fails when running the exe.  I am using drivers for a spectrum analyzer (Rohde & Schwarz FSG) and when one of these drivers is called, it returns an error.  Other drivers are run before this particular vi.  Anyone have any idea how to troubleshoot this?  I'm going to try and build the vi on its own and see if it works.  In the mean time, if anyone has any suggestions, please let me know.
    UPDATE: I built the file on its own and it still does not work.  Again, when I run it in developer mode, it works fine.
    VISA Write in rsspecan_core_write.vi->rsspecan_core_attribute_wr​ite_int.vi:3->subrsspecan_core_attribute_express.v​i:2->rsspecan Configure Averaging Type.vi:Instance:Instance           1 41Saved   rsspecan Configure Averaging Type .vi:1->rsspecan Configure Averaging Type.vi
    Thanks.

    I've decided to post the vi since it is free to download.  If anyone has an FSG and wants to build this file and see if they can run it, please do so.
    Attachments:
    rsspecan Configure Averaging Type.vi ‏31 KB

  • Encryption program does not work in IBM JDK

    Hi
    I have a encrypt, decrypt program, which does not work in IBM JDK
    the code is as below, it gives PBEWithMD5AndDES does not exist kind of error when running with IBM JDK
    import java.io.UnsupportedEncodingException;
    import java.security.spec.AlgorithmParameterSpec;
    import java.security.spec.KeySpec;
    import javax.crypto.Cipher;
    import javax.crypto.IllegalBlockSizeException;
    import javax.crypto.SecretKey;
    import javax.crypto.SecretKeyFactory;
    import javax.crypto.spec.PBEKeySpec;
    import javax.crypto.spec.PBEParameterSpec;
    public class MapsPasswordUtil
         Cipher ecipher;
         Cipher dcipher;
         // 8-byte Salt
         byte[] salt = { (byte) 0xA9, (byte) 0x9B, (byte) 0xC8, (byte) 0x32,
                   (byte) 0x56, (byte) 0x35, (byte) 0xE3, (byte) 0x03 };
         // Iteration count
         int iterationCount = 19;
         public MapsPasswordUtil(String passPhrase)
              try
                   KeySpec keySpec = new PBEKeySpec(passPhrase.toCharArray(), salt,
                             iterationCount);
                   SecretKey key = SecretKeyFactory.getInstance("PBEWithMD5AndDES")
                             .generateSecret(keySpec);
                   ecipher = Cipher.getInstance(key.getAlgorithm());
                   dcipher = Cipher.getInstance(key.getAlgorithm());
                   // Prepare the parameter to the ciphers
                   AlgorithmParameterSpec paramSpec = new PBEParameterSpec(salt,
                             iterationCount);
                   // Create the ciphers
                   ecipher.init(Cipher.ENCRYPT_MODE, key, paramSpec);
                   dcipher.init(Cipher.DECRYPT_MODE, key, paramSpec);
              } catch (java.security.InvalidAlgorithmParameterException e)
                   e.printStackTrace();
              } catch (java.security.spec.InvalidKeySpecException e)
                   e.printStackTrace();
              } catch (javax.crypto.NoSuchPaddingException e)
                   e.printStackTrace();
              } catch (java.security.NoSuchAlgorithmException e)
                   e.printStackTrace();
              } catch (java.security.InvalidKeyException e)
                   e.printStackTrace();
         public String encrypt(String str)
              try
                   // Encode the string into bytes using utf-8
                   byte[] utf8 = str.getBytes("UTF8");
                   // Encrypt
                   byte[] enc = ecipher.doFinal(utf8);
                   // Encode bytes to base64 to get a string
                   return new sun.misc.BASE64Encoder().encode(enc);
              } catch (javax.crypto.BadPaddingException e)
                   e.printStackTrace();
              } catch (IllegalBlockSizeException e)
                   e.printStackTrace();
              } catch (UnsupportedEncodingException e)
                   e.printStackTrace();
              return null;
         public String decrypt(String str)
              try
                   // Decode base64 to get bytes
                   byte[] dec = new sun.misc.BASE64Decoder().decodeBuffer(str);
                   // Decrypt
                   byte[] utf8 = dcipher.doFinal(dec);
                   // Decode using utf-8
                   return new String(utf8, "UTF8");
              } catch (javax.crypto.BadPaddingException e)
                   e.printStackTrace();
              } catch (IllegalBlockSizeException e)
                   e.printStackTrace();
              } catch (UnsupportedEncodingException e)
                   e.printStackTrace();
              } catch (java.io.IOException e)
                   e.printStackTrace();
              return null;
    }

    Works for me with the latest IBM JDK. You will need to specify your context i.e. what platform, what JDK/JRE etc etc etc.
    P.S. That exception handling is rubbish.
    Edited by: sabre150 on Mar 23, 2009 6:01 AM
    I suspect that you are using JDK 1.5 and that you have fallen foul of the bug where key.getAlgorithm() does net return the correct value. You get round this by specifying it as             SecretKey key = SecretKeyFactory.getInstance("PBEWithMD5AndDES").generateSecret(keySpec);
                ecipher = Cipher.getInstance("PBEWithMD5AndDES");Of course if you are clever you will just define a static final constant for this algorithm.
    Edited by: sabre150 on Mar 23, 2009 6:09 AM

  • My java programe does not work

    Hi
    I createda java programme with jdeveloper . I compiled my code in all of version (1.3, 1.4, 1.5, 1.6 and default).
    But when i try to run my programme in other computers that have j2SE Runtime Environment 5.0 update 11, or java Runtime 2 Environment SE 1.3 - 1.4,
    my programme doesnot work.
    how can i fix this problem.

    Which Jdev version?
    What exactly do you mean by 'does not work'?
    Timo

  • File concatenating program does not work

    Hello, im quite new to java therefore it may only be a simple solution.
    The program reads mulitple files off the command line and then should join them up (concatenate) in a new file called "NewFile".
    The problem is it only prints the content of one of the files to the new file.
    Here is my code:
    /*Write an application which concatenates files. The name of
    *each file is supplied on the command line. The output file
    *consists of all the contents of the first file, followed by
    *all the contents of the second file, and so on. One of the
    *slides in the lecture may help.
    import java.util.*;
    import java.io.*;
    public class Concatenate
         public void process (String[] argStrings) throws Exception
              String fileName = argStrings[0];
              String contents = null;
              System.out.println();
              System.out.println("Conatenated contents of files:");
              System.out.println();
              for (int index = 0; index < argStrings.length; index++)
                   Scanner sc = new Scanner(new File(argStrings[index]));
                   contents = sc.nextLine();
                System.out.println(contents);
                   sc.close();
              PrintStream output = new PrintStream("NewFile.txt");
              output.println(contents);
            output.close();
    }Thanks anyone
    John

    // put this before the for loop
    PrintStream output = new PrintStream("NewFile.txt");
    // put this inside the for loop
    output.println(contents);Now, do you understand why you have to do that?

  • A serial number I received as part of my school program does not work.

    what do I need to do?

    Have you submitted your proof of eligibility?  If so please see http://forums.adobe.com/message/4635085#4635085.

  • This program is well compiled but does not work.

    I would like to know why this program does not work properly:
    the idea is :
    1. the user introduces a text as a string
    2.the progam creates a file (with a FileOutputStream)
    3. then this file is encripted according to DES (using JCE, cipheroutputStream)
    4.the new filw is an encripte file, whose content is introduced in a string (with a FileInputStream)
    (gives no probles of compilation!!)
    (don know why it does not work)
    here goes the code:
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.io.*;
    import java.security.*;
    import javax.crypto.*;
    public class cuadro extends Applet{
         private TextArea area1 =new TextArea(5,50);
         private TextArea area2 =new TextArea(5,50);
         private Button encriptar=new Button("encriptar");
         private Button decriptar=new Button("decriptar");
         public cuadro(){
              layoutApplet();
              encriptar.addActionListener(new ButtonHandler());
              decriptar.addActionListener(new ButtonHandler());
              resize(400,400);
              private void layoutApplet(){
              Panel keyPanel = new Panel();
              keyPanel.add(encriptar);
              keyPanel.add(decriptar);
              Panel textPanel = new Panel();
              Panel texto1 = new Panel();
              Panel texto2 = new Panel();
              texto1.add(new Label("               plain text"));
              texto1.add(area1);
              texto2.add(new Label("               cipher text"));
              texto2.add(area2);
              textPanel.setLayout(new GridLayout(2,1));
              textPanel.add(texto1);
              textPanel.add(texto2);
              setLayout(new BorderLayout());
              add("North", keyPanel);
              add("Center", textPanel);
              public static String encriptar(String text1){
              //generar una clave
              SecretKey clave=null;
              String text2="";
              try{
              FileOutputStream fs =new FileOutputStream ("c:/javasoft/ti.txt");
              DataOutputStream es= new DataOutputStream(fs);
                   for(int i=0;i<text1.length();++i){
                        int j=text1.charAt(i);
                        es.write(j);
                   es.close();
              }catch(IOException e){
                   System.out.println("no funciona escritura");
              }catch(SecurityException e){
                   System.out.println("el fichero existe pero es un directorio");
              try{
                   //existe archivo DESkey.ser?
                   ObjectInputStream claveFich =new ObjectInputStream(new FileInputStream ("DESKey.ser"));
                   clave = (SecretKey) claveFich.readObject();
                   claveFich.close();
              }catch(FileNotFoundException e){
                   System.out.println("creando DESkey.ser");
                   //si no, generar generar y guardar clave nueva
              try{
                   KeyGenerator claveGen = KeyGenerator.getInstance("DES");
                   clave= claveGen.generateKey();
                   ObjectOutputStream claveFich = new ObjectOutputStream(new FileOutputStream("DESKey.ser"));
                   claveFich.writeObject(clave);
                   claveFich.close();
              }catch(NoSuchAlgorithmException ex){
                   System.out.println("DES key Generator no encontrado.");
                   System.exit(0);
              }catch(IOException ex){
                   System.out.println("error al salvar la clave");
                   System.exit(0);
         }catch(Exception e){
              System.out.println("error leyendo clave");
              System.exit(0);
         //crear una cifra
         Cipher cifra = null;
         try{
              cifra= Cipher.getInstance("DES/ECB/PKCS5Padding");
              cifra.init(Cipher.ENCRYPT_MODE,clave);
         }catch(InvalidKeyException e){
              System.out.println("clave no valida");
              System.exit(0);
         }catch(Exception e){
              System.out.println("error creando cifra");
              System.exit(0);
         //leer y encriptar el archivo
         try{
              DataInputStream in = new DataInputStream(new FileInputStream("c:/javasoft/ti.txt"));
              CipherOutputStream out = new CipherOutputStream(new DataOutputStream(new FileOutputStream("c:/javasoft/t.txt")),cifra);
              int i;
              do{
                   i=in.read();
                   if(i!=-1) out.write(i);
              }while (i!=-1);
              in.close();
              out.close();
         }catch(IOException e){
              System.out.println("error en lectura y encriptacion");
              System.exit(0);
         try{
              FileInputStream fe=new FileInputStream("c:/javasoft/t.txt");
              DataInputStream le =new DataInputStream(fe);
                   int i;
                   char c;
                   do{
                        i=le.read();
                        c= (char)i;
                        if(i!=-1){
                        text2 += text2.valueOf(c);
                   }while(i!=-1);
                        le.close();
              /*}catch(FileNotFoundException e){
                   System.out.println("fichero no encontrado");
                   System.exit(0);
              }catch(ClassNotFoundException e){
                   System.out.println("clase no encontrada");
                   System.exit(0);
              */}catch(IOException e){
                   System.out.println("error e/s");
                   System.exit(0);
              return text2;
         class ButtonHandler implements ActionListener{
         public void actionPerformed(ActionEvent e){
              try{
              if (e.getActionCommand().equals(encriptar.getLabel()))
                   //     area2.setText(t1)
                   area2.setText(encriptar(area1.getText()));
                   //area2.setText("escribe algo");
                   else if (e.getActionCommand().equals(decriptar.getLabel()))
                        System.out.println("esto es decriptar");
                        //area2.setText("hola");
         }catch(Exception ex){
              System.out.println("error en motor de encriptacion");
                   //else System.out.println("no coge el boton encriptado/decript");

    If you don't require your code to run as an applet, you will probably get more mileage from refactoring it to run as an application.
    As sudha_mp implied, an unsigned applet will fail on the line
    FileInputStream fe=new FileInputStream("c:/javasoft/t.txt");
    due to security restrictions. (Which, incidentally, are there for a very good reason)

  • Can not type in the body of email program & reply button does not work.

    I installed 10.4 (Family Pack) on my G4 400 and after a few days the email program does not work as it originally did. The reply button no longer works. (It did for a few days.) Additionally on a new mail or mail forward. I can not type in the body of the email after the first word. It just beebs at me. (It did work as normal for a few days.) I can still receive and can send mail. I have also installed this Family pack on my iMac flat panel G4 and have no mail problems. That mac is about 200 mile from this location. Before I installed 10.4 I was using 10.3.9 and mail was ok. I use high speed internet with the iMac and use dialup with the G4.

    I've lost track of what computer you have where, and I don't understand why you keep installing buggy OS X 10.4.0 on systems that worked fine under OS X 10.3.9, without being able to update to install system updates afterwards.
    That said, you may want to look at this web site for general Mac OS X troubleshooting tips:
    http://www.thexlab.com/faqs/faqs.html
    In particular, since I know of other people with the same problem as you that fixed it deleting caches, you may want lo look these two pages:
    Resolving Disk, Permission, and Cache Corruption
    Side effects of System cache cleaning
    In addition to some utilities mentioned there for cache cleaning, you may also consider OnyX, if for no other reason, because it's free:
    http://www.titanium.free.fr/
    Although utilities such as OnyX allow you to clean many caches with just a click of the mouse, I'd recommend to be as selective as possible and clean them up one at a time, to try to identify which exactly is causing your problems, if any. This information, in turn, could be useful for other users. I'm pretty sure some Mail problems are related to cache issues, but I don't yet know which cache exactly is the culprit here (since it was not the Mail cache, I would say that the fonts cache should be next in the list).

  • Lenovo System Update 5 does not work on my B580

    Hello,
    the Lenovo System Update 5 program does not work on my B580 laptop.
    After 16% of the status bar the program says "there are no packages for your PC".
    That can't be true, because i haven't installed all drivers and programs.
    I got .NET Framework 4 on my laptop.
    What will solve the problem?
    Greetings from germany
    MAD3000

    i also have the same problem with my B480

Maybe you are looking for

  • Ldap problem, ORA-06521: PL/SQL: Error mapping function

    I am getting this error(s) ORA-06521: PL/SQL: Error mapping function ORA-06512: at "SYS.DBMS_LDAP_API_FFI", line 0 ORA-06512: at "SYS.DBMS_LDAP", line 1338 ORA-06512: at "SYS.DBMS_LDAP", line 1273 ORA-06512: at "SYS.DBMS_LDAP", line 529 ORA-06512: at

  • Disk is too slow or System Overload. (-10009)

    Hello all, I'm running a G4 PowerBook, with 1.67 GHz, and 1.5 GB DDR SDRAM. My Logic set-up is Logic Pro 7 and a Motu 828mkII. My present Logic project contains 7 tracks, with EXS24 through 6 tracks and Sculpture through the last. The instruments wer

  • How is the address selected in the Customer Account Statement (F.27)?

    Hi expert, The customer account statement (transaction F.27) uses the address which is in the customer master data. This is the customer master data on the company code level (Street, postal code, city). Is it possible to select the PO address (PO bo

  • LDAP Users and Groups

    Hi, <p> I have configured an LDAP Authenticator for an external LDAP directory in the security realm of the samples portal. User Management is working, but when I try to access the Group Management for the LDAP Authenticator I get the following error

  • Failure to Uninstall PC suite

    Hi I may be missing something in the other discussions on this topic. My situation is that I want to update PC suite and am getting a message to unistall the previous version. However the Unistall logo has a red cross through it and does not work. I