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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:07:12+00:00 2026-06-03T11:07:12+00:00

I want to do a JTable with column names, using: JTable(Vector rowData, Vector columnNames)

  • 0

I want to do a JTable with column names, using:

JTable(Vector rowData, Vector columnNames)

to constructs a JTable to display the values in the Vector of Vectors, rowData, with column names, columnNames.

So, I did this:

final String[] columnNames = {"NOMBRE", "DÍAS DE LA SEMANA", "HORA DE INICIO", "HORA DE FIN", "TIEMPO MÁXIMO DE USO"};

        rs.last();
        int numRows = rs.getRow();
        rs.beforeFirst(); 

        Object[][] columnData = new String[numRows][5];

        int i = 0;
        while(rs.next()){

            columnData[i][0] = rs.getString(1);
            columnData[i][1] = rs.getString(2);
            columnData[i][2] = rs.getString(3);
            columnData[i][3] = rs.getString(4);
            columnData[i][4] = rs.getString(5);

        }

table = new JTable(columnData, columnNames);
        table.setBounds(300,600,700,150);

But I only see the data, why isn’t the title shown?

Thank in advance

  • 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-03T11:07:13+00:00Added an answer on June 3, 2026 at 11:07 am
    JTable table = new JTable(columnData, columnNames);
    JScrollPane scroll = new JScrollPane(table);
    panel.add(scroll);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to gray non-editable cell in JTable. I'm using such TableCellRenderer: TableColumn column
I'm creating a JTable with data contained in 2 Vector, rowData and columnNames. I'm
I want to implement DropTargetListener with a JTable as a target. This is roughly
I have a JTable that I want to use to display some data (a
Suppose you have a JTable and for each cell you want to display three
I'm currently using JTable to show the contents in database. I want to provide
I am populating Employee Data in JTable using Netbeans. I want to add Radiobutton
I have a JTable that is using a TableColumnModelListener() to detect when the column
I have A jtable. (tablesummary). one of it's column is EXPIRY. i want to
I want to add JComboBox inside a JTable (3,3) on column 1. But in

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.