Quick else if error question

I am getting an else if error, and I have no clue why. Can somebody help me out? Thanks in advance!
PrimaryColors.java:71: 'else' without 'if'
          else if(buttonString.equals("Blue"));
PrimaryColors.java:73: 'else' without 'if'
          else if(buttonString.equals("Red"));
PrimaryColors.java:75: 'else' without 'if'
          else
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JButton;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.FlowLayout;
import java.awt.Color;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class PrimaryColors extends JFrame implements ActionListener
     public static final int WIDTH = 300;
     public static final int HEIGHT = 200;
     private JPanel yellowPanel;
     private JPanel bluePanel;
     private JPanel redPanel;
     public PrimaryColors()
          super("Primary Colors");
          setSize(WIDTH, HEIGHT);
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          setLayout(new BorderLayout());
          JPanel biggerPanel = new JPanel();
          biggerPanel.setLayout(new GridLayout(3, 1));
          yellowPanel = new JPanel();
          yellowPanel.setBackground(Color.BLACK);
          biggerPanel.add(yellowPanel);
          bluePanel = new JPanel();
          bluePanel.setBackground(Color.BLACK);
          biggerPanel.add(bluePanel);
          redPanel = new JPanel();
          redPanel.setBackground(Color.BLACK);
          biggerPanel.add(redPanel);
          add(biggerPanel, BorderLayout.CENTER);
          JPanel buttonPanel = new JPanel();
          buttonPanel.setBackground(Color.BLACK);
          buttonPanel.setLayout(new FlowLayout());
          JButton yellowButton = new JButton("Yellow");
          yellowButton.setBackground(Color.YELLOW);
          yellowButton.addActionListener(this);
          buttonPanel.add(yellowButton);
          JButton blueButton = new JButton("Blue");
          blueButton.setBackground(Color.BLUE);
          blueButton.addActionListener(this);
          buttonPanel.add(blueButton);
          JButton redButton = new JButton("Red");
          redButton.setBackground(Color.RED);
          redButton.addActionListener(this);
          buttonPanel.add(redButton);
          add(buttonPanel, BorderLayout.WEST);
     public void actionPerformed(ActionEvent e)
          String buttonString = e.getActionCommand();
          if(buttonString.equals("Yellow"));
               yellowPanel.setBackground(Color.YELLOW);
          else if(buttonString.equals("Blue"));
               bluePanel.setBackground(Color.BLUE);
          else if(buttonString.equals("Red"));
               redPanel.setBackground(Color.RED);
          else
               System.out.println("Unexpected error");
     public static void main(String[] args)
          PrimaryColors gui = new PrimaryColors();
          gui.setVisible(true);
}

Get into the habit of always using braces around if's and loops. Consider the following.
if(condition)
    firstLine;
else
    anotherLine;Then later you need to change to code.
if(condition)
    firstLine;
    secondLine; //always executed
else // error else without if
    anotherLine;By not using braces in the first place can lead to errors if you forget to include then when the code changes.

