[5649] in java-interest

home help back first fref pref prev next nref lref last post

Re: [Mac] Constructor Problem

daemon@ATHENA.MIT.EDU (Todd E. Gee)
Wed Feb 21 10:43:48 1996

Date: Wed, 21 Feb 1996 09:10:29 -0500
From: "Todd E. Gee" <tgee@eecs.umich.edu>
To: java-interest@java.sun.com, senelson@mediacity.com


Remove the 'void' from your constructors...

i.e. make it:
>         public Jubal(int newX, int newY, int newHeight, int newWidth) {
and
>         public Jubal() {

Tod


> Here's the error:
> StevesApplet.java: no constructor matching Jubal(int, int, int, int) found
> in class Jubal.
> >> theJubal = new Jubal(50, 50, 50, 50);
> >>
> 
> 
> 
> Here's the code:
> 
> import java.applet.Applet;
> import java.awt.*;
> 
> class Jubal {
>         int x;
>         int y;
>         int height;
>         int width;
> 
>         public void Jubal(int newX, int newY, int newHeight, int newWidth) {
>                 x = newX;
>                 y = newY;
>                 height = newHeight;
>                 width = newWidth;
>         }
> 
>         public void Jubal() {
>                 x = 50;
>                 y = 50;
>                 height = 50;
>                 width = 50;
>         }
> 
>         void draw(Graphics theWindow) {
>                 theWindow.drawOval(x, y, height, width);
>         }
> }
> 
> 
> public class StevesApplet extends Applet {
>         Jubal theJubal;
> 
>         public void init() {
>                 resize(150, 150);
>                 theJubal = new Jubal(50, 50, 50, 50);
>         }
> 
>         public void paint(Graphics theWindow) {
>                 theJubal.draw(theWindow);
>         }
> }
> 
> I can't say that I understand the error message, considering I've got a
> perfectly good constructor for Jubal(int, int, int, int).  Sorry if this is
> a newbie mistake... Thanks!
> 
> 
> =SN
> 
> Steve Nelson
> MediaCity HTML Design Staff                     Phone: (415) 854-9634
> senelson@mediacity.com                          Fax:   (415) 854-4655
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post