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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:39:15+00:00 2026-05-27T21:39:15+00:00

I have accepted various types of data inputs (integer, double, string and date) to

  • 0

I have accepted various types of data inputs (integer, double, string and date) to my embedded JDBC database via (JTextLabels EDIT: JTextFields) using ResultSet and i am displaying results in a swing JTable using my custom AbstractTableModel. The following are snippets from my codes where am thinking the problem might lie, but i’m not sure;

public void connectToDB()
    {
        try
        {
            connection = DriverManager.getConnection(DBURL, DBUSERNAME, DBPASSWORD);
            statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
            connectedToDB = true;
        }
        catch (SQLException sqlEx)
        {
            sqlEx.printStackTrace();
        }
    }

//Overrides AbstractTableModel's getValueAt() method
    public Object getValueAt(int row, int column) throws IllegalStateException
    {
        connectToDB();
        if (connectedToDB == false)
            throw new IllegalStateException ("Not Connected To database");
        else
        {
            try
            {
                if ( resultSet.next() == true )
                {
                    resultSet.absolute( row + 1 );
                    return resultSet.getObject( column + 1 );
                }
            }
            catch (SQLException sqlEx)
            {
                sqlEx.printStackTrace();
            }
        }
        return "";// returns an empty string Object in case an error occurs above
    }

It looks as if somwhere around the getValueAt() method, it generates the following exception, but even the stacktrace doesnt point me to any part of my code;

Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Cannot format given Object as a Number
    at java.text.DecimalFormat.format(DecimalFormat.java:487)
    at java.text.Format.format(Format.java:140)
    at javax.swing.JTable$DoubleRenderer.setValue(JTable.java:5315)
    at javax.swing.table.DefaultTableCellRenderer.getTableCellRendererComponent(DefaultTableCellRenderer.java:223)
    at javax.swing.JTable.prepareRenderer(JTable.java:5683)
    at javax.swing.JTable.getToolTipText(JTable.java:3328)
............ 
*Others ommitted 4 brevity*
............

I dont know why.

  • 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-27T21:39:16+00:00Added an answer on May 27, 2026 at 9:39 pm

    The stacktrace indicates the problem is situated in the renderer of the table. The JTable has decided it will use the DoubleRenderer for that particular value, and that value can not be parsed to a Double. I would suggest to check your TableModel#getColumnClass implementation and see whether it returns Double.class for a column which actually does not contain Doubles since that is the method which is used to determine which renderer to use.

    This can be seen in the source code for JTable, more specifically in the source of the getRenderer method. See below for the relevant part (line 3454 in the source code I linked to)

     TableCellRenderer renderer = null;
     if (columnModel.getColumnCount() > 0)
       renderer = columnModel.getColumn(column).getCellRenderer();
     if (renderer == null)
       {
         int mcolumn = convertColumnIndexToModel(column);
         renderer = getDefaultRenderer(dataModel.getColumnClass(mcolumn));
       }
     return renderer;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have connected to a server via SFTP using FileZilla and accepted adding the
I have an ASP Access database that contains strings in various European languages. The
I have the following code within a stored procedure. WHERE WPP.ACCEPTED = 1 AND
I have some data with messed-up accented characters. For example in the data we
I have set myself upon a journey to educate my coworkers (all have accepted
Suppose I have the following two data structures: std::vector<int> all_items; std::set<int> bad_items; The all_items
OK, so having just got the key to be accepted and have an encrypted
I have a sorted integer array on the device, e.g.: [0,0,0,1,1,2,2] And I want
We have a list of (let's say 50) reports that get dumped into various
I have a TCP server using boost asio. I have accepted a socket connection.

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.