Problem in terminating the program

hi,
in the following code, the paint method is executing always and the prog is not terminating, i need to call the method cycles and get the value returned and process it in the paint method.
but the method paint is not terminating,
can u help me to solve the problem
import java.io.*;
import java.util.*;
import java.awt.*;
import java.lang.*;
public class wheel1 extends Frame{
    int cen1 =250;
    int cen2 =250;
    int r  =200;
    int c1 = cen1 - r;
    int c2 = cen2 - r;
    double a = (100 * Math.PI)/180 ;
    String description = "Total Residues";                  String Coloring = "Residues by Color";
    String alip = "No. of Aliphatic Aminoacids   =";        String aliph = "Aliphatic Aminoacids";
    String arom = "No. of Aromatic  Aminoacids  =";         String aroma = "Aromatic  Aminoacids";
    String pola = "No. of Polar     Aminoacids   =";        String polar = "Polar     Aminoacids";
    String acid = "No. of Acidic    Aminoacids   =";        String acidi = "Acidic    Aminoacids";
    String basi = "No. of Basic     Aminoacids   =";        String basic = "Basic     Aminoacids";
    String uniq = "No. of Unique    Aminoacids   =";        String uniqu = "Unique    Aminoacids";
    int ali,aro,pol,aci,bas,uni = 0;
    String al,ar,po,ac,ba,un;
    //processing the sequence
    String sequence = readsequence();
    char[] seq1 = sequence.toCharArray();
    int len = seq1.length;
    int cycle;
    int[] c = new int[6];
    double[] x = new double[len +1];
    double[] y = new double[len +1];
    int[] X = new int[len +1];
    int[] Y = new int[len +1];
    String leng =Integer.toString(len);
    public wheel1() {
        super("wheel1");
        setSize(1350, 1350);
        repaint();
    public String readsequence(){
        String residues ="";
        try{
            // FileReader f = new FileReader("fasta.txt");
            InputStreamReader isr = new  InputStreamReader(System.in);
            BufferedReader fasta = new BufferedReader(isr);
            System.out.println("Maximum Length of the sequence for wheel is 108");
            System.out.println("Enter the sequence :");
            residues = fasta.readLine();
            residues = fasta.readLine();
//            do{
//            sequence= fasta.readLine();
//            sequence += sequence;
//            }while(sequence!=null);
        }catch(Exception e) {
            //System.err.println(e.getMessage());
            e.printStackTrace();
        return residues;
    public int cycles(){
        String cyc = "";
        cycle = len/18;
        int cycleno = 0;
        //int temp = 0;
        char cywh = ' ';
        System.out.println("Possible No of cycles :"+cycle);
        try{
            InputStreamReader isr1 = new  InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr1);
            System.out.println("Enter the cycle no required as character");
            System.out.println("For cycle 1 press o");
            System.out.println("For cycle 2 press t");
            System.out.println("For cycle 3 press h");
            System.out.println("For cycle 4 press f");
            System.out.println("For cycle 5 press i");
            System.out.println("For cycle 6 press s");
            cyc = br.readLine();
            char[] cywheel = cyc.toCharArray();
            cywh = cywheel[0];
            //cycleno = Integer.parseInt(cyc);
        } catch(IOException e){
            e.printStackTrace();
        //if(cycle >= 0) {
        //temp = cycle;
        for(int i = 0; i<=cycle; i++){
            if(cycle<0){
                c[i] =cycle;
                cycle --;
                //i++;
                System.out.println("i and cycle is :"+i+ "  " +cycle);
        switch (cywh){
            case 'o':
                //repaint();
                System.out.println("REACH");
                break;
            case 't':
                cycleno = 1*18;
                System.out.println("REACH");
                //repaint();
                break;
            case 'h':
                cycleno = 2*18;
                System.out.println("REACH");
                //repaint();
                break;
            case 'f':
                cycleno = 3*18;
                System.out.println("REACH");
                //repaint();
                break;
            case 'i':
                cycleno = 4*18;
                System.out.println("REACH");
                //repaint();
                break;
            case 's':
                cycleno = 5*18;
                System.out.println("REACH");
                //repaint();
                break;
        return cycleno;
    public void paint(Graphics seq){
        System.out.println("Length of the sequence is :"+len);
        seq.drawOval(c1 ,c2, 2*(r),2*(r));
        int cy = cycles();
        int a = cy;
        //System.out.println("cycle no :"+cy);
        int destiny = cy +18;
        System.out.println("cy and destiny is :"+cy + "  "+destiny);
        for(int cycle =a; cycle < destiny; cycle++) {
            System.out.println("cycle is :"+cycle);
            x[cycle] = cen1 + (r+7) * Math.cos(a *cycle);
            y[cycle] = cen2 + (r+7) * Math.sin(a *cycle);
            X[cycle] = (int)x[cycle];
            Y[cycle] = (int)y[cycle];
            //for different colors
            switch(seq1[cycle]) {
                //aliphatic residues
                case 'A' :
                case 'I' :
                case 'L' :
                case 'V' :
                    ali++;
                    seq.setColor(Color.cyan);
                    break;
                //aromatic residues
                case 'F' :
                case 'W' :
                case 'Y' :
                    aro++;
                    seq.setColor(Color.YELLOW);
                    break;
                //polar residues
                case 'N' :
                case 'C' :
                case 'Q' :
                case 'M' :
                case 'S' :
                case 'T' :
                    pol++;
                    seq.setColor(Color.BLUE);
                    break;
                //acidic residues
                case 'D' :
                case 'E' :
                    aci++;
                    seq.setColor(Color.MAGENTA);
                    break;
                //basic residues
                case 'R' :
                case 'H' :
                case 'K' :
                    bas++;
                    seq.setColor(Color.green);
                    break;
                //unique residues
                case 'G' :
                case 'P' :
                    uni++;
                    seq.setColor(Color.orange);
                    break;
                default:
                    seq.setColor(Color.black);
                    break;
            al = Integer.toString(ali);
            un = Integer.toString(uni);
            ba = Integer.toString(bas);
            ac = Integer.toString(aci);
            po = Integer.toString(pol);
            ar = Integer.toString(aro);
            seq.fillOval(X[cycle]-8,Y[cycle]-8,16,16);
            seq.setColor(Color.BLACK);
            seq.drawString(seq1[cycle]+"",X[cycle],Y[cycle]-9);
    public static void main(String args[]) {
        wheel1 wheel = new wheel1();
        wheel.show();
}

paint() is calling cycles(), cycles() is asking the command prompt for input.
Is this a GUI app or not?
Work out what you want to do and then write code that does it.

Similar Messages

  • Blackberry Desktop Software has stopped working. A problem has caused the program to stop...

    I have a Tour 9630 and just installed v6.0 and receiving an error window "Blackberry Desktop Software has stopped working. A problem as caused the program to stop working correctly.  Windows will close the program and notify you if a solution is available."  I have not received any message from Windows after 2 days.  Has anyone experienced this problem?  If so, I would appreciate any guidance.  I have Windows 7, if that matters. Thank you. in advance.

    Hi somewhatstock
    How far did you get with them? Did they have any ideas what might be causing the problem? Trying to work on it myself, so trying to eliminate what others might have tried. Curious why it works on my Desktop however. Losing tethering really causes problems as I rely on tethering with my laptop quite a lot.  
    Any information most welcome,
    regards,
    John

  • Windows 8 - Photoshop CS5.1 crashes upon startup. Error message: "Adobe Photoshop CS5.1 has stopped working.A problem caused by the program to stop working correctly. Windows will close the program and notify you if a solution is available."

    Hello!
    I've had the student version of the Adobe Creative Suite 5.5 Design Premium software for several years now.
    When I received my Windows 8 computer I installed the software with no issue.
    Last week when I tried opening Photoshop I get the following error: "Adobe Photoshop CS5.1 has stopped working.A problem caused by the program to stop working correctly. Windows will close the program and notify you if a solution is available."
    I deactivated and uninstalled the entire Creative Suite then reinstalled it. I am able to open the other programs, but still receive the same message for Photoshop.
    What can I do?

    I found the issue was with the Nik Filters I was using. The filters were messing with Photoshop's initializing. I uninstalled and reinstalled the filters and now Photoshop works like a charm.
    It appears this forum is dead?!
    Thankfully, I was able to troubleshoot on my own and figured out the problem...

  • ITunes keeps shutting down when I open it up.  The message says iTunes has stopped working.  A problem has caused the program to stop working correctly.  Windows will close the program and notify you if a solutions is found.

    iTunes keeps shutting down when I open it up.  The message says iTunes has stopped working.  A problem has caused the program to stop working correctly.  Windows will close the program and notify you if a solutions is found.

    For general advice see Troubleshooting issues with iTunes for Windows updates.
    The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down the page in case one of them applies.
    Your library should be unaffected by these steps but there is backup and recovery advice elsewhere in the user tip.
    If you've already tried something like the above then try opening iTunes in safe mode (press and hold down CTRL+SHIFT as you start iTunes) then going to Edit > Preferences > Store and turning off Show iTunes in the Cloud Purchases. You may find that iTunes opens normally now.
    tt2

  • PSE 8 problems to start the program

    Hello!
    Just download the PSE8 today and I can´t get it launched? The edit-program start but the organixer doesn´t. Either I can´t launched the share-programs or the program to make albums.
    Someone out there who can help me?
    SE-MJA

    Hello!
    I got the same result.
    The program can´t launch the "read in workspace for Elements Oganizer". It´s try to launch but be freeze and then nothing happens.
    It´s bad because I think the program was good. Now I think I will reclaime the produvt and get my money back.
    Regards!
    Micke
    Date: Wed, 7 Apr 2010 04:22:09 -0600
    From: [email protected]
    To: [email protected]
    Subject: PSE 8 problems to start the program
    Have you located the program file to ensure it is properly installed?.
    If not, click on the start button and type PhotoshopElementsEditor.exe (note caps and no spaces) into the search box.
    The program, if available, should appear with a blue PSE icon in the search results.
    Right click on it and select send to desktop.
    Then try to open the editor from the desktop by clicking on the icon.
    >

  • FROM WINDOWS (VISTA) A PROBLEM HAS CAUSED THE PROGRAM TO STOP WORKING CORRECTLY. WINDOWS WILL CLOSE THIS PROGRAM AND NOTIFY YOU IF THERE IS A SOLUTION. FIRE FOX UPDATED TO THE LATEEST, I WOULD RATHER NOT HAVE AUTO UPDATES.

    FROM WINDOWS (VISTA) A PROBLEM HAS CAUSED THE PROGRAM TO STOP WORKING CORRECTLY. WINDOWS WILL CLOSE THIS PROGRAM AND NOTIFY YOU IF THERE IS A SOLUTION. UPDATED TO THE LATEEST, I WOULD RATHER NOT HAVE AUTO UPDATES. [email protected] edit

    You may select how and whether Firefox updates, although like most software it may be sensible to keep it up-to-date, it is more likely to remain secure and compatible with other software whilst up to date.
    * for information on the options available see [[Updating firefox]] <--- clickable link ---

  • Problem with loading the program

    Hi Guys,
    I have a huge dilemma. I am trying to get re-acquainted with dvd studio pro and I need to fast for some freelance work I've had come up. I had a problem loading the the idvd onto my computer and I had to delete a bunch of the files to get it to work properly and for some reason I believe its affected dvd studio. Everytime I open it, it tells me it cannot find this file that I deleted a long time ago, and I don't even care about it, I just want to start a new project. But then the "can't find" bubble will not go away and I end up having to force quit the program. I have tried deleting the file that it is trying to open and I have tried re-installing the software to no avail. Please, any help would be very much appreciated. Thanks so much!

    This problem just showed up for me as well. I have an imac 27" with the latest Leopard software. I have used Soundtrack (NOT Pro) with this computer and software many times, so it is not an "old software" problem. It will simply no longer open. The only thing that has changed recently was a software update that I accepted (like most everyone else does) a few days ago.
    I have deleted and reinstalled the software several times, along with Repair Permissions, etc., etc. Nothing working yet...this thing was really out of the blue. My next step is to use a "Final Cut Express Remover" program I found on the Internet that will remove all associated files (a complete uninstall) in case something I did not remove is causing the problem. I still suspect that software update, but don't know how to "undo" it, without losing other stuff via Time Machine.

  • I keep getting an error message saying a problem has cause the program to work incorrectly.

    Every time I try to connect to itunes, I get an error message saying a problem cause the program to work incorrectly. I am on a desktop and trying to download songs and a movie that I purchase on my ipad mini.

    Hi EmilioB,
    Thanks for visiting Apple Support Communities.
    If iTunes is not working or quitting unexpectedly, see this link for troubleshooting steps that can help:
    iTunes for Windows Vista, Windows 7, or Windows 8: Fix unexpected quits or launch issues
    http://support.apple.com/kb/ts1717
    If the iTunes application is working, but you cannot connect to the iTunes Store, try the steps in this article:
    Can't connect to the iTunes Store
    http://support.apple.com/kb/ts1368
    All the best,
    Jeremy

  • I have a problem in processing the program in background

    Hi,
    We have cloned the T'code V_V2 and added some additional functionality and when we try to run the program in background the error is blocking the process
    This is because, say example i am tring to process the sales order in production systen through my program ,in that time some one may chage the sales document . in trhis case my program should not blocked it should check the block before processing and then it should proceed.
    is there any FM to find the blocked sales order.
    Regards,
    Vijay

    Try using the FM:
    ENQUE_READ2
    Passing the follwing values:
    GNAME --> VBAK (Sales Order header table)
    GARG   --> The lock argument
                       (This will be a combination of client number anb Sales Order No.
                        Eg: '3001210000054' where the first three digit i,e 300 is the client No
                       and 1210000054 is the sales order no.)
    Regards,
    Firoz.

  • HOW CAN YOU END A PROGRAM within the program??? (TERMINATING THE PROGRAM)

    I want my program to end if it encounters a certain string... i tried break.. but that doesn't do the job.. that just ends a loop... how can i end the program.. and maybe display a message such as "ERROR: Incorrect Input - Program will now terminate"...
    Thanks in adavnace

    thanks.. it works perfectly!

  • PROBLEMS ---KOBED_600" of the program "SAPLV61N'

    We are trying to transport some orders from one client to the other and when we do and try to process the Sales Order after we want to process it it appears to have a problem with the bonifications becuase it does not want to follow trhough --- the following reads after we get the problem
    The current ABAP program "SAPLV61Z" had to be terminated because it ha
    come across a statement that unfortunately cannot be executed.
    or
    Error in the SAP kernel.
    The current ABAP "SAPLV61Z" program had to be terminated because the
    ABAP processor detected an internal system error.
    CX_SY_DYN_CALL_ILLEGAL_FORM
    SD_COND_DETERMINATION" "(FUNCTION)"
    Would Like some help trying to resolve it
    << Removed >>
    and THKS VERY MUCH
    Edited by: Rob Burbank on Jul 31, 2010 8:42 PM

    Looks like you do not have form KOBED_600 or it is not active.  Based on the function group name SAPLV61N, I am assuming this is a problem in the free goods area.
    Try this:
    1. Start tcode VOFM.
    2. Go to menu Requirements->Free goods.
    Do you see a routine numbered 600?  Does it have the active box checked?
    If you do not see routine 600, get hold of your SD functional person.
    If the active box is not checked, activate it by following menu path Edit->activate.

  • Terminating The Program

    Hi,
    Can any one tel abt my query ,
    when i select a checkbox in my output and press any button  other than EXIT and CANCEL it goes to Short Dump any one tel what is the problem in my program?

    it is the ALV blocked list. it is getting dump error as
    Field symbol has not yet been assigned.                                                                               
    How to correct the error                                                                               
    If the error occurred in a non-modified SAP program, you may be    
    able to find a solution in the SAP note system.                    
    If you have access to the note system yourself, use the following  
    search criteria:                                                                               
    "GETWA_NOT_ASSIGNED"                                              
    "SAPLSALV " or "LSALVF02 "                                        
    "USER_COMMAND"                                                    
    If you cannot solve the problem yourself, please send the          
    following documents to SAP:

  • Problem in executing the Program

    When I execute my program , it shows
    opencard.core.util.OpenCardPropertyLoadingException: property file not found
         at opencard.opt.util.OpenCardPropertyFileLoader.loadProperties<OpenCardPropertyFileLoader.java:158>
         at opencard.core.service.SmartCard.start<SmartCard.java:520>
         at samples.readfile.ReadFile.main<ReadFile.java:15>
    What the problem of my program??
    Thank for help~~

    Whoops.I ment environment Path ! I used to put it in the same directory as the .class files

  • Problem with instal the program Photoshop CC

    I've two computers and one adobe AD. I pay for two contracts for Photoshop CC. One program work OK, however second program didn't instal and said that you have the problem now, try again or contact with support. What need to do?

    If your using Free Transform, then look at the Interpolation settings in the tool options bar
    Try one of the Bicubic settings
    (i have it set to Bicubic)
    For rotating the Canvas look at the Image Interpolation settings under Photoshop (Edit)>Preferences>General and use one of the Bicubic settings
    The standard Bicubic setting is a good all around setting

  • Problem in Activating the Program in Unicode Systems

    Dear ABAPers,
      I am working in the Upgradation project.In our Project we are moving the objects from SAP 4.6c to ECC6.0 version.I have copied one program from SAP 4.6c to ECC6.0.When i am checking it gives the following error
    PERFORM accepted TABLES i_coss USING zcoss quantity hour.
    "I_COSS" cannot be converted to the line incompatible. The line type must have the same structure layout as "I_COSS" regardless of the length of a Unicode . Unicode character. Unicode character.     
    Please Give me the solution for this Problem.
    Thanks & Regards,
    Ashok.

    Hi,
    in the form routine you have to declare the same structure as table i_cross is using.
    for example:
    types: begin of s_coss,
                field1 type c,
                field2 type c,
               end of s_coss.
    data: i_coss type standard table of s_coss.
    perform accepted TABLES i_coss USING zcoss quantity hour.
    form accepted tables t_coss structure s_coss
                          using p_coss type ...
                                   p_quan type....
                                   p_hour type ....
    Kostas

Maybe you are looking for

  • Fcp x dosent open

    What to do fcp x dosent open.  it sticks on restoring window layout page

  • After 7.1.1 update jpg's unreadable and podcast app dies

    That about says it. the update screwed the phone and the ipad (at least the jpg issue, don't use it for podcasts).  Though more details..... iphone 4s jpgs unreadable/unimportable by lightroom, though aperture will import them. both recognize the fil

  • ADF UIX Runtime

    I download a sample application from http://technology.amis.nl/blog/765/spring-and-oracle-adf-registering-a-pojo-spring-jdbc-based-business-service-as-data-control However, one project' library need ADF UIX Runtime How to import this extension? =====

  • Push button labels

    hi friends, kindly help me for this. how can i implement a multi line label for a push button. i have big label with 5-6 words. i want it to display in multi line format. can anyone helpme out in this thanx in advance chs

  • Problem with spoken word recordings

    I am doing some spoken word recordings with Garage Band and then exporting them to I-tunes. The recordings sound completely different when I play them from Garage Band and in I-tunes. The I-tunes version becomes somehow 'harder' with an almost metali