How to set  up the loop?

I am trying to create a Frame, using BorderLayout and every time we click the center button, it will change the color in one of the region. But I dont know how to set up the loop to make it change one at a time. Below is my draft......Thanks for helping.......
Test.java
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class Test extends Applet implements ActionListener
          Color []color={Color.red,Color.blue,Color.black,Color.green};
          private Button nb=new Button("North Button");
          private Button sb=new Button("South Button");
          private Button eb=new Button("East Button");
          private Button wb=new Button("West Button");
          private Button cb=new Button("Center Button");
          int buttonCount=0;
          public void init()
               setLayout(new BorderLayout());
               add(nb,"North");
               add(sb,"South");
               add(eb,"East");
               add(wb,"West");
               add(cb,"Center");
               cb.addActionListener(this);
               buttonCount=0;
          public void actionPerformed(ActionEvent e)
               for (int i=0;i<color.length;i++)
                    buttonCount++;
                    if (buttonCount%2==0)
                         nb.setBackground(color);
                    if (buttonCount%2==1)
                         sb.setBackground(color[i]);

declare a public variable count;
int count=0;
public void actionPerformed(ActionEvent e)
buttonCount++;
count++;
if(count==color.length)
count=0;
if (buttonCount%2==0)
nb.setBackground(color[count]);
if (buttonCount%2==1)
sb.setBackground(color[count]);
hope you got it.

