Error "class should be declared abstract"

i am having a problem.
when i compile my program, there is one error,
below is the error occurs:
glay2.java:5:glay2 should be declared abstract; it does not define
actionPerformed(java.awt.event.ActionEvent) in glay2
public class glay2 extends
^
Applet implements ActionListener
what does this mean?

below is my codes...
I dun really understand what your are saying.
i got my actionperformed right there? ^^;
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
public class glay2 extends Applet implements ActionListener
// buttons
Button button1, button2, button3, button4, buttonpress,
dsp1, dsp2, dsp3, dsp4,
eable1, eable2, eable3, eable4,
dable1, dable2, dable3, dable4;
// texts
TextField textfield1, pr1, pr2, pr3, pr4;
// labels
Label label1, label2, label3, label4, title;
boolean in1 = true, out1 = false, can1 = false,
dis1 = false, in2 = true, out2 = false, can2 = false,
dis2 = false, in3 = true, out3 = false, can3 = false,
dis3 = false, in4 = true, out4 = false, can4 = false,
dis4 = false;
int pump1[] = {0, 0, 10},
pump2[] = {0, 0, 10},
pump3[] = {0, 0, 10},
pump4[] = {0, 0, 10};
String state1 = "init",
state2 = "init",
state3 = "init",
state4 = "init";
String menu1[] = {"State: ", "Litres: ", "Price: "},
menu2[] = {"State: ", "Litres: "},
menu3[] = {"State: ", "Litres: "},
menu4[] = {"State: ", "Litres: "};
public void init(){
// west panel
button1 = new Button("0.01");
dsp1 = new Button("Dsp 1");
button2 = new Button("0.02");
dsp2 = new Button("Dsp 2");
button3 = new Button("0.03");
dsp3 = new Button("Dsp 3");
button4 = new Button("0.04");
dsp4 = new Button("Dsp 4");
// east panel
eable1 = new Button("Enable 1");
dable1 = new Button("Disable 1");
eable2 = new Button("Enable 2");
dable2 = new Button("Disable 2");
eable3 = new Button("Enable 3");
dable3 = new Button("Disable 3");
eable4 = new Button("Enable 4");
dable4 = new Button("Disable 4");
// south panel
buttonpress = new Button("Set Fuel Price(p)");
textfield1 = new TextField(" ");
// north panel
title = new Label("Jeanifer and Yew Leng's Petrol Station");
// set color for buttons
button1.setBackground(Color.red);
button2.setBackground(Color.red);
button3.setBackground(Color.red);
button4.setBackground(Color.red);
// set color for dsp
dsp1.setBackground(Color.yellow);
dsp2.setBackground(Color.yellow);
dsp3.setBackground(Color.yellow);
dsp4.setBackground(Color.yellow);
// set color for eable
eable1.setBackground(Color.green);
eable2.setBackground(Color.green);
eable3.setBackground(Color.green);
eable4.setBackground(Color.green);
// set color for dable
dable1.setBackground(Color.blue);
dable1.setForeground(Color.white);
dable2.setBackground(Color.blue);
dable2.setForeground(Color.white);
dable3.setBackground(Color.blue);
dable3.setForeground(Color.white);
dable4.setBackground(Color.blue);
dable4.setForeground(Color.white);
// define panel
Panel pn = new Panel();
Panel ps = new Panel();
Panel pw = new Panel();
Panel pe = new Panel();
Panel pc = new Panel();
// layout
setLayout(new BorderLayout());
setBackground(Color.lightGray);
// adding grid for west panel
pw.setLayout(new GridLayout(4,2));
pw.add(button1);
pw.add(dsp1);
pw.add(button2);
pw.add(dsp2);
pw.add(button3);
pw.add(dsp3);
pw.add(button4);
pw.add(dsp4);
// adding grid for east panel
pe.setLayout(new GridLayout(4,2));
pe.add(eable1);
pe.add(dable1);
pe.add(eable2);
pe.add(dable2);
pe.add(eable3);
pe.add(dable3);
pe.add(eable4);
pe.add(dable4);
// place button on south panel
ps.add(buttonpress);
ps.add(textfield1);
//place label on north panel
pn.add(title);
// adding panel
add("North", pn);
add("West", pw);
add("East",pe);
add("South", ps);
add("Center", pc);
// button action
button1.addActionListener(this);
button2.addActionListener(this);
button3.addActionListener(this);
button4.addActionListener(this);
buttonpress.addActionListener(this);
//dsp action
dsp1.addActionListener(this);
dsp2.addActionListener(this);
dsp3.addActionListener(this);
dsp4.addActionListener(this);
//enable action
eable1.addActionListener(this);
eable2.addActionListener(this);
eable3.addActionListener(this);
eable4.addActionListener(this);
// color in box for each decision
public void paint(Graphics g)
if (in1)
g.setColor(Color.red);
else if(out1)
g.setColor(Color.orange);
else if(can1)
g.setColor(Color.green);
else if(dis1)
g.setColor(Color.blue);
g.fillRect(150, 50, 100, 150);
g.setColor(Color.yellow);
g.fillRect(170, 50, 80, 125);
g.setColor(Color.black);
g.setFont(new Font ("Arial", Font.PLAIN, 12));
g.drawString(menu1[0] + state1, 150, 50);
     for (int i = 1; i < 4; i++)
     g.drawString(menu1[i] + pump1[i-1], 140, 100 + (i - 1) * 32);
     g.drawString("Pump 1", 140, 120);
//action ae
public void ActionPerformed(ActionEvent e)
if (e.getSource() == button1)
     if ( in1 == true )
                         out1 = true;
                         in1 = false;
                         can1 = false;
                         dis1 = false;
                         state1= "On";
     else
                         out1 = false;
                         in1 = true;
                         can1 = false;
                         dis1 = false;
                         state1= "Off";
else if ((e.getSource() == dsp1) && (can1== true))
     pump1[0]++;
     pump1[1] = pump1[2];
     state1= "pumping";
else if ((e.getSource() == eable1) && (in1 = true))
     in1 = false;
     out1 = true;
     can1 = true;
     dis1 = false;
     state1= "Enabled";
else if ((e.getSource() == dable1) && ( can1 = true))
     in1 = false;
     out1 = false;
     can1= false;
     dis1 = true;
     state1= "Disabled";
else if ((e.getSource() == buttonpress) && (in1 = true))
     pump1[2] = Integer.parseInt(pr1.getText());
     repaint();               

Similar Messages

  • Class should be declared abstract

    hello,
    i'm learning to use the JOONE(Java Object Oriented Neural Engine).I tried to run a sample program.On compiling it gives the following error.
    XorExample should be declared abstract; it does not define errorChanged(org.joone.engine.NeuralNetEvent) in XorExample
    /*XorExample.java*/
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import org.joone.engine.*;
    import org.joone.engine.learning.*;
    import org.joone.io.*;
    public class XorExample extends JFrame implements ActionListener, NeuralNetListener{                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    I don't know anything about JOONE, but the cause of the error is the XorExample class is specified to implement the NeuralNetListener interface, and apparently it does not implement the errorChanged method of the interface.

  • Error:EntityObjectImplementation should be declared abstract

    Hi,
    i hav got this error please help me to resolve this.......
    Error(11,8): class newImplement.oracle.apps.ak.hello.server.newImplEOImpl should be declared abstract; it does not define method setLastUpdateLogin(oracle.jbo.domain.Number) in class oracle.apps.fnd.framework.server.OAEntityImpl
    public class newImplEOImpl extends OAEntityImpl -------------error line
    protected static final int NAME = 0;
    protected static final int GENDER = 1;
    Edited by: 945985 on Sep 10, 2012 11:32 PM

    i have created some fields like name , roll number, std. all r user editable Text input fields.
    if i enter data into these fields it should be displayed in table.
    i have created EO and added who col attributes into EO, with reference to EO created VO but i have not select who col attributes in VO,
    and with reference to VO created table .
    table is on another page as it vl be displayed once i press submit button.
    Edited by: 945985 on Sep 11, 2012 2:31 AM

  • "should be declared abstract" error message Help !

    Dear People,
    I have two error messages in my program
    "should be declared abstract"
    "getAudioClip() not found "
    Your advice is appreciated
    Norman
    "MyMusicApplet_1.java": Error #: 454 : class stan_my_music_applet_1.MyMusicApplet_1 should be declared abstract; it does not define method getStreamKeys() in interface java.applet.AppletContext at line 9
    "MyMusicApplet_1.java": Error #: 300 : method getAudioClip(java.lang.String) not found in class stan_my_music_applet_1.MyMusicApplet_1
    import java.util.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.applet.*;
    import java.awt.event.*;
    public class MyMusicApplet_1 extends JApplet implements ActionListener, AppletContext
         //AppletContext myAppletContext =   new AppletContext();
         //Iterator i =   myAppletContext.getStreamKeys();
         JButton myJButton;
         AudioClip acSound_1 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk");
         AudioClip acSound_2 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         AudioClip acSound_3 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         AudioClip acSound_4 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         AudioClip acSound_5 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         AudioClip acSound_6 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         AudioClip acSound_7 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         AudioClip acSound_8 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         AudioClip acSound_9 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         JButton myJButtonSound1;
         JButton myJButtonSound2;
         JButton myJButtonSound3;
         JButton myJButtonSound4;
         JButton myJButtonSound5;
         JButton myJButtonSound6;
         JButton myJButtonSound7;
         JButton myJButtonSound8;
         JButton myJButtonSound9;
      public void init()
           Container myContentPane = getContentPane();
           myContentPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
            Dimension buttonSize = new Dimension(190,100);
           Font myFont = new Font("Arial", Font.BOLD,14);
           Border myEdge = BorderFactory.createRaisedBevelBorder();
                    //create 1st button's object
                     myJButtonSound1 = new JButton("sound #1");
                    myJButtonSound1.addActionListener(this);
                   //set the button's border and size, font background and foreground
                   myJButtonSound1.setBorder(myEdge);
                   myJButtonSound1.setPreferredSize(buttonSize);
                   myJButtonSound1.setFont(myFont);
                   myJButtonSound1.setBackground(Color.orange);
                   myJButtonSound1.setForeground(Color.black);
                    //create 2nd button's object
                     myJButtonSound2 = new JButton("sound #2");
                    myJButtonSound2.addActionListener(this);
                   //set the button's border and size, font, background and foreground
                   myJButtonSound2.setBorder(myEdge);
                   myJButtonSound2.setPreferredSize(buttonSize);
                   myJButtonSound2.setFont(myFont);
                   myJButtonSound2.setBackground(Color.blue);
                   myJButtonSound2.setForeground(Color.black);
                    //create 3rd button's object
                     myJButtonSound3 = new JButton("sound #3");
                    myJButtonSound1.addActionListener(this);
                   //set the button's border and size, font, background and foreground
                   myJButtonSound3.setBorder(myEdge);
                   myJButtonSound3.setPreferredSize(buttonSize);
                   myJButtonSound3.setFont(myFont);
                   myJButtonSound3.setBackground(Color.cyan);
                   myJButtonSound3.setForeground(Color.black);
                    //create 4th button's object
                     myJButtonSound4 = new JButton("sound #4");
                    myJButtonSound4.addActionListener(this);
                   //set the button's border and size, font background and foreground
                   myJButtonSound4.setBorder(myEdge);
                   myJButtonSound4.setPreferredSize(buttonSize);
                   myJButtonSound4.setFont(myFont);
                   myJButtonSound4.setBackground(Color.pink);
                   myJButtonSound4.setForeground(Color.black);
                   //create 5th button's object
                   myJButtonSound5 = new JButton("sound #5");
                  myJButtonSound5.addActionListener(this);
                 //set the button's border and size, font background and foreground
                 myJButtonSound5.setBorder(myEdge);
                 myJButtonSound5.setPreferredSize(buttonSize);
                 myJButtonSound5.setFont(myFont);
                 myJButtonSound5.setBackground(Color.red);
                 myJButtonSound5.setForeground(Color.black);
                  //create 6th button's object
                   myJButtonSound6 = new JButton("sound #6");
                  myJButtonSound6.addActionListener(this);
                 //set the button's border and size, font, background and foreground
                 myJButtonSound6.setBorder(myEdge);
                 myJButtonSound6.setPreferredSize(buttonSize);
                 myJButtonSound6.setFont(myFont);
                 myJButtonSound6.setBackground(Color.pink);
                 myJButtonSound6.setForeground(Color.black);
                  //create 7th button's object
                   myJButtonSound7 = new JButton("Choice #7");
                  myJButtonSound7.addActionListener(this);
                 //set the button's border and size, font, background and foreground
                 myJButtonSound7.setBorder(myEdge);
                 myJButtonSound7.setPreferredSize(buttonSize);
                 myJButtonSound7.setFont(myFont);
                 myJButtonSound7.setBackground(Color.cyan);
                 myJButtonSound7.setForeground(Color.black);
                  //create 8th button's object
                   myJButtonSound8 = new JButton("Choice #8");
                  myJButtonSound8.addActionListener(this);
                 //set the button's border and size, font background and foreground
                 myJButtonSound8.setBorder(myEdge);
                 myJButtonSound8.setPreferredSize(buttonSize);
                 myJButtonSound8.setFont(myFont);
                 myJButtonSound8.setBackground(Color.yellow);
                 myJButtonSound8.setForeground(Color.black);
                  //create 9th button's object
                   myJButtonSound9 = new JButton("Choice #9");
                  myJButtonSound9.addActionListener(this);
                 //set the button's border and size, font background and foreground
                 myJButtonSound9.setBorder(myEdge);
                 myJButtonSound9.setPreferredSize(buttonSize);
                 myJButtonSound9.setFont(myFont);
                 myJButtonSound9.setBackground(Color.blue);
                 myJButtonSound9.setForeground(Color.black);
                   //add the buttons to the content pane
                   myContentPane.add(myJButtonSound1);
                   myContentPane.add(myJButtonSound2);
                   myContentPane.add(myJButtonSound3);
                   myContentPane.add(myJButtonSound4);
                   myContentPane.add(myJButtonSound5);
                   myContentPane.add(myJButtonSound6);
                   myContentPane.add(myJButtonSound7);
                   myContentPane.add(myJButtonSound8);
                   myContentPane.add(myJButtonSound9);
          public void actionPerformed(ActionEvent e)
             myJButton = (JButton)e.getSource();
            if(myJButton == myJButtonSound1)
              acSound_1.play();
            if(myJButton == myJButtonSound2)
              acSound_2.play();
            if(myJButton == myJButtonSound3)
              acSound_3.play();
            if(myJButton == myJButtonSound4)
              acSound_4.play();
            if(myJButton == myJButtonSound5)
              acSound_5.play();
             if(myJButton == myJButtonSound6)
               acSound_6.play();
                       if(myJButton == myJButtonSound7)
                         acSound_7.play();
                       if(myJButton == myJButtonSound8)
                         acSound_8.play();
                        if(myJButton == myJButtonSound9)
                          acSound_9.play();
      }

    The "should be declared abstract" error message means that you have either extended an abstract class with abstract methods that you have not implemented, or you have implemented an interface and not implemented all of its methods. Non abstract classes have to implement all methods that their base classes or interfaces declare.
    The "getAudioClip() not found" error message means that the compiler could not find the method getAudioClip(). Either your class or one of its base classes has to define this method.

  • Error WWW_FLOW_SECURITY. should be declared

    Hi,
    I install Apex 3.1.2, and when I have to change the password for admin I become the error:
    WWW_FLOW_SECURITY.G_SECURITY_GROUP_ID should be declared
    WWW_FLOW_SECURITY.G_USER should be declared
    WWW_FLOW_SECURITY.G_IMPORT_IN_PROGRESS should be declared
    WWW_FLOW_SECURITY.G should be declared
    I can not define a password for admin, eather using:
    @apxxepwd.sql or
    @apxchpwd.sql
    What can I do?
    Thanks
    Gissel

    The "should be declared abstract" error message means that you have either extended an abstract class with abstract methods that you have not implemented, or you have implemented an interface and not implemented all of its methods. Non abstract classes have to implement all methods that their base classes or interfaces declare.
    The "getAudioClip() not found" error message means that the compiler could not find the method getAudioClip(). Either your class or one of its base classes has to define this method.

  • Class should be declared error - but it is declared!

    After compilation of my coding i get the following error* but i have declared the class FLowps. Please tell me how it shoud be declared....if code needs to be seen please e-mail at [email protected] and will send the code listing.
    Thankyou.
    *test.java:18: class Flowps is public, should be declared in a file named Flowps.java
    public class Flowps extends JApplet implements ActionListener
    ^
    1 error
    Tool completed with exit code 1

    <rant>
    Why won't people just read? The compiler prints out a perfectly comprehensible error message not only telling them what's wrong, but even how to fix it, and they just throw their hands up! "It's all too hard! Why can't someone just tell me the answer? Where's my tutor?"
    Arrgh! Try working with these people: code, code, code, ooops! Red flag! Can't code any more! I don't understand!
    The supposed difference between a computer and a human is that humans are supposed to get creative when faced with a difficulty, but some of 'em make you wonder.
    </rant>

  • ERROR: schema.server.XxkocAstfHeadersEOImpl shud be declared abstract

    Dear Members,
    I have built a simple page in JDevloper and when tried to rebuild my project it gave me the below error:
    Error(17,8): class astf1.oracle.apps.ak.xxastf_h.schema.server.XxkocAstfHeadersEOImpl should be declared abstract; it does not define method setLastUpdateLogin(oracle.jbo.domain.Number) in class oracle.apps.fnd.framework.server.OAEntityImpl
    I kindly request you to please give me some suggestions to resolve the above error.
    Best Regards & Thanks,
    Arun Reddy D.

    i have created some fields like name , roll number, std. all r user editable Text input fields.
    if i enter data into these fields it should be displayed in table.
    i have created EO and added who col attributes into EO, with reference to EO created VO but i have not select who col attributes in VO,
    and with reference to VO created table .
    table is on another page as it vl be displayed once i press submit button.
    Edited by: 945985 on Sep 11, 2012 2:31 AM

  • How to declare abstract method

    given - work worked at first .
    fact - then i went to add new entity object names ScottOafE0 . went through all the next sand finished. a package and entity obj already exist. i also tried to put a new package and ScottOafAM in a seperate place. still a no go
    when i went to run the form it errors out w/ below msg.
    Error(14,8): class xxxoaf.oracle.apps.xxuab.hr.newforms.server.ScottOafEOImpl should be declared abstract; it does not define method setLastUpdateLogin(oracle.jbo.domain.Number) in class oracle.apps.fnd.framework.server.OAEntityImpl
    Guess - i tired to put import oracle.apps.fnd.framework.server.OAEntityImpl in the controller file . didnt work
    any idea how to define abstract method ?
    thanks
    scott

    You dont need to define your class as abstract, that would not resolve your issue, what is happening is
    oracle.apps.fnd.framework.server.OAEntityImpl is a abstract class, and has a method declared as setLastUpdateLogin(oracle.jbo.domain.Number) in class
    Now, any class (xxxoaf.oracle.apps.xxuab.hr.newforms.server.ScottOafEOImpl ) extending from this class must either provide a definition to this method (provide the implementation logic), or must itself be declared abstract.
    We had a discussion on this issue in the forum , look for the thread.
    Thanks
    Tapash

  • Missing method body or declare abstract error

    Hi!
    I have been working on this simple Java 1.3.1 program for three days now and cannot figure out what I am doing wrong. If anyone has done the "Building an Application" tutorial in the New to Java Programming Center, you might recognize the code. I am trying to set up a frame with panels first using the BorderLayout and then the FlowLayout within each section of the BorderLayout. It will have textfields and checkboxes. I am working on the code to retrieve the user input from the text boxes and also to determine which checkbox the user has checked. Here is my code: (ignore my irrelivent comments!)
    import java.awt.*;
    import javax.swing.*;
    import java.io.*;
    import java.awt.event.*;
    import java.awt.Color.*;
    import java.awt.Image.*;
    //Header Comment for a Routine/Method
    //This method gathers the input text supplied by the user from five text fields on the Current
    //Purchase tab of the tabbed pane of the MPGLog.java program. The way it gathers the text
    //depends on the current processing state, which it retrieves on its own. It saves the text to
    //a text file called textinput.txt.
    public class CollectTextInput extends JPanel implements ActionListener
    { // Begin class
         //Declare all the objects needed first.
         // These are the text fields
         private JTextField currentMileage;
         private JTextField numofGallonsBought;
         private JTextField dateofPurchase;
         private JTextField pricePerGallon;
         private JTextField gasBrand;
         // Declaring the Labels to go with each TextField
         private JLabel lblcurrentMileage;
         private JLabel lblnumofGallonsBought;
         private JLabel lbldateofPurchase;
         private JLabel lblpricePerGallon;
         private JLabel lblgasBrand;
         // Declaring the Checkboxes for the types of gas bought
         private JCheckBox chbxReg;
         private JCheckBox chbxSuper;
         private JCheckBox chbxUltra;
         private JCheckBox chbxOther;
         private JCheckBox chbxHigher;
         private JCheckBox chbxLower;
         // Declaring the Buttons and images needed
         private JButton enter;
         private JButton edit;
         //private JButton report; //Will be used later
         private JLabel bluecar;          //Used with the ImageIcon to create CRV image
         private JPanel carimage;     //Used in buildImagePanel method
         private JPanel datum;          //Used in buildDatumPanel method
         private JPanel gasgrade;     //Used in buildGasTypePanel method.
         //Declaring the Panels that need to be built and added
         //to the border layout of this panel.
         //private JPanel panlimages;
         //private JPanel panltextinputs;
         //private JPanel panlchkBoxes;
         // Class to handle functionality of checkboxes
         ItemListener handler = new CheckBoxHandler();
         // This is where you add the constructor for the class - I THINK!!
         public CollectTextInput()
         { // Opens collectTextInput constructor
              // Must set layout for collectTextInput here
              // Choosing a BorderLayout because we simply want to
              // add panels to the North, Center and South borders, which, by
              // default, will fill the layout with the three panels
              // we are creating
              setLayout(new BorderLayout());
              //Initialize the objects in the constructor of the class.
              //Initialize the textfields
              currentMileage = new JTextField();
              numofGallonsBought = new JTextField();
              dateofPurchase = new JTextField();
              pricePerGallon = new JTextField();
              gasBrand = new JTextField();
              // Initialize the labels that go with each TextField
              lblcurrentMileage = new JLabel("Enter the mileage at the time of gas purchase: ");
              lblnumofGallonsBought = new JLabel("Enter the number of gallons of gas bought: ");
              lbldateofPurchase = new JLabel("Enter the date of the purchase: ");
              lblpricePerGallon = new JLabel("Enter the price per gallon you paid for the gas: ");
              lblgasBrand = new JLabel("Enter the brand name of the gas: ");
              //Initialize the labels for the checkboxes.
              chbxReg = new JCheckBox("Regular ", true);
              chbxSuper = new JCheckBox("Super ");
              chbxUltra = new JCheckBox("Ultra ");
              chbxOther = new JCheckBox("Other: (Choose one from below) ");
              chbxHigher = new JCheckBox("Higher than Ultra ");
              chbxLower = new JCheckBox("Lower than Ultra ");
              //Initialize the buttons that go on the panel.
              enter = new JButton("Save Data");
              edit = new JButton("Edit Data");
              //Initialize the image that oges on the panel.
              bluecar = new JLabel("2002 Honda CR-V", new ImageIcon("CRVBlue.jpg"),JLabel.CENTER);
              // Now bring it all together by calling the other methods
              // that build the other panels and menu.
              buildImagePanel();
              buildDatumPanel();
              buildGasTypePanel();
              // Once the methods above build the panels, this call to add
              //  them will add the panels to the main panel's border
              // layout manager.
              add(datum, BorderLayout.NORTH);
              add(carimage, BorderLayout.EAST);
              add(gasgrade, BorderLayout.CENTER);
         } // Ends the constructor.
            // This method creates a panel called images that holds the car image.
         public void buildImagePanel();
         { // Opens buildImagePanel.
              // First, create the Panel
              carimage = new JPanel();
              //Second, set the color and layout.
              carimage.setBackground(Color.white);
              carimage.setLayout(new FlowLayout());
              // Third, add the image to the panel.
              carimage.add(bluecar);
         }// Closes buildImagePanel
         //This method creates a panel called datum that holds the text input.
         public void buildDatumPanel();
         { //Opens buildDatumPanel
              // First, create the Panel.
              datum = new JPanel();
              //Second, set the background color and layout.
              datum.setBackground(Color.white);
              datum.setLayout(new GridLayout(2, 4, 20, 20));
              //Third, add the textfields and text labels to the panel.
              datum.add(lblcurrentMileage);
              datum.add(currentMileage);
              datum.add(lblnumofGallonsBought);
              datum.add(numofGallonsBought);
              datum.add(lbldateofPurchase);
              datum.add(dateofPurchase);
              datum.add(lblpricePerGallon);
              datum.add(pricePerGallon);
              datum.add(lblgasBrand);
              datum.add(gasBrand);
              //Optionally - Fourth -set a border around the panel, including
              // a title.
              datum.setBorder(BorderFactory.createTitledBorder("Per Purchase Information"));
              //Fifth - Add listeners to each text field to be able to
              //  know when data is input into them.
              currentMileage.addActionListener(this);
              numofGallonsBought.addActionListener(this);
              dateofPurchase.addActionListener(this);
              pricePerGallon.addActionListener(this);
              gasBrand.addActionListener(this);
         }// Closes buildDatumPanel
         // This method builds a panel called gasTypePanel that holds the checkboxes.
         public void buildGasTypePanel()
         { // Opens buildGasTypePanel method
              // First, create the panel.
              gasgrade = new JPanel();
              // Second, set its background color and its layout.
              gasgrade.setBackground(Color.white);
              gasgrade.setLayout(new GridLayout(5, 1, 10, 20));
              // Third, add all the checkboxes to the panel.
              gasgrade.add(chbxReg);
              gasgrade.add(chbxSuper);
              gasgrade.add(chbxUltra);
              gasgrade.add(chbxOther);
              gasgrade.add(chbxHigher);
              gasgrade.add(chbxLower);
              //Optionally, - Fourth - set a border around the panel, including
              // a title.
              gasgrade.setBorder(BorderFactory.createTitledBorder("Gas Type Information"));
              // Fifth - CheckBoxes require a CheckBox Handler.
              // This is a method created separately
              // outside of the method where the checkboxes are added to
              // the panel or where the checkboxes are even created.
              // This method (CheckBox Handler) implements and ItemListener
              // and is a self-contained method all on its own. See
              // the CheckBox Handler methods following the
              // actionPerformed method which follows.-SLM
         } // Closes the buildGasTypePanel method
    // Create the functionality to capture and react to an event
    //   for the checkboxes when they are checked by the user and
    //   the text fields to know when text is entered. Also to react to the
    //   Enter button being pushed and the edit button being pushed.
    public void actionPerformed(ActionEvent evt)
    { // Opens actionPerformed method.
         if((evt.getSource() == currentMileage) || (evt.getSource() == enter))
              { // Opens if statement.
                // Retrieves the text from the currentMileage text field
                //  and assigns it to the variable currentMileageText of
                //  type String.
                String currentMileageText = currentMileage.getText();
                lblcurrentMileage.setText("Current Mileage is:    " + currentMileageText);
                // After printing text to JLabel, hide the text field.
                currentMileage.setVisible(false);
           } // Ends if statement.
          if((evt.getSource() == numofGallonsBought) || (evt.getSource() == enter))
              { // Opens if statement.
                // Retrieves the text from the numofGallonsBought text field
                //  and assigns it to the variable numofGallonsBoughtText of
                //  type String.
                String numofGallonsBoughtText = numofGallonsBought.getText();
                lblnumofGallonsBought.setText("The number of gallons of gas bought is:    " + numofGallonsBoughtText);
                // After printing text to JLabel, hide the text field.
                numofGallonsBought.setVisible(false);
           } // Ends if statement.
           if((evt.getSource() == dateofPurchase) || (evt.getSource() == enter))
                     { // Opens if statement.
                       // Retrieves the text from the dateofPurchase text field
                       //  and assigns it to the variable dateofPurchaseText of
                       //  type String.
                       String dateofPurchaseText = dateofPurchase.getText();
                       lbldateofPurchase.setText("The date of this purchase is:    " + dateofPurchaseText);
                       // After printing text to JLabel, hide the text field.
                       dateofPurchase.setVisible(false);
           } // Ends if statement.
           if((evt.getSource() == pricePerGallon) || (evt.getSource() == enter))
                            { // Opens if statement.
                              // Retrieves the text from the pricePerGallon text field
                              //  and assigns it to the variable pricePerGallonText of
                              //  type String.
                              String pricePerGallonText = pricePerGallon.getText();
                              lblpricePerGallon.setText("The price per gallon of gas for this purchase is:    " + pricePerGallonText);
                              // After printing text to JLabel, hide the text field.
                              pricePerGallon.setVisible(false);
           } // Ends if statement.
           if((evt.getSource() == gasBrand) || (evt.getSource() == enter))
                       { // Opens if statement.
                         // Retrieves the text from the gasBrand text field
                         //  and assigns it to the variable gasBrandText of
                         //  type String.
                         String gasBrandText = gasBrand.getText();
                         lblgasBrand.setText("The Brand of gas for this purchase is:    " + gasBrandText);
                         // After printing text to JLabel, hide the text field.
                         gasBrand.setVisible(false);
           } // Ends if statement.
           // This provides control statements for the Edit button. If the
           //  Edit button is clicked, then the text fields are visible again.
           if(evt.getSource() == edit)
           { // Opens if statement.
             // If the edit button is pressed, the following are set to
             //  visible.
                currentMileage.setVisible(true);
                numofGallonsBought.setVisible(true);
                dateofPurchase.setVisible(true);
                pricePerGallon.setVisible(true);
                gasBrand.setVisible(true);
         }// Closes if statement.
    } // Closes actionPerformed method.
         private class CheckBoxHandler implements ItemListener
         { // Opens inner class
              public void itemStateChanged (ItemEvent e)
              {// Opens the itemStateChanged method.
                   JCheckBox source = (JCheckBox) e.getSource();
                        if(e.getStateChange() == ItemEvent.SELECTED)
                             source.setForeground(Color.blue);
                        else
                             source.setForeground(Color.black);
                        }// Closes the itemStateChanged method
                   }// Closes the CheckBoxHandler class.
    } //Ends the public class collectTextInput classThe error I keep receiving is as follows:
    C:\jdk131\CollectTextInput.java:128: missing method body, or declare abstract
         public void buildImagePanel();
    ^
    C:\jdk131\CollectTextInput.java:142: missing method body, or declare abstract
         public void buildDatumPanel();
    ^
    2 errors
    I have looked this error up in three different places but the solutions do not apply to what I am trying to accomplish.
    Any help would be greatly appreciated!! Thanks!
    Susan

    C:\jdk131\CollectTextInput.java:128: missing methodbody, or declare ?abstract
    public void buildImagePanel();^
    C:\jdk131\CollectTextInput.java:142: missing methodbody, or declare abstract
    public void buildDatumPanel();Just remove the semicolons.
    Geesh! If I had a hammer I would be hitting myself over the head with it right now!!! What an obviously DUMB newbie mistake!!!
    Thanks so much for not making me feel stupid! :-)
    Susan

  • Error message  "missing method body, or declare abstract"

    This is my test driver. Does anyone know why it is not working?
    public class TestInfo
       public static void main(String args[])
              Info results = new Info();
              printInfo();
         public static String printInfo();
              System.out.println(" The Diameter is: " + results.diam
              + " The Circumference is: " + results.circum
              + " The Area is: " + results.area);
    }The error message I get is: missing method body, or declare abstract
    The print block has to be a separate method. The print block works when I put it in main. When it is in a separate method and I call it in main it doesn't work

    You have an extraneous semi-colon after printInfo. This tells the compiler that that's all there is for that method, which only makes sense if it's an abstract method. It sees the block after the semicolon, but it thinks it's an initializer. So it wants you to either declare it abstract, or give it a method body.
    Just remove that semicolon and you're fine.

  • Class is public, should be declared in a file?

    So I'm running a program called BankAccount.java. When I tried to comile it (javac BankAccount.java) I get a message that says
    BankAccount.java:4:class InsufficientFundsException is public, should be declared in a file named InsufficientFundsException.java
    public class InsufficientFundsException extends Exception
    ^
    1 error
    In case you need to see it, my code is
    import java.util.*;
    import java.text.*;
    public class InsufficientFundsException extends Exception
    private int accountNumber;
    private int withdrawAmount;
    private int balanceAmount;
    private Date date;
    private DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.US);
    private NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.US);
    public InsufficientFundsException(int actNumb,
    int amount,
    int balance)
    date = new Date();
    accountNumber = actNumb;
    withdrawAmount = amount;
    balanceAmount = balance;
    public String toString()
    return getClass().getName() + " on " + df.format(date)
    + ". Withdraw of " + nf.format(withdrawAmount)
    + " rejected. Balance of account #" + accountNumber
    + " remains at " + nf.format(balanceAmount) ;
    }

    Actually I did. This is how it is right now
    BankAccount.java
    import java.util.*;
    import java.text.*;
    public String toString()
    return getClass().getName() + " on " + df.format(date)
    + ". Withdraw of " + nf.format(withdrawAmount)
    + " rejected. Balance of account #" + accountNumber
    + " remains at " + nf.format(balanceAmount) ;
    InsufficientFundsException.java
    public class InsufficientFundsException extends Exception
    private int accountNumber;
    private int withdrawAmount;
    private int balanceAmount;
    private Date date;
    private DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.US);
    private NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.US);
    public class InsufficientFundsException(int actNumb,
    int amount,
    int balance)
    date = new Date();
    accountNumber = actNumb;
    withdrawAmount = amount;
    balanceAmount = balance;
    So do I run the bank one first?

  • What class should be imported to resolve the error

    Dear all,
    would you please tell me that what class should i import to resolve the error for PreparedStatement.
    plz mention the import statement
    Error(437,13): class PreparedStatement not found in class oracle.apps.ak.cacheoffice.server.CacheOfficeAMImpl

    import java.sql.PreparedStatement;

  • Initialization error : class file has wrong version 49.0, should be 45.3 or

    I have Jdeveloper Base installation and JDK 1.5..the classpath and JAVA_HOME environment variables are set to the respective JDK1.5\bin folders. Even then when i try to make a web application, with a simple JSP page i get the following error :
    Initialization error: class file has wrong version 49.0, should be 45.3 or 46.0 or 47.0 or 48.0 on CLASSPATH ..(followed by a long list of paths)
    pls help,
    thanks

    i have windows XP. i have tried to unset the class path...i get the same error.
    i have JDeveloper 10g 10.1.2.
    i have changed the jdev.conf file to set the Java Home to the path that contains the JDK 1.5..

  • When should I use abstract classes and when should I use interfaces?

    Can any body tell me in which scenario we use /we go for Interface and which scenario we go for abstract class, because as per my knowledge what ever thing we can do by using Interface that thing can also done through abstract class i mean to say that the
    behavior of the two class.
    And other thing i also want to know that which concept comes first into the programming abstract class or Interface.
    S.K Nayak

    The main differences between an abstract class and an interface:
    Abstract
    An abstract class can contain actual working code (default functionality), and can have either virtual or abstract method.
    An abstract class must be sub-classed and only the sub-classes can be instantiated. Abstract methods must be implemented in the sub-class. Virtual methods may be overridden in the sub-class (although virtual methods typically contain code, you still may
    need/want to override them). A good use for an abstract class is if you want to implement the majority of the functionality that a class will need, but individual sub-classes may need slightly different additional functioality.
    Interface
    An interface only contains the method signatures (method name and parameters), there is no code and it is not a class.
    An interface must be implemented by a class. An interface is not a class and so it cannot be sub-classed. It can only be implemented by a class. When a class implements an interface, it must have code in it for each method in the interface's definition.
    I have a blog post about interfaces:
    http://geek-goddess-bonnie.blogspot.com/2010/06/program-to-interface.html
    (sorry, I have no blog posts specific to abstract classes)
    ~~Bonnie DeWitt [C# MVP]
    http://geek-goddess-bonnie.blogspot.com

  • Missing method body or declare abstract...

    Hi There,
    Im working on an assignment that works with the math class and performs a bunch of mathematical functions. Im trying to declare the different fields in the math class and I keep getting error messages!!
    This is what I have right now
    public class Math
        // Returns the absolute value of a double value.
        double abs(double a);
        // Returns the absolute value of a int value.
        int abs(int a);
        //Returns the greater of two double values.
        double max(double a, double b);
        //Returns the greater of two int values.
        int max(int a, int b);
        // Returns the lesser of two double values.
        double min(double a, double b);
        // Returns the lesser of two double values.
        int min( int a, int b);
        // Returns the value of the first argument raised to the power of
        // the second argument.
        double pow(double a, double b);
        // Returns the remainder of division of two integers.
        int remainder(int a, int b);
        // Returns the closest long to the argument.
        long round(double a);
        // Returns the sum of all the elements in an array of doubles.
        double sum(double [] doubleArr);
        // Returns the sum of all the elements in an array of ints.
        int sum(int [] intArr);
        // Storage for the list of integers used for the int sum method.
        private int [] intArray = {5, 10, 15, 20};
        // Storage for the list of doubles to be used double sum method.
        private double [] doubleArray = {5.25, 10.00, 14.50, 21.90};
        }When I try and compile it tells me that Im missing method body or declare abstract.
    I originally had this
       // Returns the absolute value of a double value.
        double abs;
        // Returns the absolute value of a int value.
        int abs;
        //Returns the greater of two double values.
        double max;
        //Returns the greater of two int values.
        int max;
        // Returns the lesser of two double values.
        double min;
        // Returns the lesser of two double values.
        int min;
        // Returns the value of the first argument raised to the power of
        // the second argument.
        double pow;
        // Returns the remainder of division of two integers.
        int remainder;
        // Returns the closest long to the argument.
        long round;
        // Returns the sum of all the elements in an array of doubles.
        double sum(double [] doubleArr);
        // Returns the sum of all the elements in an array of ints.
        int sum(int [] intArr);
        // Storage for the list of integers used for the int sum method.
        private int [] intArray = {5, 10, 15, 20};
        // Storage for the list of doubles to be used double sum method.
        private double [] doubleArray = {5.25, 10.00, 14.50, 21.90};When i tried doing this it told me that I had already declared the field previously when it got the the field with the same name and thats why I added the bit in brackets.....
    Im so lost... can anybody hep????

    hi,
    here is your code...
    modified by correcting my bad habit...
    he..he...
    public class Math
        // Returns the absolute value of a double value.
        double abs(double a){return 0.0;}
        // Returns the absolute value of a int value.
        int abs(int a){return 0;}
        //Returns the greater of two double values.
        double max(double a, double b){return 0.0;}
        //Returns the greater of two int values.
        int max(int a, int b){return 0;}
        // Returns the lesser of two double values.
        double min(double a, double b){return 0.0;}
        // Returns the lesser of two double values.
        int min( int a, int b){return 0;}
        // Returns the value of the first argument raised to the power of
        // the second argument.
        double pow(double a, double b){return 0.0;}
        // Returns the remainder of division of two integers.
        int remainder(int a, int b){return 0;}
        // Returns the closest long to the argument.
        long round(double a){return 0.0;}
        // Returns the sum of all the elements in an array of doubles.
        double sum(double [] doubleArr){return 0.0;}
        // Returns the sum of all the elements in an array of ints.
        int sum(int [] intArr){return 0;}
        // Storage for the list of integers used for the int sum method.
        private int [] intArray = {5, 10, 15, 20};
        // Storage for the list of doubles to be used double sum method.
        private double [] doubleArray = {5.25, 10.00, 14.50, 21.90};
        }if you want to extend Math class to any other class.. then make all the methods abstract
    dhaval.
    Edited by: Dhaval.Yoganandi on 1 Mar, 2008 3:48 PM

Maybe you are looking for