Netbeans newbe help needed

Discussion in 'Java' started by Avraham, May 30, 2004.

  1. Avraham

    Avraham Guest

    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(SecureClassLoader.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.java:186)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
    Exception in thread "main"
     
    Avraham, May 30, 2004
    #1
    1. Advertisements

  2. 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
     
    Andrew Thompson, May 30, 2004
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. EDOnLine
    Replies:
    3
    Views:
    535
    intrader
    Mar 28, 2006
  2. Pimousse
    Replies:
    2
    Views:
    3,938
    Roedy Green
    Apr 21, 2004
  3. Ilias Lazaridis
    Replies:
    0
    Views:
    1,123
    Ilias Lazaridis
    Dec 12, 2004
  4. Ron

    serial module NEWBE HELP!

    Ron, Mar 29, 2005, in forum: Python
    Replies:
    1
    Views:
    354
    Peter Hansen
    Mar 29, 2005
  5. Thomas G. Marshall
    Replies:
    2
    Views:
    1,026
    Thomas G. Marshall
    Oct 16, 2006
  6. c130herc

    Newbe VHDL Help

    c130herc, Jul 10, 2007, in forum: VHDL
    Replies:
    0
    Views:
    503
    c130herc
    Jul 10, 2007
  7. bredal Jensen

    Newbe needs help.

    bredal Jensen, Jul 7, 2004, in forum: ASP .Net Web Services
    Replies:
    3
    Views:
    167
    Kondratyev Denis
    Jul 7, 2004
  8. Ryan Macy

    Ideas needed & help needed!

    Ryan Macy, Jul 19, 2006, in forum: Ruby
    Replies:
    2
    Views:
    697
    Ryan Macy
    Jul 19, 2006
Loading...