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

Similar Messages

  • 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.

  • 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

  • Color2.java:89: missing method body, or declare abstract

    I am creating a color chooser applet but I keep receiving this error please help me to resolve this as my heads wrecked.
    Here is my code:
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    public class Color2 extends Applet implements AdjustmentListener, ActionListener
              Scrollbar redbar, grebar, blubar;
              TextField rfield, gfield, bfield;
              myColorSquare cSquare = new myColorSquare();
         public void init()
              cSquare.setSize(100,100);
              this.add(cSquare);
              Panel n= new Panel(new GridLayout(3,3));
              n.add(new Label("Red (0-255)"));
              this.redbar = new Scrollbar(Scrollbar.HORIZONTAL,0,10,0,265);
              this.redbar.addAdjustmentListener(this);
              n.add(redbar);
              this.rfield = new TextField("0",5);
              this.rfield.addActionListener(this);
              n.add(rfield);
              n.add(new Label("Green(0-255)"));
              this.grebar = new Scrollbar(Scrollbar.HORIZONTAL,0,10,0,265);
              this.grebar.addAdjustmentListener(this);
              n.add(grebar);
              this.gfield = new TextField("0",5);
              this.gfield.addActionListener(this);
              n.add(gfield);
              n.add(new Label("Blue(0-255)"));
              this.blubar = new Scrollbar(Scrollbar.HORIZONTAL,0,10,0,265);
              this.blubar.addAdjustmentListener(this);
              n.add(blubar);
              this.bfield = new TextField("0",5);
              this.bfield.addActionListener(this);
              n.add(bfield);
              this.add(n);
         private void updateColor()
              int red = this.redbar.getValue();
              int green = this.grebar.getValue();
              int blue = this.blubar.getValue();
              this.rfield.setText(""+red);
              this.gfield.setText(""+green);
              this.bfield.setText(""+blue);
              Color aColor = new Color(red,green,blue);
              this.cSquare.updateColor(aColor);
         public void adjustmentValueChanger(AdjustmentEvent e)
              this.updateColor();
         public void ActionPerformed(ActionEvent e)
                   if (e.getSource().equals(this.rfield))
                        int red = new Integer(this.rfield.getText()).intValue();
                        this.redbar.setValue(red);
                   if(e.getSource().equals(this.rfield))
                        int blue = new Integer(this.bfield.getText()).intValue();
                        this.blubar.setValue(blue);
                   if (e.getSource().equals(this.bfield))
                        int green = new Integer(this.gfield.getText()).intValue();
                        this.grebar.setValue(green);
                   this.updateColor();
              class myColorSquare extends Canvas
              Color c = Color.black;
              public void paint(Graphics g);
                        g.setColor(this.c);
                        g.fillRect(0,0,this.getSize().width, this.getSize().height);
              public void updateColor(Color v)
                        this.c = v;
                        this.repaint();

    What happens if:
    public void adjustmentValueChanger(AdjustmentEvent e)
    is changed to:
    public void adjustmentValueChanged(AdjustmentEvent e)

  • Java.lang.RuntimeException: Uncompilable source code - missing method body

    Hi,
    I am getting the following error at runtime
    java.lang.RuntimeException: Uncompilable source code - missing method body, or declare abstractwhen I try to instantiate a class using reflexion as following:
    MyInstance = MyClass.newInstance(); I have tried to find some explanation using Google, but could not find any that fit my case. MyClass's implementation has a public constructor with no parameter. There is no error at compile time when cleaning and building all code.
    Anyone has tips about what could cause this error?
    Thanks.

    Jrm wrote:
    It is not my code originally... You are making far too many unchecked assumptions about the reality of this situation to even get close to what that reality it is... Get over patronizing, it would improve your social/people skills... Thanks !It is your own problem that you perceive something as patronizing, while in fact it was only an honest and straight to the point attempt to help you. This forum does not deal in sensitivity, it gets in the way of helping people to see the error of their ways.

  • Missing method body and cannot resolve symbol

    I keep getting these two errors when trying to compile. I know that I need to call my fibonacci and factorial functions from the main function. Is this why I am getting the missing method body error? How do I correct this?
    Am I getting the cannot resolve symbol because I have to set the num and fact to equal something?
    Thanks
    public class Firstassignment
    public static void main(String[]args)
         System.out.println();
    public static void fibonacci(String[]args);
         int even=1;
         int odd=1;
         while (odd<=100);
         System.out.println(even);
         int temp = even;
         even = odd;
         odd = odd + temp;
    public static void factorial (String[]args);
         for (int count=1;
         count<=num;
         count++);
         fact = fact * count;
         outputbox.printLine("Factorial of" + num + "is" + fact);

    Hey... :o)
    the problem is that you've put semicolons at the end of the function signature, like this:
    public static void fibonacci(String[]args);
    }that should happen only when the function is abstract... so ur function should actually look like this:
    public static void fibonacci(String[]args)
    }also, i think you've missed out on the declarations (like what are fact and num??)....

  • Missing method body

    class Board
        public static void main(String[] args)
            Board example = new Board();
        private Board();
            char array[][];
            array = new char[3][3];
            for (int i = 0; i < 3; i++)
                for (int j = 0; j < 3; j++)
                    array[i][j] = '.';
                    System.out.println(array[i][j]);
    }compiler says missing method body, but i can't think where the error is? private Board has to be a constructor.

    Are you using a text editor or an IDE? If you are already fairly familiar with the Java programming language and the java/javac and you understand how classpath works, then you might consider to step over from the text editor to an IDE, such as Eclipse. It will save time and effort in developing. I tried to reproduce your problem in Eclipse and it clearly understrikes the "Board();" part during typing and says "This method requires a body instead of a semicolon" which makes much more sense.

  • "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.

  • Compiling Error Method body missing

    Ok so i have a program that reads in 6 grades for 10 different students takes the avg and prints outs the Name 6 scores avg and the letter grade they would recieve in a nice chart using printf in my main method i get the error MIssing method body or declare abstract. Any help as to why i am getting this would be much appreciated.
    import java.util.*;
    import java.io.*;
    public class Finals
        static Scanner input = new Scanner(System.in);
        public static void main(String[] args)throws IOException;
            Scanner inFile = new Scanner(FileReader("Grades.txt"));
            double [] [] scores = new double [10] [6];
            String [] name = new String [10];
            double [] grade = new double [6];
            char [] lettergrade = new char [10];
            int row = 0;
            int collum = 0;
            int collum2 = 0;
            int index = 0;
            while(inFile.hasNext())
                name[index] = input.Next();
                while(collum < 9)
                    scores[row][collum] = input.nextDouble();
                    collum = collum + 1;
                collum = 0;
                row = row + 1;
            inFile.Close();
            calculation(score, name, grade);
            print(score, grade, name, lettergrade);
        public static int calculation(double [] [] score, String [] name, double [] grade)
            int index = 0;
            int row = 0;
            int collum = 0;
            int j = 0;
            int m = 0;
            int k = 0;
            //add all the grades in the first row store that into a new array called average than run through a loop to find out what letter grade it equals store letter grade in a char array
            while(collum < 10)
                grade[j] = grade[j] + score[collum][row];
                row ++;
                if(row == 6)
                    collum ++;
                    row = 0;
                    j ++;
            return grade;
        public static void print(double [] [] score, String [] name, double [] grade, char [] lettergrade)
            int index = 0;
            int j = 0;
            while(index < 10)
                if(score[j] >= 92.5)
                    lettergrade[j] = 'A';
                    j ++;
                    index ++;
                else if(score[j] >= 82.5 && score[j] < 92.5)
                    lettergrade[j] = 'B';
                    j ++;
                    index ++;
                else if(score[j] >= 72.5 && score[j] < 82.5)
                    lettergrade[j] = 'C';
                    j ++;
                    index ++;
                else if(score[j] >= 62.5 && score[j] < 72.5)
                    lettergrade[j] = 'D';
                    j ++;
                    index ++;
                else
                    lettergrade[j] = 'F';
                    j ++;
                    index ++;
            System.out.println("Student    Test1   Test2   Test3   Test4   Test5   Average   Grade");
            System.out.printf("11%s40%d8%d5%c", name, score, grade, lettergrade);
    }

    public static void main(String[] args)throws IOException;Remove that semicolon.

  • Getting missing method error - first attempt at arrays

    I'm trying to work with arrays for the first time ever - I understand the concept, but can't quite get the syntax down. Here is the class which won't compile and is giving me a missing method body or declare abstract message - please help me understand what I'm doing wrong.
    import java.util.Scanner;
    import static java.lang.System.out;
    public class Inventory
      //declare and initialize variables
       private int itemNumber = 0;
       private String productName;
       private int stockAmount = 0;
       private double productCost = 0;
       private double totalValue = 0;
       private double totalInventory = 0;
       //initialize scanner
       Scanner input = new Scanner(System.in);
       public Inventory (int itemNumber, String productName, int stockAmount,
               double productCost, double totalValue);
       out.println("Please enter item number: "); //prompt for item number
          itemNumber = input.nextInt();
       out.println( "Enter product name/description: "); //prompt for product name
          productName = input.next();
       out.println("Quantity in stock: ");
          stockAmount = input.nextInt(); // prompt for stock quantity
       out.println("What is the product cost for each unit? ");
          productCost = input.nextDouble(); // prompt for product cost
            totalValue = stockAmount * productCost; //calculate stock value
          } // end calculate stock value
          { //request for inventory details
            out.printf("%s, which is item number %d, has %d pieces currently in " +
                "stock at a price of %.2f each. The total value of " +
                "inventory in stock is %.2f\n.", productName, itemNumber, +
                stockAmount, productCost, totalValue);
          } // end request
      }// end classHere is my main method - I don't think I'm referencing things the way I'm supposed to.
    public class Main {
      public static void main(String[] args) { //start main method
            Inventory inventory = new Inventory(); //call Inventory class
            inventory.inventoryInput();
    }

    LOL - you are right, I don't really know what I'm doing. I don't understand this and am just trying to muddle my way through this whole thing...as you can tell I'm facing many challenges.
    Here is how I've changed my main method and the Inventory class - still getting error messages though - any additional hints/suggestions?
    Inventory class
    import java.util.Scanner;
    import static java.lang.System.out;
    public class Inventory
      //declare and initialize variables
       private int itemNumber = 0;
       private String productName;
       private int stockAmount = 0;
       private double productCost = 0;
       private double totalValue = 0;
       private double totalInventory = 0;
       //initialize scanner
       Scanner input = new Scanner(System.in);
       public Inventory (int itemNumber, String productName, int stockAmount,
               double productCost, double totalValue)
       out.println("Please enter item number: "); //prompt for item number
          itemNumber = input.nextInt();
       out.println( "Enter product name/description: "); //prompt for product name
          productName = input.next();
       out.println("Quantity in stock: ");
          stockAmount = input.nextInt(); // prompt for stock quantity
       out.println("What is the product cost for each unit? ");
          productCost = input.nextDouble(); // prompt for product cost
            totalValue = stockAmount * productCost; //calculate stock value
          } // end calculate stock value
          { //request for inventory details
            out.printf("%s, which is item number %d, has %d pieces currently in " +
                "stock at a price of %.2f each. The total value of " +
                "inventory in stock is %.2f\n.", productName, itemNumber, +
                stockAmount, productCost, totalValue);
          } // end request
      }// end classMain method
    public class TestInventory
        public static void main(String[] args)
        {Inventory[] inventoryArray = new Inventory[3];
         inventoryArray[0] = new Inventory(0, 2541, Radios, 14, 15.95);
         inventoryArray[1] = new Inventory(1, 1685, VCR, 10, 98.95);
         inventoryArray[2] = new Inventory(2, 5872, Clock, 8, 12.95);
         For (Inventory inventory : inventoryArray)
             System.out.println(Inventory);
    }

  • Error during transport: Method is not declared + Component missing

    HI
    I got 2 errors when I transport:
    Error 1:
    Program ZCL_ZGW_VH_ORDER_DETAI_DPC_EXTCP, Include ZCL_ZGW_VH_ORDER_DETAI_DPC_EXTCO: Syntax error in line 000003
    Method 'DETSET_GET_ENTITY' is not declared or inherited in class 'ZCL_ZGW_VH_ORDER_DETAI_DPC_EXT'. -
    Error 2:
    Program ZCL_ZGW_VH_ORDER_DE_01_DPC====CP, Include ZCL_ZGW_VH_ORDER_DE_01_DPC====CM006: Syntax error in line 000190
    The data object 'LS_ET_DETAILS' does not have a component called 'ZZ_MATR_LEV_DATO'.
    1)
    When I go to Class Builder (SE24), and make a syntax check for ZCL_ZGW_VH_ORDER_DETAI_DPC_EXT, I got the error:
    Class ZCL_ZGW_VH_ORDER_DETAI_DPC_EXT,Protected section
    Method "DETSET_GET_ENTITY" is not declared or inherited in class
    "ZCL_ZGW_VH_ORDER_DETAI_DPC_EXT". -
    The code looks like this
    protected section.
      methods DETSET_GET_ENTITY
        redefinition .
    2)
    If I go to include ZCL_ZGW_VH_ORDER_DE_01_DPC====CM006 (in SE38), I am navigated to method: DETSET_GET_ENTITYSET (That was the missing method in error 1). When I do a syntax check, I got the error message:
    Class ZCL_ZGW_VH_ORDER_DE_01_DPC,Method DETSET_GET_ENTITYSET
    The data object "LS_ET_DETAILS" does not have a component called
    "ZZ_MATR_LEV_DATO".
    Then I double click at ls_gw_et_details-zz_matr_lev_dato, and got the data statement: DATA ls_gw_et_details LIKE LINE OF et_entityset.
    When I double click at et_entityset, I see that the et_enityset is type ZCL_ZGW_VH_ORDER_DE_01_MPC=>TT_ORDDET. Now I double click at TT_ORDDET I got the public section, where I can see that ZZ_MATR_LEV_DATO is already specified.
         ZZ_SPORSP_DATO type D,
         ZZ_KSTROM type STRING,
         ZZ_KSTROM_DATO type D,
         ZZ_MATR_LEV_DATO type D,
      end of TS_ORDDET. .
      types:
    TT_ORDDET type standard table of TS_ORDDET. .
    Anyone who will help me?
    Thanks
    Lars

    Hi Ron Sargeant,
    I'm having a kind of similar issue. I have 3 entities, they were already mapped to theirs respective RFC. In the RFC, a couple of fields changed their name so the mapping got lost. I did again the mapping and there was no errors on 2 of the 3 entities. For other reasons, I had to delete the third entitiy, I deleted it and created it again and there was no problems, I do the mapping and everything was apparently fine, when I tried to "Generate Runtime Objects" it throws me an error with the next message: "Failed to create data provider class". If I try to Generate the service again, it throws me another error message: "The class ZCL_xxx_xx_xxxxxx_DPC is locked. Process canceled". I'm sure I've not edited or deleted the DPC class. If I try to access the DPC class from the tx SE24 it tells me that the object it's not created, and the class still appears in the list of Runtime Artifacts in tx SEGW.
    I'd like to know if you've got any idea of what may happen, or I'd also like to be sure that if I delete the DPC class and the DPC_EXT class, it will be regenerated again by the Service Builder.
    Best regards,
    Ana Velásquez

  • 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

  • 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

  • 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

  • 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();               

Maybe you are looking for