Similar Messages

  • How to Fix the following Encore Error: "Quick Time system error: number = -1"?

    Has anyone seen this error before in Encore? Quick Time system error: number = -1 How do you fix it? I get it while burning a DVD. I have the latest version of Encore and the menu I am using was exported from After Effects.
    Thanks so much,
    Heather

    When I start Encore I always receive a warning that I do not have Quicktime installed
    Since I do not use QT in any way, I ignore the warning and Encore works just fine
    I also do not use menus from AE, so there MAY be something to look at
    Does Encore work properly if you use one of the built-in menus?

  • Just louded new version cat print from quick books internal error message coms up

    just louded new version cat print from quick books internal error message coms up  

    I don't have a link handy, but as far as I know, the Acrobat 9 user guide is available online as a (guess what!) PDF you may download... or is on the disc if you bought physical media
    Go to that PDF and search for compatibility
    The PDF for version 8 covers setting the options to a previous version on pages 102-103
    The words may (or may not) be different for v9
    Adobe PDF settings
    The Adobe PDF Settings dialog box in Acrobat Distiller contains panels of options that you can select to customize your PDF output.
    General panel options
    Use this panel to select a version of Acrobat for file compatibility and other file and device settings. (The panel appearance differs in Windows and Mac OS.)
    Compatibility Sets the compatibility level of the PDF. Use the most recent version (in this case, version 1.7) to include all the latest features and functionality. If youre creating PDFs that will be distributed widely, choose an earlier level, to ensure that all users can view and print the document.

  • Why doesnt itunes let me restore my ipohne 4 it gives me a error question saying cannot restore.

    Why doesnt itunes let me restore my ipohne 4 it gives me a error question saying cannot restore.

    Error 1 or -1
    This may indicate a hardware issue with your device. Follow Troubleshooting security software issues, and restore your device on a different known-good computer. If the errors persist on another computer, the device may need service.
    http://support.apple.com/kb/TS3694#error1

  • Imp: new session for the same user if  idle for 4 mins. or else throw error

    Dear All,
    I have a requirement where for security reasons if a session remains idle for 4 mins. or more, it should redirect to login page. This is easy as there is a feature in apex itself under security in application properties. This works fine.
    But I also don't want the users to start two active parallel sessions for the same user, and allow user to login only if the session for the user is idle for 4mins. or more or else display error message that the user has already logged.
    A second in sequence, on submit process for this in page 101 when login button is hit is written for this. It is as follows:
    declare
    found boolean := false;
    begin
    for x in (SELECT a.apex_user from apex_workspace_activity_log a,apex_workspace_sessions b, (SELECT max(view_date) as maxdate FROM apex_workspace_activity_log where upper(apex_user)=upper(:P101_USERNAME) and APPLICATION_ID=120) maxresults, (SELECT max(session_created) as maxcreate FROM apex_workspace_sessions where upper(user_name)=upper(:P101_USERNAME)) maxsession where b.session_created=maxsession.maxcreate AND b.APEX_SESSION_ID!=:SESSION and upper(b.user_name)=upper(:P101_USERNAME) and b.APEX_SESSION_ID=a.APEX_SESSION_ID and a.seconds_ago<240 AND a.APPLICATION_ID=120 and a.view_date=maxresults.maxdate and rownum=1) loop
    found:=true;
    raise_application_error(-20000, 'Already Logged.');
    exit;
    end loop;
    IF not found THEN
    null;
    END IF;
    end;
    But for some this reason this does not work as intended. Two users can login parallely.
    When I trace the program, I see that it should catch the parallel user login. But it does not.
    Is it some db cache issue? I don't know.
    Kindly let me know how to fix this. It is crucial for us to achieve this.
    Thanking in advance.
    Regards,
    Deepika.

    Dear Fateh,
    Thanks for the reply.
    The features of this plugin are:
    Configurable timeout actions including alert, redirect, and logout
    Optional and configurable warning message
    Option to keep session alive if user isn’t truly idle. Special thanks to Martin D’Souza for a great idea on how to implement this feature.
    But it cannot stop a new session for a user, if there is an active (in my definition apex_workspace_activity_log.seconds_ago<240) session already running for that user.
    Regards,
    Deepika.

  • Disk0s2 error questions

    Alright, so I have heard about this error, and one of my friends got it today.
    The problem started out as "my computer won't load and has the spinning gear". I then told her to boot in Safe Mode, but it would continuously load. Should it take 2 hours for it to boot? I don't think so...but maybe I am wrong.
    Since that fails, Apple says to boot into single user mode, which is fine. Put in my /sbin/fsck -fy command, and let it do it's thing. Then we see that error.
    So, here are my questions. Note I have my own copies of the grey installation disk, but she does not have hers.
    * Pertaining to the 5-step checkup by running /fsck -fy, how long should this take? It got all the way up to Invalid Record Count (4, 4xxx), with 2 lines of disk0s2 and Invalid Node every now and then. It seems to be stuck/slow on step 4.
    * Is it safe to use my startup/installation disk solely for running Disk Utility? I am almost sure this is due to bad permissions, or simply a bad hard drive.
    * Would Target Disk Mode help? We both have Macs and I know about that feature, but since we don't have a Firewire 800 cable, can't do this. My mac is fine (better repair my permissions!)
    * Any other further steps that can be taken? She is visiting an Apple Store this weekend, so I am merely curious as to what can be done.
    Macbook Specs:
    2010 Macbook Pro 13'
    OS X Snow Leopard (unsure of which version, but I would say 10.6.3,5,7 or 8)

    xtremecarbon wrote:
    I have heard about this error
    What error?
    Invalid Record Count (4, 4xxx), with 2 lines of disk0s2 and Invalid Node every now and then. It seems to be stuck/slow on step 4.
    Disk directory disk0s2 is damaged. Can't tell what disk that is (this is dynamic identifier), but, if you're running SL, in all likelihood that's the 2nd partition (slice) of the internal disk, ie, main partition on the internal disk.
    You can try to (a) boot from an alternate device (eg, Install DVD or ext'l drive) and attempt to fix the problem with Disk Utility, (b) rebuild the disk directory with DiskWarrior, (c) boot from an alternate device, reformat the disk (which will destroy everything currently on it) and restore everything from the backup. In any event, if you don't have a backup, you're in trouble. Pray.
    Is it safe to use my startup/installation disk solely for running Disk Utility?
    To verify or repair the disk? Yes.
    I am almost sure this is due to bad permissions
    Nothing whatever to do with permissions.
    Would Target Disk Mode help?
    No. Can't be used if you can't boot the Mac from the int'l drive.
    Any other further steps that can be taken?
    If there is a current backup, no. If there isn't, boot from an alternate device and try to copy as much data which hasn't been backed up as possible. The Apple Store does not do data recovery.

  • I am having trouble installing itunes. I get so far and it will not finish installing Quick time. Error %appdata%/ what does this mean? We had itunes before and it vanished? I have Windows 7 and explorer 9

    I having trouble reinstalling itunes. I have windows 7 and explorer 9. Keep getting as for as itunes installed and it will not finish installing Quick time.also, keep getting error message "could not find location %appdata%/. What does this mean?

    http://www.apple.com/support/itunes/contact/

  • Quick selection tool error message

    When I use the quick selection tool (or when I use content-aware scaling) I get an error message saying "could not complete your request because of a program error." I am working with NEF files, 4 GB of RAM, fast machine with plenty of scratch space, Radeon X1950 crossfire graphics card. With small .jpg files, the problem doesn't occur. Thanks for any help.

    That's right, Chris... and even when I turn it off, it seems erratic as to whether or not the scaling works. I just tried it again and couldn't get it to work without the program error message even when I turned it off. I suspect that if I reboot the whole machine it might work but I'm not sure. Something is buggy in there.

  • Discoverer error question

    Hi,
    I had a Discoverer user receive the following error message when trying to log into Discoverer. The user waited for a while and then was able to log in. I suspect his Java might be corrupted but I wanted to see if there was anything else I should look at
    "Unable to connect to the Discoverer server: null. Please contract your Oracle Application server administrator."
    Thanks,
    Carlos

    Hi
    While Java could be a cause I think it is highly unlikely. More likely you could have had a network issue or the server was temporarilly unavailable.
    Michael

  • Quick Time Parsing Error 43

    Using duo processor G5, storing video on newly Mac formatted 1TB drive. Imported the first tape from a Canon ZR850 camera with no problem into iMovie HD 6.03. Put in the 2nd tape with a new project name and now continually get an error "Quick Time couldn't parse it -43". I see other errors in the discussion but not this one. I tried removing the backup battery, disconnecting all cables and resetting time, date, etc., but no luck. I then tried to import it through a Canon GL2, but got same error. I tried several other tapes that work perfectly well in the camera but always get the same error. Went through 25 other tapes, so do not believe it is the tapes. Software is OSX 14.4.9 with 6.5 GB RAM. What am I doing wrong? Need help.

    Using duo processor G5, storing video on newly Mac
    formatted 1TB drive. Imported the first tape from a
    Canon ZR850 camera with no problem into iMovie HD
    6.03. Put in the 2nd tape with a new project name
    and now continually get an error "Quick Time couldn't
    parse it -43". I see other errors in the discussion
    but not this one. I tried removing the backup
    battery, disconnecting all cables and resetting time,
    date, etc., but no luck. I then tried to import it
    through a Canon GL2, but got same error. I tried
    several other tapes that work perfectly well in the
    camera but always get the same error. Went through
    25 other tapes, so do not believe it is the tapes.
    Software is OSX 14.4.9 with 6.5 GB RAM. What am I
    doing wrong? Need help.
    I did check for plugins but found none.
    I used to use iMovie a few years ago an after spending several hours trying to now import the footage remembered that speed compatibility was crucial. My 1 TB drive that I was saving my videos to was running on Firewire 800 speed while my camera was running at Firewire 400 speed. I changed my 1TB drive to run at Firewire 400 speed, and "bingo", it now works.
    Thank you however for your suggestions as now I will watch my extra plug-ins as well.

  • BAPI_INCOMINGINVOICE_CREATE - a rolling back errors question

    I  need to use this BAPI to create an invoice and a credit memo against the same purchase order in one 'hit'.  If the second call to the BAPI fails, I  want to rollback both sets of changes.  IIt's been fixed in my mind for a while now that this is not  possible.; that if you call  this BAPI  you have to complete the process by committing or rolling back  the changes before calling it  a second time.  However, I've done a bit of testing and doing the commit / rollback after the second call seems to be working fine. 
    Has anyone else done this sort of thing successfully in Production?   I don't  want  to tell them  that it is possible and make them really happy and  then find out that I was wrong.

    I have a similar scenario with BAPI_ACC_DOCUMENT_POST, where two or even four postings need to be made successfully or none at all. The rollback is actually a very rare case in production, but it was tested quite a bit beforehand with forced errors and always worked as desired.
    As you know, it works only as long as the BAPI does not have a commit work inside (they should not if programmed properly).
    Thomas

  • Anyone else getting ERROR MSG 502?

    Haven't been able to connect to iTunes store for 2 weeks or so now... everything was peachy-keen before that. Have tried all suggestions on forum and support sites, all to no avail. This is on my work computer, so I'm not sure if something was recently added/updated/etc. by our tech people.
    The error message reads: "iTunes could not connect to the iTunes Store. An unknown error occured (502)."
    Anyone else had this problem and found a solution?
    Thanks!

    If it works at home, it's likely something to do with security, networking software, virus protection, firewalls etc issued by your work. If you have the ability to disable or configure any of that, it may help. This may give you some answers:
    http://docs.info.apple.com/article.html?artnum=300870

  • Anyone else getting error 2005?

    I'm having the same kind of problems that everyone else seems to be having installing the new upgrade, but most people seem to be getting an error of 6.
    Anybody else getting an error 2005?
    I plug in my touch and try to upgrade, it extracts the software OK, goes through the "preparing ipod for restore" box and then stops with an unknown error (2005).
    If I try to restore to factory settings, it just does the same thing. However, I can get it back to the old version on my Windows XP machine with iTunes. I would try to upgrade there, but it seems like it wants me to purchase the upgrade again!
    Anybody got it to work after an error 2005?

    Since you purchased the 2.0 upgrade on your Mac, you can move the file to your PC and try the upgrade there.
    The upgrade file is named iPod1,12.0_5A347Restore.ipsw and on your Mac is stored in
    <your home directory>/Library/iTunes/iPod Software Updates
    You'll want to move this to your PC and place it in:
    C:\Documents and Settings\<your username>\Application Data\Apple Computer\iTunes\iPod Software Updates
    (you may have to create the iPod Software Updates folder)
    After you copy the file, plug in your iPod touch to your PC, and iTunes will offer to Install 2.0 without charge.

  • OWB Process Flow - Transition Warinig OR Error - Question

    Hi all,
    I have a question. In a Simple Process Flow I have:
    Start -> Mapping -> Warning -> Email
    -> Erro -> Email
    ->Sucess - End
    Is necessary use 3 Transition ?
    Can I do only 2 Transition like
    Start -> Mapping -> Warning OR Error -> Email
    ->Sucess - End
    How can I do "Warning OR Error" on a Transition?
    If i put any condition on the Transition:
    Start -> Mapping -> Email
    ->Sucess - End
    It means
    Start -> Mapping -> Warning OR Error -> Email
    ->Sucess - End
    Thanks

    If i put any condition on the Transition:
    Start -> Mapping -> Email
    ->Sucess - End
    It means
    Start -> Mapping -> Warning OR Error -> Email
    ->Sucess - End
    it exactly what you need
    Edited by: hungsao on Oct 17, 2012 9:10 PM

  • Can't install Quick Time 7 - Error 1721 problems with windows installer

    I had QT 6 PRO and an old version of itunes working fine. I tried to upgrade to Itunes 6. The install failed at the last step of installing QuickTime 7.04.
    The error message was "Error 1721.There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor." So, no QT, therefore no Itunes.
    I did the following:
    cleared my temp directory.
    made sure I had the latest windows installer (3.1 v2)
    removed all traces of itunes and quick time, using Remove Programs, the windows cleanup Utility and manually deleting all files as listed in info article 93976.
    I downloaded the standalone QuckTime 7.04 installer, tired to install and I still get the same error.
    I now have no quick time 6 or 7 and no itunes, and I have no idea what is wrong with the installer.
    I do have access to the install log, and am delighted to reprint it if it will help.
    thanks for any help people can provide.
    Windows 2000
    Windows 2000
      Windows 2000  

    HI I am somewhat having the same problem as you with the itunes and QT not fully downloading but i am not computer smart and I am not real sure what you are saying to do. Also it always says "plug-in did not initialize properly" No clue but would appreciate any help from you... Thanks alot

Maybe you are looking for