Similar Messages

  • TS3899 I can't SEND email from Telus account in Alberta, Canada? Does anyone know how to set up the Outgoing server? Help! And thanks!

    Can't SEND email from Telus account in Alberta, Canada, unless I go to web mail. Does anyone know how to set up the Outgoing server? Incoming is fine. Outgoing used to work. We changed it when we went to another location, and can't get it back. Telus support can't fix it. Neither smtp.telus.net NOR mail.telus.net works for Outgoing server to send mail. Please help! Thanks.

    iOS: Unable to send or receive email
    http://support.apple.com/kb/TS3899
    Can’t Send Emails on iPad – Troubleshooting Steps
    http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
    Setting up and troubleshooting Mail
    http://www.apple.com/support/ipad/assistant/mail/
    Server does not allow relaying email error, fix
    http://appletoolbox.com/2012/01/server-does-not-allow-relaying-email-error-fix/
    Why Does My iPad Say "Cannot Connect to Server"?
    http://www.ehow.co.uk/info_8693415_ipad-say-cannot-connect-server.html
    iOS: 'Mailbox Locked', account is in use on another device, or prompt to re-enter POP3 password
    http://support.apple.com/kb/ts2621
    iPad Mail
    http://www.apple.com/support/ipad/mail/
    Try this first - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.)
    Or this - Delete the account in Mail and then set it up again. Settings->Mail, Contacts, Calendars -> Accounts   Tap on the Account, then on the red button that says Remove Account.
     Cheers, Tom

  • I need to set up 12 iPad 3s to train groups of teachers in one-day workshops.  Any suggestions as to how to set up the iPads for multiple users?

    I have 12 iPad 3s that I want to set up to train multiple groups of teachers on in anticipation of purchasing classroom sets eventually.  I am looking for suggestions in how to set up the iPads to be used by multiple users.

    Managing Multiple iPads/iPods in a School Setting
    http://courses.moodleshare.com/course/view.php?id=162
     Cheers, Tom

  • How to set up the interaction between InDesign CS6 8.0 and Photoshop CS 6 - if Photoshop is installed and the 64 and 32-bit?? default InDesign refers to the 64-bit version of Photoshop and scripts do not work.

    how to set up the interaction between InDesign CS6 8.0 and Photoshop CS 6 - if Photoshop is installed and the 64 and 32-bit?? default InDesign refers to the 64-bit version of Photoshop and scripts do not work.

    Nice of you to point it out here as I at least don’t follow Mr.Nash’s blog regularly.

  • HOW can i rotate the loop as many lines of multi line container in BPM

    Hi All
    I have to send an idoc to 2 Receivers by spliting the message.
    Based on the occurance of a particular source segments i need to create those many instance of targets.
    IDOC ---> Rec1 (More than one message instance)
         ---> Rec2  (More than one message instance)
    I have taken messages of Receiver into a multi line container1
    and messages of Receiver 2 into another multi line container2.
    HOW can i rotate the loop as many lines of multi line container.
    Thans
    Prasad

    Hi Raj
    There are two webservices are 2 receivers.
    In the idoc there is specific segment , which occurs unbounded,Each occurence we Need to check the value of a particual field and send to corresponding Receiver.
    For Ex:
    ZE1KONH (1..Unbounded)
       >MSFGN =004 --> Rec1
      >> MSFGN==0009 Rec2
    It could be like , 1 or more segm for Rec1 and 1 or more segm for Rec2
                            all are for Rec1 or All are for Rec2.
    so in the tranformation we need to put all message of Rec1 in corresponding multiline container as well for Rec2. Then i need to send to correspongind Receiver.
    So here i need to send all splited messages to appropriate receivers

  • I have bought the verizon iPad 2 from US and want to use it in India. How to set up the Indian CDMA carrier on my iPad 2

    I have bought the verizon iPad 2 from US and want to use it in India. How to set up the Indian CDMA carrier on my iPad 2 ?

    rahulmcadit wrote:
    The phone is from UK and the carrier on which phone has been locked is "ORANGE". I want to use the same phone in India. I want to unlock the phone. Can you please suggest me what is the procedure to unlock the phone. How can I pay the amount to ORANGE carrier and can use my iphone in India.
    Contact ORANGE to unlock it.
    See this -> http://support.apple.com/kb/HT5014

  • How to Set up the  variables and others to compile and Run Java Programs

    Hello,
    I have just downloaded the jdk1.6.0_07 and jre1.6.0_07 and installed it in C:\Program files\Java in my Windows XP ,So please tell me how to sett up the enviroment variables etc to compile and run Java Programs from Command Prompt.
    thanks

    To set the PATH permanently, add the full path of the jdk1.6.0_<version>\bin directory to the PATH variable. Typically this full path looks something like C:\Program Files\Java\jdk1.6.0_<version>\bin. Set the PATH as follows on Microsoft Windows:
    1. Click Start > Control Panel > System on Windows XP or Start > Settings > Control Panel > System on Windows 2000.
    2. Click Advanced > Environment Variables.
    3. Add the location of bin folder of JDK installation for PATH in User Variables and System Variables. A typical value for PATH is:
    C:\Program Files\Java\jdk1.6.0_<version>\bin

  • Noise on the photo. How to set up the camera?

    Noise on the photo. How to set up the camera?
    Phone has become worse to do a pictures. A lot of noise on the photo. Often photo obtained not clear, smeared. I've heard that i can configure through iTunes. But I do not know how?? Or tell me another way to set up and adjust the camera.
    All updates are installed.
    I have the iPhone 5 (Just 5)

    OS X was designed long before the advent of SSD and the built in assumption is that everything would exist on the boot drive. If you want to change that, you'll need to do it manually. If I had an iMac with an SSD (a MBA has become my main computer) I'd leave the OS and applications on it and move at least some of my files to the standard hard drive - certainly all the media (music and video).
    The techs I work with have been arguing (politely) about the benefits of their own setups. One moved the entire User's directory to the standard drive. Copy your files by dragging, open Groups & Users in the System Preferences, option click on each account name and then point to the new location of the user's directory. Test that it works before deleting the directory from the SSD.
    The other kept his Users directory on the SSD but moved everything but the Library folder, then he put aliases of the folders into his user directory and dragged new folders into the Finder window sidebar. His argument is that many programs keep a hefty number of files in the Application Support folder and keeping them on the SSD lets the program start faster. Since I've not done any testing I can't say yes or no.

  • How to set/get the archive file attribute?

    I am programing a (freeware!) ftp client and need to know, how to set/get the archive attribute of a local file. I was searching through whole the i-net - nothing at all!
    please help me!!

    Hi,
    Since not all operating systems support the archive attribute, this ain't included in the JDK.
    If you're using Microsoft Foundation Classes for Java, then you can use File.getAttributes(String path) and check whether the result equals FileAttribute.ARCHIVE.
    For setting the attribute, you can use
    File.setAttributes(String path, FileAttribute.ARCHIVE)
    Of course this is all Microsoft-specific stuff.
    Hope this helps,
    Kurt.

  • How to set up the output device in output determinatin with customer master

    Hi,
    I am doing the output determination using customer master and not conditions technique.  Can anybody please let me know how to set up the output device . I have done the following:
    1)  assigned output determination procedure DB00001 to acct group 0001
    2)  added output type BA00 to customer master documents tab with print as the medium.
    3)  On creating a sales order and changing it its giving the message
    BA00     515     No printer defined for output BA00
    Please provide me with some suggestions , how to resolve this issue.
    thanx
    Jayant

    1. tcode V/30 -> check BA00 type -> goto  "print" tab -> what's set in the "print param." field?
    2. IMG ->SD -> basic functions -> output control -> define print parameters -> V1 output -> for BA00 output type -> Assign a default printer. This is related with the "print param." set in step 1.
    For example: if "print parame." is set to '1' in V/30, then the default printer is assigned to sales organization.
    You can check F4 search help on the "print param." field (in V/30) to see what options you have.
    If you want to specify printer by customer account, you may need to use userexit.
    Edited by: Harry Wu on Jun 23, 2010 9:18 AM

  • How to make in the loop codes?

    How to make in the loop codes to have like my output(below)?
    For example:
    I am trying to figure out how to make them correct the way I want to have the output.
    String start = "02-01-08";
    String end = "02-29-08";
    Calendar a = new GregorianCalendar();
    while( start <= end ) {
              a.add(Calendar.DAY_OF_WEEK, 7);
              Date d = a.getTime();
              DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
              String ss = df.format(d);
              System.out.println(ss);
    }The output:
    +02-01-08+
    +02-08-08+
    +02-15-08+
    +02-22-08+
    +02-29-08+
    Anybody know how to make it correct?

    artist_tech07 wrote:
    I am confused where is the answer in the doc that you gave me?Read my first reply and read the docs. Then read them again.
    And then re-read this
    To do what you want you need a start and end Dates. These you can compare in one numeric form or the other. For example by using getTime.
    Then during each loop iteration you will need to add *1 day (using the Calendar)* to the start date.
    I am telling you what methods to use. I have told you were you can find those methods. I have given you a link to the Calendar class API. All you have to do is put 2 and 2 together. Or at the very least make an attempt to do so.

  • Does anyone know how to set up the cname in PLESK correctly?

    Hi, does anyone know how to set up the cname correctly in a PLESK control panel?
    I am trying to point my domain name to my .mac webspace using the new feature available for iWeb 08.
    I can see the cname category in the DNS setup on the control panel and have changed the cname www to web.mac.com as described and have waited over 48 hours and still no change. I just want to rule all avenues out before approaching my hosting company.
    Thanks in advance to anyone that has the jnowledge to help.

    Well, no one bothered to answer, that's a first. Managed to sort it out on my own though.

  • How to set up the client-specific consolidation routes

    Hi!
    I am setting up TMS-functionality in my 2-system landscape (DEV, PRD) and would like to use 2 Clients in the DEV-system (100> Cust and 200> Test).
    <b>How can I set up the tranport routes between the Clients 100 and 200 in the same system DEV?</b>
    I read, the client-specific consolidation route should be applied in this case?!
    (also some parameter settings should be edited, e.g. CTC)
    <b>Can some one give me a detail technical description how to set up the client-specific consolidation routes between Client 100 and 200 in DEV-system?</b>
    Thank you!
    regards

    Hi Axel,
    You have activate Extended transport route.
    refer this link to helpout for the same
    http://help.sap.com/saphelp_47x200/helpdata/en/2e/709533ef9b11d184850000e8a57770/frameset.htm
    Reward points if helpful.
    Regards
    Ganesh

  • How to set up the internal camara to chat

    how to set up the internal camara for video chating

    click on FaceTime and follow the instructions on screen.  If you want to video chat with non Mac users, you might try Skype.

  • How to set up the fp2000 sample rate?

    I am using the fp2000 in an insutrial project and I would like to know how to set up the sample rate on the FP2000 ,either using a software like Labview or by an hardware method.
    Thanks for your help.
    Vianney DESPAIGNE

    Vianney,
    The following links will give you more information on FieldPoint and sampling rates.
    http://zone.ni.com/devzone/conceptd.nsf/webmain/2124F6BBD29663D886256CB80054DBD7
    http://zone.ni.com/devzone/conceptd.nsf/webmain/A14D3C3314A0E24A86256DBE00664943
    http://forums.ni.com/ni/board/message?board.id=110&message.id=455&requireLogin=False
    http://forums.ni.com/ni/board/message?board.id=110&message.id=1681&requireLogin=False
    Regards,
    Aaron

Maybe you are looking for

  • How can I prevent Mail from applying actions (moving/copying/flagging/marking read) to duplicate messages?

    I use Mail to check multiple accounts. When I receive the same e-mail in multiple accounts, actions applied to an e-mail in one account often (though not always) affect duplicate messages in other accounts. Example 1 Someone sends an e-mail to both m

  • HT5373 How can I view and edit my iPhone calender from my home PC?

    How can I view and edit my iPhone calendar via my home PC?

  • Export of different schema

    Hi all, I am trying to take backup of a different schema from my user, I am given rights of EXP_FULL_DATABASE but whenever I try to take exp of say user USER1 from my user, it gives an error as: C:\DOCUMENTS AND SETTINGS\ADMINISTRATOR>EXP USER2@TEST

  • MySQL ODBC Connection

    Hi all, Can anyone please let me know how to make ODBC Connection with MySql in JSP. Steps wise explanation will be highly appreciated. thanks for any help in advance, savdeep.

  • DPM Console crashing.

    DPM Console Crashing. Event ID 948 and 999. Detail error log in eventvwr is below. Please help urgent. The description for Event ID 999 from source MSDPM cannot be found. Either the component that raises this event is not installed on your local comp