Solved

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

Posted on 2003-11-22
4
276 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

896 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

15 Experts available now in Live!

Get 1:1 Help Now