Solved

Compile error:  else if (e.getActionCommand.equals("Exit"))

Posted on 2003-11-22
4
282 Views
Last Modified: 2010-04-16
Greetings all!  Can anyone tell me why my entry:   else if (e.getActionCommand.equals("Exit")) is causing the following compile error and/or suggest a fix:

C:\progs\TextAreaDemoExercise.java:67: cannot resolve symbol
symbol  : variable getActionCommand
location: class java.awt.event.ActionEvent
        else if (e.getActionCommand.equals("Exit"))
                  ^
Here a code excerpt (below)... I only have this problem when I try and put in the "exit" elements...remove them and it compiles fine.  


        Button get2Button = new Button("Get Memo 2");
        get2Button.addActionListener(this);
        buttonPanel.add(get2Button);

        Button ExitButton = new Button("Exit");                        //Button entry for my exit function....
        ExitButton.addActionListener(this);
        buttonPanel.add(ExitButton);

        add("South", buttonPanel);

        textPanel = new Panel();
        textPanel.setBackground(Color.blue);
        theText = new TextArea(10, 40);
        theText.setBackground(Color.white);
        textPanel.add(theText);
        add("Center", textPanel);
    }

    public void actionPerformed(ActionEvent e)
    {
        if (e.getActionCommand().equals("Save Memo 1"))
        {
            memo1 = theText.getText();
            theText.setText("Memo 1 saved.");
        }
        else if (e.getActionCommand().equals("Save Memo 2"))
        {
            memo2 = theText.getText();
            theText.setText("Memo 2 saved.");
         }
        else if (e.getActionCommand().equals("Clear"))
            theText.setText("");
        else if (e.getActionCommand().equals("Get Memo 1"))
            theText.setText(memo1);
        else if (e.getActionCommand().equals("Get Memo 2"))
            theText.setText(memo2);
        else if (e.getActionCommand.equals("Exit"))           //This is my entry to exit the program
   System.exit(0);                                                  
                                                                           
        else
            System.out.println("Error in memo interface.");

        textPanel.repaint();//Shows changes in textPanel
    }
0
Comment
Question by:rockyisin
4 Comments
 

Author Comment

by:rockyisin
ID: 9803964
Answered my own question!  Sorry for waisting brain power!  I forgot the ().
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9804016
Post a 0 point q to http://www.experts-exchange.com/Community_Support/ and they'll give you your points back
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 11688316
Submitted to PAQ with points refunded (125)

DarthMod
Community Support Moderator
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Application launch issue with Apache Tomcat 5 62
Unhandled exception type Exception 18 42
String array comparison 4 38
ejb entity bean example 2 7
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question