Compiler not inferring legal methods correctly?

The following sample code:public class Tester {
  public static <E extends Integer> void doit ( final E[] a ) {
    System.out.println ( a[0] / 4 ) ;
  public static void main ( final String[] args ) {
    Tester.doit ( new Integer[] { 2 , 3 , 4 } ) ;           
}results in the error message:
Tester.java:3: cannot find symbol
symbol : method intValue()
location: bound of type variable E
System.out.println ( a[0] / 4 ) ;
^
Fatal Error: Unable to find method intValue
I think the compiler is wrong here but then I may be wrong :-) The type parameter E has least upper bound Integer and so the compiler knows that a[0] is required to have an intValue method (from Number). The issue is nothing to do with the method being static as you get the same error message with a non-static method.
I suspect that the compiler is treating E as having least upper bound of Object since it can find the toString method -- you can show this by removing the "/ 4" from the code.

Note that this is an autoboxing bug. It's only tangentially related to generic syntax.It is an autoboxing issue but it is also a type lookup issue in the compiler relating to bounds on a type parameter. I am not sure you would get the problem except with generic methods but I haven't tried so I may be talking b$$$$$$$.
Are you saying you want to extend Integer to create classes that are doing other things than just being integers?Actually I would like to be able to extend Integer (and Long) to create subrange types that are primitive integer values boxed with fixed range. This is trivial in C++ (see http://www.russel.org.uk/subrange.html) and I was investigating doing the same thing in Java.
Wouldn't it be better to create an interface like RadixSortable which would supply an int representation of the Object?Unfortuately it is Integers that need to be sorted and they could not be made RadixSortable :-(
I have a class RadixSort with a method sort. I am fiddling with various implementations to show design decisions so there isn't just one solution that I am interested in -- the library is for teaching and so having examples of different design issues is important unlike Collections and JGL where you just need the right functionality with the fastest possible implementation.
The reason they are final is that they are the primitve wrapper classes. To behave like primitives, they must be immutable. If they were extensible, mutable Integer types could be created.Is this certain? If the state is private the subclasses could not change the value and immutability is retained. What I wanted was the ability to create subrange integral types which could use expression syntax.
(Given the way Java is organized real subrange types are seemingly impossible but . . . )
I'm not sure how improving Number (I agree it could be improved upon) would solve your issues. I am not sure there is a problem with Number per se since the methods that are common to Short, Integer, Long, Float and Double are few and far between. What I think is missing is the notions of integral (Short, Integer, Long) to allow algorithms that do not actually depend on the bounds of values representable.
However this is all diverging far from the "generics" issues that this forum is about :-)

Similar Messages

  • Java Virtual Machine "Could not find main method"  what do i do?

    Hi I'm very new to java and for my class we are to make an applet and make a class. I figured out how to do it but the Java Virtual Machine gives me an error when I go to run the applet."Could not find the main method. Program Will exit!" . I am using Jbuilder8 personal to compile the code. Using j2sdk1.4.0_03. Could someone tell me how to fix this? Or what I'm doing wrong?
    Here is my code.
    package assignment5;
      Program: Program 5.2
      Author: Will W.
      Date: 02/20/03
      Description: Create a student class that holds the
      student name, student ID, phone and number of units
      completed. Create methods and a applet to input data
      Dispay the student name, student ID, phone, units
      completed in a text area.
    import java.applet.*;
    import java.awt.event.*;
    import java.awt.*;
    public class Assignment5Applet extends Applet implements ActionListener
         //Create Components
         //TextFields
         TextField txtName = new TextField(25);
         TextField txtId  = new TextField(15);
         TextField txtPhone = new TextField(15);
         TextField txtUnits = new TextField(4);
         //TextArea
         TextArea txaList = new TextArea(20,40);
         //Button
         Button btnAdd = new Button("Go");
         //Labels mostly debugging purposes.
         Label lblOutput = new Label();
         Label lblNumberProcessed = new Label();
         Label lblError = new Label();
         public void init()
              //Create the interface for the applet
              Panel pnlLayout = new Panel(new GridLayout(5, 2));
              pnlLayout.add(new Label("Name:"));
              pnlLayout.add(txtName);
              pnlLayout.add(new Label("Student Id:"));
              pnlLayout.add(txtId);
              pnlLayout.add(new Label("Phone #:"));
              pnlLayout.add(txtPhone);
              pnlLayout.add(new Label("Num Units:"));
              pnlLayout.add(txtUnits);
              add(pnlLayout);
              add(btnAdd);
              add(txaList);
              txtName.requestFocus();
              btnAdd.addActionListener(this);
              txtName.addActionListener(this);
              txtId.addActionListener(this);
              txtPhone.addActionListener(this);
              txtUnits.addActionListener(this);
         public void actionPerformed(ActionEvent evt)
                    //Variables to hold the data in the textboxes
              String strName;
              String strId;
              String strPhone;
              String strUnits;
              try
                   //Get the data
                   strName = txtName.getText();
                   strId = txtId.getText();
                   strPhone = txtPhone.getText();
                   strUnits = txtUnits.getText();
                            //Instantiate a student object
                            Student aStudent = new Student(strName, strId, strPhone, strUnits);
                            //Use get student to get the output
                         txaList.append("Output:" + aStudent.getStudent());
                   lblOutput.setText("");
              catch(NumberFormatException e)
                   lblOutput.setText("Error");
    }The my student class
    package assignment5;
      * Program: Student.java
      * Author: Will W.
      * Date: 02/20/03
      * Descrip:
      * Student Class for Assignment5Applet.java
      * Contains one constructor and 5 other methods
      * for the class
    public class Student
            //Class Variables
            private String  strName;
            private String strId;
            private String strPhone;
            private String strUnits;
            private String strOutput;
            //Constructor
            public Student(String strNewName, String strNewId, String strNewPhone, String strNewUnits)
              setName(strNewName);
              setId(strNewId);
              setPhone(strNewPhone);
              setUnits(strNewUnits);
            //Methods
            public void setName(String strNewName)
                    //Assign new value to private variable
                    strName = strNewName;
            public void setId(String strNewId)
                    strId = strNewId;
            public void setPhone(String strNewPhone)
                    strPhone = strNewPhone;
            public void setUnits(String strNewUnits)
                    strUnits = strNewUnits;
            public String getStudent()
                    //Put the output together
                    strOutput = strName + "\n" + strId + "\n" + strPhone + "\n" + strUnits;
                    return strOutput;
    }Everythings seems to compile correctly without errors it's just when I execute to the running program that the Java Virtual Machine throws me that error saying it can't find the main method.

    Java Virtual Machine "Could not find main method" what do i do?
    Ok Ok OK I got the solution for you ,this is what you do you put your hands inbetweenj you leggs and run around in a circle can scream me nuts me nuts me nuts are on fire,then come back and tell use if the problem is solved or not
    Good luck hehehehe:P

  • ...is not abstract and does not override abstract method compare

    Why am I getting the above compile error when I am very clearly overriding abstract method compare (ditto abstract method compareTo)? Here is my code -- which was presented 1.5 code and I'm trying to retrofit to 1.4 -- followed by the complete compile time error. Thanks in advance for your help (even though I'm sure this is an easy question for you experts):
    import java.util.*;
       This program sorts a set of item by comparing
       their descriptions.
    public class TreeSetTest
       public static void main(String[] args)
          SortedSet parts = new TreeSet();
          parts.add(new Item("Toaster", 1234));
          parts.add(new Item("Widget", 4562));
          parts.add(new Item("Modem", 9912));
          System.out.println(parts);
          SortedSet sortByDescription = new TreeSet(new
             Comparator()
                public int compare(Item a, Item b)   // LINE CAUSING THE ERROR
                   String descrA = a.getDescription();
                   String descrB = b.getDescription();
                   return descrA.compareTo(descrB);
          sortByDescription.addAll(parts);
          System.out.println(sortByDescription);
       An item with a description and a part number.
    class Item implements Comparable     
          Constructs an item.
          @param aDescription the item's description
          @param aPartNumber the item's part number
       public Item(String aDescription, int aPartNumber)
          description = aDescription;
          partNumber = aPartNumber;
          Gets the description of this item.
          @return the description
       public String getDescription()
          return description;
       public String toString()
          return "[descripion=" + description
             + ", partNumber=" + partNumber + "]";
       public boolean equals(Object otherObject)
          if (this == otherObject) return true;
          if (otherObject == null) return false;
          if (getClass() != otherObject.getClass()) return false;
          Item other = (Item) otherObject;
          return description.equals(other.description)
             && partNumber == other.partNumber;
       public int hashCode()
          return 13 * description.hashCode() + 17 * partNumber;
       public int compareTo(Item other)   // OTHER LINE CAUSING THE ERROR
          return partNumber - other.partNumber;
       private String description;
       private int partNumber;
    }Compiler error:
    TreeSetTest.java:25: <anonymous TreeSetTest$1> is not abstract and does not over
    ride abstract method compare(java.lang.Object,java.lang.Object) in java.util.Com
    parator
                public int compare(Item a, Item b)
                           ^
    TreeSetTest.java:41: Item is not abstract and does not override abstract method
    compareTo(java.lang.Object) in java.lang.Comparable
    class Item implements Comparable
    ^
    2 errors

    According to the book I'm reading, if you merely take
    out the generic from the code, it should compile and
    run in v1.4 (assuming, of course, that the class
    exists in 1.4). I don't know what book you are reading but that's certainly incorrect or incomplete at least. I've manually retrofitted code to 1.4, and you'll be inserting casts as well as replacing type references with Object (or the erased type, to be more precise).
    These interfaces do exist in 1.4, and
    without the generics.Exactly. Which means compareTo takes an Object, and you should change your overriding method accordingly.
    But this raises a new question: how does my 1.4
    compiler know anything about generics? It doesn't and it can't. As the compiler is telling you, those interfaces expect Object. Think about it, you want to implement one interface which declares a method argument type of Object, in several classes, each with a different type. Obviously all of those are not valid overrides.

  • Product is not abstract and does not override abstract method

    Received the following errors.
    Product.java:3: Product is not abstract and does not override abstract method ge
    tDisplayText() in Displayable
    public class Product implements Displayable
    ^
    Product.java:16: getDisplayText() in Product cannot implement getDisplayText() i
    n Displayable; attempting to use incompatible return type
    found : void
    required: java.lang.String
    public void getDisplayText()
    ^
    2 errors
    Code reads as follows
    import java.text.NumberFormat;
    public class Product implements Displayable
         private String code;
         private String description;
         private double price;
         public Product()
              this.code = "";
              this.description = "";
              this.price = 0;
    public void getDisplayText()
    String message =
    "Code: " + code + "\n" +
    "Description: " + description + "\n" +
    "Price: " + this.getFormattedPrice() + "\n";
         public Product(String code, String description, double price)
              this.code = code;
              this.description = description;
              this.price = price;
         public void setCode(String code)
              this.code = code;
         public String getCode(){
              return code;
         public void setDescription(String description)
              this.description = description;
         public String getDescription()
              return description;
         public void setPrice(double price)
              this.price = price;
         public double getPrice()
              return price;
         public String getFormattedPrice()
              NumberFormat currency = NumberFormat.getCurrencyInstance();
              return currency.format(price);
    Please help!

    Received the following errors.
    Product.java:3: Product is not abstract and does not
    override abstract method ge
    tDisplayText() in Displayable
    public class Product implements Displayable
    ^
    Product.java:16: getDisplayText() in Product cannot
    implement getDisplayText() i
    n Displayable; attempting to use incompatible return
    type
    found : void
    required: java.lang.String
    public void getDisplayText()
    ^
    2 errors
    Code reads as follows
    Please use the code tags when posting code. There is a code button right above the text box where you enter your post. Click on it and put the code between the code tags.
    These error messages are quite clear in telling what is wrong. You have an Interface called Displayable that specifies a method something like thispublic String getDisplayText() {But in your Product source code, you created thismethodpublic void getDisplayText() {The compiler is complaining because the methods are not the same.
    You also need to return a String in the method probalby like thisreturn message;

  • I'm having problems (1)selecting onscreen text, (2) having problems resizing menu boxes and selecting menues with the cursor. I'm not able to select menus and move them. I'm not sure how to correct this.

    I'm having problems (1) selecting onscreen text, (2) resizing menu boxes and selecting menues with the cursor. I'm not able to select menus and move them. I'm not sure how to correct this.

    1) This is because of software version 1.1. See this
    thread for some options as to how to go back to 1.0,
    which will correct the problem...
    http://discussions.apple.com/thread.jspa?threadID=3754
    59&tstart=0
    2) This tends to happen after videos. Give the iPod a
    minute or two to readjust. It should now be more
    accurate.
    3) This?
    iPod shows a folder icon with exclamation
    point
    4) Restore the iPod
    5) Try these...
    iPod Only Shows An Apple Logo and Will Not Start
    Up
    iPod Only Shows An Apple Logo
    I think 3,4, and 5 are related. Try the options I
    posted for each one.
    btabz
    I just noticed that one of the restore methods you posted was to put it into Disk Mode First rather than just use the resstore straight off, I Have tried that and seems to have solved the problem, If it has thank you. previously I have only tried just restoring it skipping this extra step. Hope my iPod stays healthy, if it doesnt its a warrenty job me thinks any way thanks again

  • Flash Builder 4.6 code hinter problem - not showing some methods

    Hi All,
    I have a problem with FB code hinter. It does not show some methods on an object.
    To be exact I created a Date object and FB code hinter does not show .toDateString method (actually I it shows only one to string method - .ToString(), although according to docs there are more)
    When I use .toDateString method, code still compiles and work just fine, however method is not showing up in code hinter, which is really annoying..
    Anyone had this problem? If so, please, share some wisdom how to solve this thing.
    Thanks in advance.
    UPDATE:
    Here is some more info in my problem.
    I have tried to reinstall the application, but it did not help.
    So what I did was:
    * first I installed FB standard edition version 4.
    * I checked the code hinter and it worked. It showed .toDateString method.
    * I have purchased FB standard 4.5 upgrade.
    * I installed this upgrade, and boom the code hinter does not show the method...
    * Next I tried to create a project with Flex 4.1 sdk and then it worked - method was there. So the problem is with 4.6 sdk apparently...sucks...

    Hi, I have the same problem. I have a new FB 4.6 installation and it is my first FB installation. Do you have a solution already?

  • Flex Data Services does not see remote methods in extended ColdFusion component.

    I have created a remote service base component as a AModelService.cfc file. I extend that file to make my ModelService.cfc. When I configure the ColdFusion data service and point to ModelService.cfc and click next, I don't see any remote methods (there are none explicitly defined in the component) in the Service Operations window.
    If I go back and point to AModelServide.cfc, the parent component, and hit next, I see all the remote methods that are defined in the parent component. So, either I am doing something wrong, or Data Services does not look at methods up the cfc prototype chain, which from an OOP standpoint means that instead of say creating one restful base class and being nice and DRY you can't. I.e. not OOP for data services. Is this a bug, or what?
    Anybody get data services to work with extended service components?
    Mark

    Thanks for the reply. Yes, I did compile all the Java and it
    works OK with a simple Java program. It just will not work in a
    Flex application.
    The java classes are:
    RRA:
    package blah.myPackage;
    import java.util.List;
    import java.util.Collection;
    import flex.data.DataSyncException;
    import flex.data.assemblers.AbstractAssembler;
    class RRA extends AbstractAssembler
    public Collection fill( List fillParameters )
    RRS service = new RRS();
    return service.getSome();
    RRS:
    package blah.myPackage;
    import java.util.ArrayList;
    import java.util.List;
    import java.sql.*;
    import flex.EORS.*;
    class RRS
    public List getSome()
    ArrayList list = new ArrayList();
    String str = "bob";
    RR rr = new RR(str);
    list.add(rr);
    return list;
    RR:
    package blah.myPackage;
    class RR
    private String name;
    public RR() { }
    public RR(String name)
    this.name = name;
    public String getName()
    return this.name;
    public void setName(String name)
    this.name = name;
    I started with something that retrieved data from a database
    but watered it down just to try and get some kind of communication
    between Flex and Java.

  • We can not authorize payment method - register in windows azure

    HI
    I use visa card and tried to register in windows azure, it's throw a error:
    We can not authorize payment method. Make sure the information is correct or use another payment method. If you continue to receive this message, contact your financial institution.
    I dont know what happend?

    Hello,
    As per the error message, issue could be because of incorrect billing address entered while registering with Azure. You also need to check with your bank to verify if they have blocked transactions from Microsoft Azure and request them to unblock the transaction.
    If all of the above fails, you need to contact Azure billing team for deep investigation.
    http://azure.microsoft.com/en-us/support/options/
    Note : Prepaid and Virtual credit cards are not accepted in Azure platform, kindly use a normal credit card.
    Hope this clarifies your question!
    Regards,
    Sadiqh
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful.

  • My blends in Illustrator CS4 are not saving or printing correctly.  Why?

    Why are my blends in Illustrator CS4 not saving or printing correctly???
    SPECS:
    Adobe CS4
    MAC 10.5.8
    I got a outlined Text blend with a drop shadow.  And another text with a drop shadow on top.  Not too complex at all.
    Heres some screenshots of the problem.
    (1) Adobe Illustrator Screenshot
    (1) Screenshot of my saved TIff file.  I saved as a PDF as well and still no luck.
    Any suggestions?

    Mylenium,
    Thanks for you time and suggestions!  You helped alot!  My layers panel was crazy.  I re-arranged, re-organized and stacked according to the graphic.  Solved my problem first try.  Not used to making sure the order is right in illustrator, only in photoshop.
    Thanks again man!
    -NightRed

  • Is not abstract and does not override abstract method actionPerformed

    I dont how to corr. Please help!! and thank you very much!!
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class test extends JFrame implements ActionListener, ItemListener
              private CenterPanel centerPanel;
              private QuestionPanel questionPanel;
              private ButtonPanel buttonPanel;
              private ResponsePanel responsePanel;
              private JButton b1,b2,b3,b4,b5;               //Create five references to Jbutton instances
         private JTextField t1,t2,t3,t4,t5;          //Create five references to JTextField instances
              private JLabel label1;                    //Create one references to JLabel instances
              private JRadioButton q1,q2,q3;               //Create three references to JRadioButton instances
              private ButtonGroup radioGroup;               //Create one references to Button Group instances
              private int que1[] = new int[5];           //Create int[4] Array
              private int que2[] = new int[5];
              private int que3[] = new int[5];
              private String temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8, temp9, temp10,
                        temp11, temp12, temp13, temp14, temp15;
    public test (String header)
              super(header);
              Container container = getContentPane();
              label1 = new JLabel ("PLease click on your response to ");     
              q1 = new JRadioButton("I understand most of the content of this subject",true);
              add(q1);
              q2 = new JRadioButton("I see the relevance of the subject to my degree",false);
              add(q2);
              q3 = new JRadioButton("The workload in this subject is appropriate",false);
              add(q3);
              radioGroup = new ButtonGroup();               //JRadioButton belong to ButtonGroup
              radioGroup.add(q1);
              radioGroup.add(q2);
              radioGroup.add(q3);
              JPanel buttonPanel = new JPanel();
              JPanel responsePanel = new JPanel();
              JPanel questionPanel = new JPanel();
              JPanel centerPanel = new JPanel();
              b1 = new JButton ("Strongly DISAGREE");          //Instantiate JButton with text
              b1.addActionListener (this);               //Register JButtons to receive events
              b2 = new JButton ("DISAGREE");
              b2.addActionListener (this);
              b3 = new JButton ("Neither AGREE or DISAGREE");
              b3.addActionListener (this);
              b4 = new JButton ("AGREE");
              b4.addActionListener (this);
              b5 = new JButton ("Strongly AGREE");
              b5.addActionListener (this);
              buttonPanel.setLayout(new GridLayout(5,1));
              buttonPanel.add(b1);
              buttonPanel.add(b2);
              buttonPanel.add(b3);
              buttonPanel.add(b4);
              buttonPanel.add(b5);
              t1 = new JTextField ("0",3);               //JTextField contains empty string
              t2 = new JTextField ("0",3);
              t3 = new JTextField ("0",3);
              t4 = new JTextField ("0",3);
              t5 = new JTextField ("0",3);
              t1.setEditable( false );
              t2.setEditable( false );
              t3.setEditable( false );
              t4.setEditable( false );
              t5.setEditable( false );
              responsePanel.setLayout(new GridLayout(5,1));
              responsePanel.add(t1);
              responsePanel.add(t2);
              responsePanel.add(t3);
              responsePanel.add(t4);
              responsePanel.add(t5);
              questionPanel.setLayout(new GridLayout(4,1));
              questionPanel.add(label1);
              questionPanel.add(q1);
              questionPanel.add(q2);
              questionPanel.add(q3);
              centerPanel.add(buttonPanel,BorderLayout.CENTER);
              centerPanel.add(responsePanel,BorderLayout.EAST);
              container.add(centerPanel,BorderLayout.WEST);
              container.add(questionPanel,BorderLayout.NORTH);
              q1.addActionListener(
                   new ActionListener(){
              public void actionPerformed( ActionEvent e )          
    {                                        //actionPerformed of all registered listeners
              if (e.getSource() == b1) {
                   que1[0] = Integer.parseInt(t1.getText()) + 1;
                   String temp1 = String.valueOf(que1[0]);
              t1.setText(temp1);
              else if (e.getSource() == b2)     {
                   que1[1] = Integer.parseInt(t2.getText()) + 1;
                   String temp2 = String.valueOf(que1[1]);
              t2.setText(temp2);
              else if (e.getSource() == b3)     {
                   que1[2] = Integer.parseInt(t3.getText()) + 1;
                   String temp3 = String.valueOf(que1[2]);
              t3.setText(temp3);
              else if (e.getSource() == b4)     {
                   que1[3] = Integer.parseInt(t4.getText()) + 1;
                   String temp4 = String.valueOf(que1[3]);
              t4.setText(temp4);
              else if (e.getSource() == b5)     {
                   que1[4] = Integer.parseInt(t5.getText()) + 1;
                   String temp5 = String.valueOf(que1[4]);
              t5.setText(temp5);
    } //end action performed
              q2.addActionListener(
                   new ActionListener(){
              public void actionPerformed( ActionEvent e )          
    {                                        //actionPerformed of all registered listeners
              if (e.getSource() == b1) {
                   que2[0] = Integer.parseInt(t1.getText()) + 1;
                   String temp6 = String.valueOf(que2[0]);
              t1.setText(temp1);
              else if (e.getSource() == b2)     {
                   que2[1] = Integer.parseInt(t2.getText()) + 1;
                   String temp7 = String.valueOf(que2[1]);
              t2.setText(temp7);
              else if (e.getSource() == b3)     {
                   que2[2] = Integer.parseInt(t3.getText()) + 1;
                   String temp8 = String.valueOf(que2[2]);
              t3.setText(temp8);
              else if (e.getSource() == b4)     {
                   que2[3] = Integer.parseInt(t4.getText()) + 1;
                   String temp9 = String.valueOf(que2[3]);
              t4.setText(temp9);
              else if (e.getSource() == b5)     {
                   que2[4] = Integer.parseInt(t5.getText()) + 1;
                   String temp10 = String.valueOf(que2[4]);
              t5.setText(temp10);
    } //end action performed
              q3.addActionListener(
                   new ActionListener(){
              public void actionPerformed( ActionEvent e )          
    {                                        //actionPerformed of all registered listeners
              if (e.getSource() == b1) {
                   que3[0] = Integer.parseInt(t1.getText()) + 1;
                   String temp11 = String.valueOf(que3[0]);
              t1.setText(temp11);
              else if (e.getSource() == b2)     {
                   que3[1] = Integer.parseInt(t2.getText()) + 1;
                   String temp12 = String.valueOf(que3[1]);
              t2.setText(temp12);
              else if (e.getSource() == b3)     {
                   que3[2] = Integer.parseInt(t3.getText()) + 1;
                   String temp13 = String.valueOf(que3[2]);
              t3.setText(temp13);
              else if (e.getSource() == b4)     {
                   que3[3] = Integer.parseInt(t4.getText()) + 1;
                   String temp14 = String.valueOf(que3[3]);
              t4.setText(temp14);
              else if (e.getSource() == b5)     {
                   que3[4] = Integer.parseInt(t5.getText()) + 1;
                   String temp15 = String.valueOf(que3[4]);
              t5.setText(temp15);
    } //end action performed
    }//end constructor test
    public void itemStateChanged(ItemEvent item) {
    //int state = item.getStateChange();
    //if (q1 == item.SELECTED)
              public class ButtonPanel extends JPanel
                   public ButtonPanel()
              public class CenterPanel extends JPanel
                   public CenterPanel()
              public class QuestionPanel extends JPanel
                   public QuestionPanel()
              public class ResponsePanel extends JPanel
                   public ResponsePanel()
    public static void main(String [] args)
         test surveyFrame = new test("Student Survey") ;
         surveyFrame.setSize( 500,300 );
         surveyFrame.setVisible(true);
         surveyFrame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
         }//end main
    }//end class test

    is not abstract and does not override abstract method actionPerformed
    Oh, I see that the title of your post is an error message? Ok. Well, the test class is declared as implementing an ActionListener. That means the test class must have an actionPerformed() method. Your test class apparently does not.
    It does not appear that the test class needs to implement ActionListener. You are using annonymous classes as listeners.

  • Is not abstract and does not override abstract method tablechanged

    I will remove all the gui code to make it shorter, but my problem lies with my InteractiveTableModelListener.
    public class Meet extends JPanel{
      private static void createAndShowGUI() {
            JFrame frame = new JFrame("MEET_dataTable");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.add(new Meet(), BorderLayout.CENTER);
            frame.pack();
            frame.setVisible(true);
    public class InteractiveTableModelListener implements TableModelListener {
         public void TableChanged(TableModelEvent evt) {
      if (evt.getType() == TableModelEvent.UPDATE) {
          int column = evt.getColumn();
          int row = evt.getFirstRow();
          dataTable.setColumnSelectionInterval(column + 1, column + 1);
          dataTable.setRowSelectionInterval(row, row);
    class InteractiveRenderer extends DefaultTableCellRenderer {
      protected int interactiveColumn;
      public InteractiveRenderer(int interactiveColumn) {
          this.interactiveColumn = interactiveColumn;
    public Component getTableCellRendererComponent(JTable dataTable,
         Object value, boolean isSelected, boolean hasFocus, int row,
         int column)
      Component c = super.getTableCellRendererComponent(dataTable, value, isSelected, hasFocus, row, column);
       if (column == interactiveColumn && hasFocus) {
         if ((Meet.this.tableModel.getRowCount() - 1) == row &&
            !Meet.this.tableModel.hasEmptyRow())
             Meet.this.tableModel.addEmptyRow();
        highlightLastRow(row);
      return c;
    public void highlightLastRow(int row) {
         int lastrow = tableModel.getRowCount();
      if (row == lastrow - 1) {
          dataTable.setRowSelectionInterval(lastrow - 1, lastrow - 1);
      else {
          dataTable.setRowSelectionInterval(row + 1, row + 1);
         dataTable.setColumnSelectionInterval(0, 0);
    public static void main(String[] args) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                UIManager.put("swing.boldMetal", Boolean.FALSE);
                createAndShowGUI();
    }As i say, i have removed all the gui code to make it shorter, but in this code i create the table and add all the model to it. I am being returned with the error
    Meet.InteractiveTableModelListener is not abstract and does not override abstract method tableChanged(javax.swing.event.TableModelEvent)in javax.swing.event.TableModelListener
    what would be causing this error?
    Cheers

    Sorry, just figured out my silly error, the method is tableChanged not TableChanged.
    cheers
    TOPIC CLOSED
    Edited by: nick2price on Sep 11, 2008 7:08 AM

  • Is not abstract and does not override abstract method ERROR

    Hello. I'm new at all this, and am attempting to recreate a sample code out of my book (Teach Yourself XML in 24 Hours), and I keep getting an error. I appriciate any help.
    This is the Error that I get:
    DocumentPrinter is not abstract and does not override abstract method skippedEntity(java.lang.String) in org.xml.sax.ContentHandler
    public class DocumentPrinter implements  ContentHandler, ErrorHandler
            ^This is the sourcecode:
    import org.xml.sax.Attributes;
    import org.xml.sax.ContentHandler;
    import org.xml.sax.ErrorHandler;
    import org.xml.sax.Locator;
    import org.xml.sax.SAXParseException;
    import org.xml.sax.XMLReader;
    public class DocumentPrinter implements  ContentHandler, ErrorHandler
    // A Constant containing the name of the SAX parser to use.
    private static final String PARSER_NAME = "org.apache.xerces.parsers.SAXParser";
    public static void main(String[] args)
       // Check to see whether the user supplied any command line arguments.  If not, print an error and exit.
       if (args.length == 0)
         System.out.println("No XML document path specified.");
         System.exit(1);
       // Create a new instance of the DocumentPrinter class.
       DocumentPrinter dp = new DocumentPrinter();
       try
         // Create a new instance of the XML Parser.
         XMLReader parser = (XMLReader)Class.forName(PARSER_NAME).newInstance();
         // Set the parser's content handler
        // parser.setContentHandler(dp);
         // Set the parsers error handler
         parser.setErrorHandler(dp);
         // Parse the file named in the argument
         parser.parse(args[0]);
       catch (Exception ex)
         System.out.println(ex.getMessage());
         ex.printStackTrace();
    public void characters(char[] ch, int start, int length)
       String chars ="";
       for (int i = start; i < start + length; i++)
         chars = chars + ch;
    System.out.println("Recieved characters: " + chars);
    public void startDocument()
    System.out.println("Start Document.");
    public void endDocument()
    System.out.println("End of Document.");
    public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
    System.out.println("Start element: " + localName);
    for (int i = 0; i < atts.getLength(); i++)
    System.out.println(" Attribute: " + atts.getLocalName(i));
    System.out.println(" Value: " + atts.getValue(i));
    public void endElement(String namespaceURI, String localName, String qName)
    System.out.println("End of element: " + localName);
    public void startPrefixMapping(String prefix, String uri)
    System.out.println("Prefix mapping: " + prefix);
    System.out.println("URI: " + uri);
    public void endPrefixMapping(String prefix)
    System.out.println("End of prefix mapping: " + prefix);
    public void ignorableWhitespace(char[] ch, int start, int length)
    System.out.println("Recieved whitespace.");
    public void processingInstruction(String target, String data)
    System.out.println("Recieved processing instruction:");
    System.out.println("Target: " + target);
    System.out.println("Data: " + data);
    public void setDocumentLocation(Locator locator)
    // Nada
    public void error(SAXParseException exception)
    System.out.println("Parsing error on line " + exception.getLineNumber());
    public void fatalError(SAXParseException exception)
    System.out.println("Fatal parsing error on line " + exception.getLineNumber());
    public void warning(SAXParseException exception)
    System.out.println("Warning on line " + exception.getLineNumber());

    Check to make sure that the arguments are consistent with your ContentHandler class. Probably the wrong type.
    I think you forgot to include the skippedEntity method, it seems to be missing. Even if an implemented class has a method that you are not using, you still have to include the method in your code even if it doesn't do anything.
    Message was edited by:
    ChargersTule1

  • 790FX-GD70 not setting RAM to correct timing nor voltage from SPED

    My 790FX-GD70 not setting RAM to correct timing nor voltage from SPED when set to auto. The RAM I have should be 6 6 6 20 @ 1.8V but the motherboard is setting it to 9 9 9 24 @ 1.5 V
    The RAM is   Crucial 2GB, Ballistix 240-pin DIMM, DDR3 PC3-10600 memory BL25664BA1336 • DDR3 PC3-10600 • 6-6-6-20 • Unbuffered • NON-ECC • DDR3-1333 • 1.8V • 256Meg x 64 of which i have two of then in the two black slots.
    Just to rule out the RAM I also tried a different model of RAM whose timing is 7 7 7 24 @ 1.65 which will not allow to boot to windows unless I adjust the voltage manually to 1.70 (1.65 V will still not boot properly)  it sets it also at 9 9 9 24 yet this same sticks of RAM will set correctly in a MSI 770 C45 without any adjustments.
    Now i will say in the case of the 790FX-GD70 I require no changes  in voltage for it to boot with the 1.8 V RAM just the timings are not as they should be. The 790FX-GD70 is stable as is and I will probably leave it at the auto settings  but wondered if anyone else  encountered similar issues with this board

    Looks like this is a bit of an issue for some other users of your RAM and not necessarily a MSI thing! This user has a ASUS board! Good luck and hope you get it sorted out.
    Backround:
    I bought some DDR3-1333 ram that was advertised as 6-6-6-20 @ 1.8v and, as expected, running on my board's default 1.5v it was only getting like 9-9-9-24. In fact, @ stock voltage the best I could boot up with (unknown stability) was 9-7-7. In an attempt to get the best (advertised?) performance I went ahead and manually set the timings to 6-6-6-20, left all other timings on auto, and upped the voltage to 1.8v
    Boots up fine and appears to be stable. However, I do notice the RAM is fairly warm to the touch whereas @ 1.5v it was pretty benign heat-wise. I tried running 1.785v but 3 out of 4 times it would hang on the windows desktop display. So I bumped it back up to 1.8v and I'll run Memtest 86 or something else later tonight.
    My question, being a noob and all...
    Is running at 1.8v going to hurt something? (See my setup MB, and CPU stats)
    Just to repeat, the box and manufacturer do list it as 1.8v spec. (FYI: BL25664BA1336)

  • Error message from Adobe Reader. cannot extract the embedded font 'LICCMC+MyriadPro-Light'. some characters may not display or print correctly. Print looks like gibberish

    Trying to view/print PDF documents from website. Print looks like gibberish and is unreadable. Problem is with the embedded fonts. Error message from Adobe says cannot extract the embedded font 'LICCMC+MyriadPro-Light'. some characters may not display or print correctly.

    Try Adobe support, that's not a Firefox support issue. <br />
    http://forums.adobe.com/index.jspa

  • I HAVE A SONY VAIO WITH WINDOWS VISTA- SUDDENLY I'M GETTING A BLUE SCREEN (crash dump)THAT SHUTS DOWN MY COMPUTER. HOW DO I STOP THIS. ALREADY TRIED TO UNINSTALL AND RE INSTALL. MAY NOT HAVE DONE IT CORRECTLY ?

    LAST WEEK STARTED GETTING A BLUE SCREEN (CRASH DUMP) AFTER CLOSING I TUNES, THAT CAUSES MY COMPUTER TO SHUTDOWN. IVE BEEN TOLD BY A PC REPAIR SHOP THAT I DONT HAVE A VIRUS. I DO HAVE ANTIVIRUS PROTECTION ON MY PC. ATTEMPED TO REINSTALL I TUNES BUT MAY NOT HAVE DONE IT CORRECTLY. I STILL HAVE THE PROBLEM. THE BLUE SCREEN ONLY HAPPENS WITH I TUNES. I HAVENT MADE ANY RECENT CHANGES TO MY MUSIC- NO DOWNLOADS /UPLOADS. ANY KNOWLEDGE OF THIS SITUATION? THANKS!!

    Hey Ishland,
    You are not alone. I'm getting the same thing I'm running Vista. I'm reading that Windows 8, 8.1 preview, Vista and XP.
    I'm thinking this has to be a Apple update to iTunes 11.0.4.4 fix.
    Cheers,
    Steve
    P.S. you might want to make your post easier to read by turning the cap lock off.

Maybe you are looking for