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 7500189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:05:59+00:00 2026-05-29T20:05:59+00:00

I have a rather confusing setup for a program that lets the user choose

  • 0

I have a rather confusing setup for a program that lets the user choose the number of rows in a table in a jDialog, input data, and returns the data in several arrays (for each column) to the main form. I thought things were going pretty smoothly up to last night, but this morning the table keeps giving me a NullPointerException error no matter what I do. I’ve done some research online and tested the table several times, and I don’t know what’s wrong.
Here’s what I have: (Also, the data from the first column is ignored, it’s not a mistake. My table has 7 columns.)

This is where the exception is being thrown; I’m trying to access the data of column 7.

public int[] getWDurabilityEV() {
    int rowCount = tbl_Units.getRowCount();
    int[] value = new int[rowCount];
    for (int i=0;i<value.length;i++) {
        value[i] = Integer.parseInt(tbl_Units.getValueAt(i, 6).toString());
    }
    return value;
}

This is the button click event on the main form (the other gets are exactly like my example with a different column index; the for loop at the end is an example of how I’m updating the table on my main form)

   private void EVButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                          
        dialog_EV1 EV1 = new dialog_EV1(new javax.swing.JFrame(), true);
//setting values
        EV1.ev1_weapon = ev1_weapon;
        EV1.ev1_wstrength = ev1_wstrength;
        EV1.ev1_wrange = ev1_wrange;
        EV1.ev1_wrate = ev1_wrate;
        EV1.ev1_wdurability = ev1_wdurability;
        EV1.ev1_wportability = ev1_wportability;
        EV1.setData();
        EV1.show();
//getting values
        ev1_weapon = EV1.getWeapon();
        ev1_wstrength = EV1.getWStrengthEV();
        ev1_wrange = EV1.getWRangeEV();
        ev1_wrate = EV1.getWRateEV();
        ev1_wdurability = EV1.getWDurabilityEV();
        ev2_wportability = EV1.getWPortabilityEV();
//calcuating values and updating table
        for (int i=0;i<ev1_weapon.length;i++) {
            tbl_Units.setValueAt(ev1_weapon[i],i,1);
        }   
    } 

And finally, the exception thrown:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at light.dialog_EV1.getWDurabilityEV(dialog_EV1.java:200)
    at light.MainGUI.EVButton1ActionPerformed(MainGUI.java:1061)
    at light.MainGUI.access$100(MainGUI.java:28)
    at light.MainGUI$2.actionPerformed(MainGUI.java:167)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
    at java.awt.Component.processMouseEvent(Component.java:6288)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
    at java.awt.Component.processEvent(Component.java:6053)
    at java.awt.Container.processEvent(Container.java:2041)
    at java.awt.Component.dispatchEventImpl(Component.java:4651)
    at java.awt.Container.dispatchEventImpl(Container.java:2099)
    at java.awt.Component.dispatchEvent(Component.java:4481)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
    at java.awt.Container.dispatchEventImpl(Container.java:2085)
    at java.awt.Window.dispatchEventImpl(Window.java:2478)
    at java.awt.Component.dispatchEvent(Component.java:4481)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:643)
    at java.awt.EventQueue.access$000(EventQueue.java:84)
    at java.awt.EventQueue$1.run(EventQueue.java:602)
    at java.awt.EventQueue$1.run(EventQueue.java:600)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
    at java.awt.EventQueue$2.run(EventQueue.java:616)
    at java.awt.EventQueue$2.run(EventQueue.java:614)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:613)
    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)
  • 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-05-29T20:06:01+00:00Added an answer on May 29, 2026 at 8:06 pm

    nothing much to clear from your question, nor from code, please edit your question with SSCCE

    1) create public AbstractTableModel for storing data,

    2) add TableModel to the JTable

    3) add ListSelectionMode (SINGLE_SELECTION) to the JTable,
    notice test

    if(selectedRow > -1)

    4) JTable knows follows data types, then there no reason for parsing Integer from String e.i.

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

Sidebar

Related Questions

I have a rather large (many gigabytes) table of data in SQL Server that
I am stuck with rather confusing query. Assume I have a ProductLending table that
I have rather large input XML files that must be converted to a given
I have a rather big number of source files that I need parse and
I right now have a problem that is rather confusing to me: I have
I have a rather confusing problem in running our game. I am trying to
I have a rather confusing issue. I've recently picked up some code I wrote
I have a menu on my site that changes depending on whether the user
I noticed that the castle windsor fluent component registration interface has the rather confusing
I have in input box that can only contain numerical values (with use of

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.