Jump to content

Recommended Posts

Posted

Hi,

Iam really having a problem..

I want to make a Table which shows the value of the selected item and

it's index in the selected Column and Row..

So, could anyone help me by an examples,please?

Thanks for help.

Youssef Gamil


Posted (edited)

THANKS FOR YOUR HELP :D:D:thumbup:thumbup

but,I think I should search Google first to save your work

as I found this page before using google after asking that question..

THANKS AGAIN

THANKS 4 ALL

BUT,Can I ask one more question which I didn't found an answer for it?

Can I get JTable in form of 2D String Array?

THANKS AGAIN

THANKS 4 ALL

Edited by YoussefGamil
Posted

You can try something like this (haven't tested it)

public String[][] getElements (JTable table)
   {   String[][] values = new String[table.getRowCount()][table.getColumnCount()];
       for (int i=0; i<table.getRowCount(); i++)
       {   for (int j=0; j<table.getColumnCount(); j++)
           {   values[i][j] = (String)table.getValueAt(i, j);
           }
       }

       return values;
   }

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...