Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Netbeans newbe help needed

Reply
Thread Tools

Netbeans newbe help needed

 
 
Avraham
Guest
Posts: n/a
 
      05-30-2004
Hello,

This is my newbe simplest program.
It compiles OK.
When I try to run it with NETBEENS I get error messages (see bellow),

When I run it in another IDE (JCreator) it runs. (only it won't close
the window. Wish I knew why..).

Please help on both issues.

Thanks, Avraham gutbir1 @ 013.net.il
------------------------------------

import java.awt.*;
import java.awt.event.*;

public class ButtonDemo extends Frame{

Button b;
public ButtonDemo(){ // constructor
super ();
this.setLayout(new FlowLayout(FlowLayout.LEFT));
this.setBackground(Color.green);
b=new Button("Press me and I will blush");
b.setSize(100,100); // did not work !

// for button action :
b.addActionListener(new MyButtonHandler());
this.add(b);
this.setSize(300,300);

// for window closing :
this.addWindowListener(new MyWindowListener());
//this.setResizable(false);
}

// inner class for button listener :
class MyButtonHandler implements ActionListener{
public void actionPerformed(ActionEvent e){
Button bb=(Button)e.getSource();
bb.setLabel("Thanks");
bb.setBackground(Color.yellow);
ButtonDemo.this.setBackground(Color.red); // relates to frame
}
}

// inner class for window listener :
class MyWindowListener extends WindowAdapter{

public void WindowClosing(WindowEvent e){
System.exit(0); // exit from application
System.out.println("heh");
}

}

public static void main(String[] args) {
ButtonDemo wind=new ButtonDemo();
wind.setVisible(true);
}
}

//----------------------------- end if program -----------------------


java.lang.NoClassDefFoundError: ButtonDemo/ButtonDemo (wrong name:
ButtonDemo)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java :502)
at java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader .java:250)
at java.net.URLClassLoader.access$100(URLClassLoader. java:54)
at java.net.URLClassLoader$1.run(URLClassLoader.java: 193)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.j ava:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:2 99)
at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:2 55)
at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:315)
Exception in thread "main"
 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      05-30-2004
On 30 May 2004 06:11:19 -0700, Avraham wrote:

> This is my newbe simplest program.


Head on over to c.l.j.help and I will
offer you step by step general guidance
<http://www.physci.org/codes/javafaq.jsp#cljh>

[ But be prepared to lose the IDE(s).
You need to figure how to do it from
the command line, then _they_ will be
easy to configure. ]

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Eclipse vs. Netbeans. Netbeans is winning me over almost at first glance. Thomas G. Marshall Java 2 10-16-2006 02:54 AM
[NETBEANS] [EVALUATION] - E12 - The NetBeans Open Source Lie Ilias Lazaridis Java 0 12-12-2004 02:41 PM
Link needed to go from a non-frames page to a Frames page, and load a particular frame. How? - Newbe Philip HTML 3 06-28-2004 03:06 PM
Building a GUI using NetBeans platform (not Netbeans IDE !) Pimousse Java 2 04-21-2004 07:22 AM
Newbe needing help dances Cisco 4 01-02-2004 02:43 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57