The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
July 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Gui in Applet

Posted by minirich on July 05, 2000 at 9:59 AM

This approach is not allowed.
> Button
> b1=new Button("Button 1"),
> b2=new Button("Button 2");
There are two allowed possibilities.
1)
Button b1 = new Button("Button 1");
Button b2 = new Button("Button 2");
2)
Button b1,b2;
b1 = new Button("Button 1");
b2 = new Button("Button 2");

Use only one don't mix it.
Mike

> import java.awt.*;
> import java.applet.*;

> public class Button extends Applet{
> Button
> b1=new Button("Button 1"),
> b2=new Button("Button 2");
> public void init(){
> add(b1);
> add(b2);
> }
> }

> the above is a little program direct from the book Thinking in Java.But I can not interpret it.two error message prompt up saying" wrong number of arguments in constructor"
> I also saw other books, this program is proved to be correct . But Why can't it be complied with JDK1.2.2?
>






Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us