Results 1 to 2 of 2
  1. #1
    amrmb09 is offline Member
    Join Date
    Nov 2010
    Posts
    75
    Rep Power
    0

    Default Please help me fix this error: invalid method declaration

    java:13: invalid method declaration; return type required
    public SimpleShape()


    Java Code:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.geom.*;
    import java.util.*;
    
    public class Graphics2D
    {
    	public static void main (String[] args) 
    	{
    		new SimpleShape();
    	}
    	
        public SimpleShape()
        {
        	this.setSize(300, 300);
        	this.setTitle("A simple shape program");
        	this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        	
        	this.add(new PaintSurface(), BorderLayout.CENTER);
        	this.setVisible(true);
        }
        
        private class PaintSurface extends JComponent
        {
        	public void Paint (Graphics g)
        	{
        		Graphics2D g2 = (Graphics) g;
        		g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
                Shape s = new Ellipse2D.Float(20, 50, 250, 150);
                g2.setPaint(Color.BLACK);
                g2.draw(s);
        	}
        }
    }

  2. #2
    vinci123 is offline Member
    Join Date
    Aug 2011
    Location
    INDIA
    Posts
    64
    Rep Power
    0

    Default Re: Please help me fix this error: invalid method declaration

    i cant figure out the puzzle in this code.Lets see anyone who can do it

Similar Threads

  1. invalid method declaration
    By mcfer in forum New To Java
    Replies: 8
    Last Post: 09-22-2012, 02:26 PM
  2. Replies: 3
    Last Post: 06-05-2010, 09:05 PM
  3. invalid method declaration error
    By bsarules in forum Java Applets
    Replies: 7
    Last Post: 05-25-2010, 07:06 PM
  4. BubbleSorting Problem: invalid method declaration
    By SwEeTAcTioN in forum New To Java
    Replies: 6
    Last Post: 12-02-2009, 04:47 AM
  5. Error: invalid method declaration
    By silvia in forum New To Java
    Replies: 1
    Last Post: 07-27-2007, 01:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •