Solved

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

Posted on 2003-11-22
4
270 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
Comment Utility
Answered my own question!  Sorry for waisting brain power!  I forgot the ().
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
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
Comment Utility
Submitted to PAQ with points refunded (125)

DarthMod
Community Support Moderator
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now