Results 1 to 6 of 6
Like Tree1Likes
  • 1 Post By JosAH

Thread: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

  1. #1
    javadroid13's Avatar
    javadroid13 is offline Member
    Join Date
    Dec 2011
    Posts
    7
    Rep Power
    0

    Default Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

    Can someone help with this issue???

    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at JavaBankGui.CustomerView.btnSaveActionPerformed(Cu stomerView.java:200)
    at JavaBankGui.CustomerView.access$000(CustomerView.j ava:20)
    at JavaBankGui.CustomerView$1.actionPerformed(Custome rView.java:89)
    at javax.swing.AbstractButton.fireActionPerformed(Abs tractButton.java:2018)
    at javax.swing.AbstractButton$Handler.actionPerformed (AbstractButton.java:2341)
    at javax.swing.DefaultButtonModel.fireActionPerformed (DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultB uttonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.jav a:6504)
    at javax.swing.JComponent.processMouseEvent(JComponen t.java:3321)
    at java.awt.Component.processEvent(Component.java:626 9)
    at java.awt.Container.processEvent(Container.java:222 9)
    at java.awt.Component.dispatchEventImpl(Component.jav a:4860)
    at java.awt.Container.dispatchEventImpl(Container.jav a:2287)
    at java.awt.Component.dispatchEvent(Component.java:46 86)
    at java.awt.LightweightDispatcher.retargetMouseEvent( Container.java:4832)
    at java.awt.LightweightDispatcher.processMouseEvent(C ontainer.java:4492)
    at java.awt.LightweightDispatcher.dispatchEvent(Conta iner.java:4422)
    at java.awt.Container.dispatchEventImpl(Container.jav a:2273)
    at java.awt.Window.dispatchEventImpl(Window.java:2713 )
    at java.awt.Component.dispatchEvent(Component.java:46 86)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.j ava:707)
    at java.awt.EventQueue.access$000(EventQueue.java:101 )
    at java.awt.EventQueue$3.run(EventQueue.java:666)
    at java.awt.EventQueue$3.run(EventQueue.java:664)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPri vilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$1.doIntersectionPri vilege(ProtectionDomain.java:87)
    at java.awt.EventQueue$4.run(EventQueue.java:680)
    at java.awt.EventQueue$4.run(EventQueue.java:678)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPri vilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java: 677)
    at java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.java:128)
    at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:117)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:113)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:105)
    at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:90)

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,048
    Blog Entries
    7
    Rep Power
    23

    Default Re: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

    You got a NullPointerException on line 200 of your CustomerView class because variable was null while it shouldn't be.

    kind regards,

    Jos
    rahulyedravker likes this.
    The only person who got everything done by Friday was Robinson Crusoe.

  3. #3
    javadroid13's Avatar
    javadroid13 is offline Member
    Join Date
    Dec 2011
    Posts
    7
    Rep Power
    0

    Default Re: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

    I already remove the null but I still do have a problem and here is are my Code
    "private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
    int customerId = Integer.parseInt(this.txtCustomerId.getText());
    String firstName = this.txtFirstname.getText();
    String lastName = this.txtLastname.getText();
    String address = this.txtAddress.getText();
    Object birthday = this.formatTxtDate.getValue();

    if(this.customer == null) {
    this.customer = new Customer(customerId, firstName, lastName, address);

    if(this.teller.addCustomer(this.customer)) //I do Have error in here Incompatible Type Required boolean. But I dont use boolean in my Code
    {
    this.txtCustomerId.setEditable(false);
    JOptionPane.showMessageDialog(this, "Customer Record Added");
    }
    else {
    this.customer = null;
    JOptionPane.showMessageDialog(this, "This customer have Account Already");
    }
    }
    else {
    this.customer.setCustomerId(customerId);
    this.customer.setFirstName(firstName);
    this.customer.setLastName(lastName);
    this.customer.setAddress(address);
    this.customer.setBirthday(null);
    }
    } "

  4. #4
    javadroid13's Avatar
    javadroid13 is offline Member
    Join Date
    Dec 2011
    Posts
    7
    Rep Power
    0

    Default Re: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

    And heres the error message I recieved

    Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code - incompatible types
    required: boolean
    found: JavaBank.Customer
    at JavaBankGui.CustomerView.btnSaveActionPerformed(Cu stomerView.java:200)
    at JavaBankGui.CustomerView.access$000(CustomerView.j ava:20)
    at JavaBankGui.CustomerView$1.actionPerformed(Custome rView.java:89)
    at javax.swing.AbstractButton.fireActionPerformed(Abs tractButton.java:2018)
    at javax.swing.AbstractButton$Handler.actionPerformed (AbstractButton.java:2341)
    at javax.swing.DefaultButtonModel.fireActionPerformed (DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultB uttonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.jav a:6504)
    at javax.swing.JComponent.processMouseEvent(JComponen t.java:3321)
    at java.awt.Component.processEvent(Component.java:626 9)
    at java.awt.Container.processEvent(Container.java:222 9)
    at java.awt.Component.dispatchEventImpl(Component.jav a:4860)
    at java.awt.Container.dispatchEventImpl(Container.jav a:2287)
    at java.awt.Component.dispatchEvent(Component.java:46 86)
    at java.awt.LightweightDispatcher.retargetMouseEvent( Container.java:4832)
    at java.awt.LightweightDispatcher.processMouseEvent(C ontainer.java:4492)
    at java.awt.LightweightDispatcher.dispatchEvent(Conta iner.java:4422)
    at java.awt.Container.dispatchEventImpl(Container.jav a:2273)
    at java.awt.Window.dispatchEventImpl(Window.java:2713 )
    at java.awt.Component.dispatchEvent(Component.java:46 86)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.j ava:707)
    at java.awt.EventQueue.access$000(EventQueue.java:101 )
    at java.awt.EventQueue$3.run(EventQueue.java:666)
    at java.awt.EventQueue$3.run(EventQueue.java:664)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPri vilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$1.doIntersectionPri vilege(ProtectionDomain.java:87)
    at java.awt.EventQueue$4.run(EventQueue.java:680)
    at java.awt.EventQueue$4.run(EventQueue.java:678)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPri vilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java: 677)
    at java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.java:128)
    at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:117)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:113)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:105)
    at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:90)

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,048
    Blog Entries
    7
    Rep Power
    23

    Default Re: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

    You attempted to run a piece of code that couldn't even be compiled; somewhere, something expected a boolean value and you code supplied a Customer type value. It's all in the Exception stack trace text ...

    kind regards,

    Jos
    The only person who got everything done by Friday was Robinson Crusoe.

  6. #6
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,327
    Rep Power
    8

    Default Re: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

    The key is right here:

    incompatible types
    required: boolean
    found: JavaBank.Customer
    at JavaBankGui.CustomerView.btnSaveActionPerformed(Cu stomerView.java:200)
    Whatever is on line 200 of CustomerView.java expects a boolean. You are giving it a "JavaBank.Customer" object. You probably meant to do something like

    'customer.someBoolean' but gave it just 'customer' instead!

Similar Threads

  1. Replies: 1
    Last Post: 12-13-2010, 04:19 PM
  2. Replies: 5
    Last Post: 10-02-2010, 12:41 AM
  3. Replies: 3
    Last Post: 04-30-2010, 07:44 PM
  4. Replies: 4
    Last Post: 04-01-2010, 10:34 PM
  5. Replies: 5
    Last Post: 08-26-2009, 11:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •