Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8623683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:20:36+00:00 2026-06-12T07:20:36+00:00

I have coded a gui for my CRUD Program, and when I want to

  • 0

I have coded a gui for my CRUD Program, and when I want to run it I get:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at gui.guimain$1.run(guimain.java:477)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Thats the code where the NPE comes from:

public static void main(String[] args){
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
        public void run(){
                maingui.showStart();// thats the line with the Exception
        }
    });
}

and thats the method showStart():

public void showStart(){
    mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    mainFrame.getContentPane().removeAll();
    tabstructure.removeAll();
    Produkt filter=new Produkt();

    JPanel P=new JPanel();
    P=Produktgui(0, filter);
    JPanel R=new JPanel();
    R=Billgui(0);
    JPanel nR=new JPanel();
    nR=Billgui(0);

    tabstructure.addTab("e", P);
    tabstructure.addTab("Bills", R);
    tabstructure.addTab("Pay bill", nR);
    mainFrame.getContentPane().add(tabstructure);
    mainFrame.validate();
    mainFrame.repaint();
    mainFrame.pack();
    mainFrame.setVisible(true);
}

Why do I get a NullPointerException?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:20:37+00:00Added an answer on June 12, 2026 at 7:20 am

    Because something that you’re calling a method on is null.

    Look carefully at the error message. It says that the exception happens on line 477 of guimain.java.

    At that point, maingui is null.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have coded a background logging thread for my program, if a class needs
Possible Duplicate: Java, GUI builder or hand coding? I have been making GUI hand-coded
I have coded a server in Java that will have several clients connected to
I have a python practise project. I'm going to write a GUI program which
Here's the thing... I have 2 GUI programs. A Menu Program,which is basically a
i coded a little annotator in Java with a simple GUI based on Swing
I have some Matlab code and a GUI for it and I want to
I have a problem with my python code. I am writing a GUI in
I have coded my own tiny static DAL class for .NET Compact Framework and
I have coded the next function. But surely someone has a more elegant way

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.