File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes actionListener (will not compile) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "actionListener (will not compile)" Watch "actionListener (will not compile)" New topic
Author

actionListener (will not compile)

Cuong Tran
Greenhorn

Joined: Apr 02, 2004
Posts: 1
Hi everyone, this is my first post as I'm new here...
I can't seem to get this to compile, can someone tell why it's not compiling... I'm nearly 100% sure it's not a syntax error... please help
[ edited to preserve formatting using the [code] and [/code] UBB tags -ds ]
[ April 02, 2004: Message edited by: Dirk Schreckmann ]
Sgubudu Nhlumayo
Greenhorn

Joined: Apr 01, 2004
Posts: 2
HI
Java Classes have constructors.
These are used to initialize the object.
You have used a method ,"public void question_1()",
please change this to public Chapter7(){//initialize }don't
change the code inside the method question_1.

"We are computer professionals ,we cause accidents"
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
It will help you can give us a bit more information.
First of ally, you can preserve the indentation in your code by using [ code ] tags. There is a button below the reply message box that will add them automatically to your message. Just copy and paste the code in between the tags.
More importantly, we need the error messages you get when you compile. Please copy and paste them here. Also, make a note about which line each error refers to. Comments in the code can help with this.
I'll be more than happy to help you solve the compiler errors after you post them here.
Keep coding!
Layne


Java API Documentation
The Java Tutorial
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
You have a scope problem.
Move this line
JButton btnHello1 = new JButton ("Button 1"),btnHello2 = new JButton ("Button 2");
to immediately above this line
public void question_1(){
and it should compile OK.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: actionListener (will not compile)