(JTable) How can i get the first columns cell in a selected row?

Hello. I am trying to figure out how i can get the first columns cell within a selected row no matter what cell is selected in that row. I have a class that extends AbstractTableModel which represents the table. Now i have another class that extends DefaultSelectionModel. Each model is added to the JTable via setModel(TableModel dataModel), setSelectionModel(ListSelectionModel newModel). Now i don't understand what i have to return from getMaxSelectionIndex(). Any ides? Thanks.
  class xTableModel extends AbstractTableModel{
     private static String[] cols;
     private Object[][] data;
        public void setTableModel(Object data[][], String[] cols){
         this.cols = cols;
         this.data = data;
        public String getColumnName(int col){
         return cols[col];
        public int getRowCount() {
         return data.length;
        public Object getValueAt(int row, int col) {
         return data[row][col];           
        public void setValueAt(Object value,int row,int col){
         data[row][col]=value;
        public int getColumnCount(){
         return cols.length;
class ColumnListenerModel extends DefaultListSelectionModel{
     public int getMaxSelectionIndex(){}

int row = table.getSelectedRow();
Object data = table.getValueAt(row, 0);

Similar Messages

  • How can I get the real column of an alias in a view using system catalogs?

    Given a view with columns that use aliases, I would like to get the real column name for the view column with the alias.
    For example,
    CREATE VIEW myView AS
    SELECT name as col_1, price as col_2, price + 1000 as col_3
    FROM myTable
    I want to get that 'col_1' is actually the 'name' column and 'col_2' is the 'price' column by querying the system catalogs of SQL Server. It would be great to know whether I can resolve what 'col_3' is in the
    example as well (i.e., when an alias is an expression, not just a column). 
    Thanks in advance.

    Or you can use the System function
    sys.dm_exec_describe_first_result_set, example
    CREATE TABLE myTable
    (name varchar(30), price money);
    GO
    CREATE VIEW myView AS
    SELECT name as col_1, price as col_2, price + 1000 as col_3
    FROM myTable;
    GO
    SELECT name, source_table, source_column
    FROM sys.dm_exec_describe_first_result_set(N'SELECT * FROM myView', NULL, 1) AS FRS
    =>
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • How can I get the option to make an iPod selection playlist when there is not enough space on my iPod for my whole iTunes library?

    I am trying to sync my iPod with my iTunes library and I recently added more music to my library than there is space on my iPod. Normally, I know iTunes is supposed to give you the option of creating an iPod selection playlist, so you can choose which songs you want to put from your library onto your iPod. However, iTunes won't currently give me that option. It simply gives me an error message saying there is not enough free space to sync my iPod. How can I get it to create the iPod selection playlist?

    Start deleting stuff from your iPod to make room. 

  • HT1918 how can i get the first device i put in out and the second one to stay in without time restrictions?

    So I've been having an apple account before I got my first and only iphone. But I plugged in my friend's device first into my account and the account read it as the owner device of the ID. Two days later, I plugged in my device and read it as a second device in the accound and therefore, my device is just "borrowing" the ID and it set a time limit to use it. But it needs to be the other way around. The first device is not mine and I want it out, and I want the second device in as the owner of the apple account.
    What do I do?
    I've already removed the first device,but it still has a time restriction on the second device. THE SECOND DEVICE IS MY DEVICE AND ITS MY ACCOUNT!

    "Well, since its the first device into the account, I guess the account read it as the "owner" device of the account."
    There is no such thing as "owner" device at all.
    "Apparently, the account read it as the second device and thought that it was "borrowing" the account since it was the second device"
    There is no such thing as "borrowing" the account.  You can use your account from ANY device/computer that has itunes.
    You seem to completely misunderstand the way it works.
    There is no time limit.  You are confucing your account with associated devices:
    iTunes Store: Associating a device or computer to your Apple ID
    If you want to buy music from your iphone, simply go to Settings and sign into your account.
    The musci your friend bought using your account belongs to you and it is not legal from your friend to use.
    iPhone User Guide (For iOS 6 Software)

  • How can we get the values from the view?

    Hi All,
    my scenario is i have two fields in my view .one is parameter.and another on is select-options.how can i get the user entered values into my selection screen.?
    for the select options i get the values into field-symbol.for parameter i get the value using get_attribute.
    can i use like this in select statement.
    WHERE SERVICE_ID  = ZSD_DD_AUFNRS
                       AND CRE_DT IN <FS_DATE>.
    Regards,
    Ravi.

    Hi Sravan,
    when i am using the below code to generate self defined functions i m getting a error .
    *Generate an object for self defined functions
      DATA: lo_self_functions TYPE REF TO if_salv_wd_function_settings,
    *Generate an object for button 'Confirm'
           lr_button TYPE REF TO cl_salv_wd_fe_button,
           lo_self_function TYPE REF TO cl_salv_wd_function,
                  l_text type string.
    *Set Self-defined functions
    *'Confirm' Button
      lo_self_functions ?= l_value..
      lo_self_function = lo_self_functions->create_function( 'CONFIRM'  ).
      CREATE OBJECT lr_button.
      CLEAR l_text.
      l_text = 'Confirm'.
      lr_button->set_text( l_text ).
      lr_button->set_image_source( '' ).
      lr_button->set_image_first( 'X' ).
      lo_self_function->set_editor( lr_button ).
    Error when processing your request
    What has happened?
    The URL http://cgslsvr3.cgsl.com:8020/sap/bc/webdynpro/sap/zsdr_cash_work_list/ was not called due to an error.
    Note
    The following error text was processed in the system CGD : WebDynpro Exception: IDs Can Only Contain Characters of Syntactical Character Set
    The error occurred on the application server cgslsvr3_CGD_20 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: RAISE of program CX_WD_GENERAL=================CP
    Method: CONSTRUCTOR of program CL_WDR_VIEW_ELEMENT===========CP
    Method: CONSTRUCTOR of program CL_WD_TOOLBAR_BUTTON==========CP
    Method: NEW_TOOLBAR_BUTTON of program CL_WD_TOOLBAR_BUTTON==========CP
    Method: IF_SALV_WD_COMP_TABLE_UI~CREATE_TOOLBAR_ITEM of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_UI~CREATE_TOOLBAR_ITEMS of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_UI~UPDATE_TOOLBAR_ITEMS of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_UI~UPDATE_TOOLBAR of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_UI~UPDATE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_VIEW~MODIFY of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    What can I do?
    If the termination type was RABAX_STATE, then you can find more information on the cause of the termination in the system CGD in transaction ST22.
    If the termination type was ABORT_MESSAGE_STATE, then you can find more information on the cause of the termination on the application server cgslsvr3_CGD_20 in transaction SM21.
    If the termination type was ERROR_MESSAGE_STATE, then you can search for more information in the trace file for the work process 0 in transaction ST11 on the application server cgslsvr3_CGD_20 . In some situations, you may also need to analyze the trace files of other work processes.
    If you do not yet have a user ID, contact your system administrator.
    Error code: ICF-IE-http -c: 110 -u: CT-0024 -l: E -s: CGD -i: cgslsvr3_CGD_20 -w: 0 -d: 20080414 -t: 105835 -v: RABAX_STATE -e: UNCAUGHT_EXCEPTION
    HTTP 500 - Internal Server Error
    Your SAP Internet Communication Framework Team
    How can i resolve it?
    Regards,
    Ravi

  • How can I get the edited value from the editor in JTable

    I have a JTextField added as an editor to a cell in JTable.
    I value gets changed when I press enter.
    but in actionPerformed of the JTextField when I say
    String txtEditorValue = txtEditor.getText();
    I am getting the old value. How can I get the edited value? Thanks.

    Hi,
    I guess, your understanding of how JTable works together with its models is not good enough - for example the method getTableCellEditorComponent(...) of the TableCellEditor interface is used to get the component, that should be used as editing component - its second parameter is a value that should be used to setup the editing component - it is normally not the editing component itself.
    JTable uses an underlying TableModel to store the cell values - if you have edited a cell, JTable gets the value of the editing component by itself and stores it in the TableModel using its setValueAt(...) method. To retrieve this data you only need to query the TableModel using row and column of this cell as parameters
    say jt is your JTable, and row and column are the row and column of the cell - so to get the value, simply use
    Object obj = jt.getModel().getValueAt(row,column);
    if you know, that there is a String in this cell use
    String str = (String) jt.getModel().getValueAt(row,column);
    The editor component is used for the view of the JTable - you only want the data, which is stored in the model - you don't have to deal with the GUI components in this case.
    greetings Marsian

  • How can I get the value of "Warehose" column in a form

    How can I get the value of "Warehouse" column in the form below (I mean what table that contain this value):
    Production Supervisor >> Batches >> (Button) Material Details >> (Button) Line Allocations
    Well, for more clearly! My problem is I must have the Unit Cost of Items, so I've got it in the cm_cmpt_dtl (table), but if I want to, I must create a relation that require 2 filed, they're Item_ID and Whse_Code.
    There's no problem with Item_ID, but Whse_Code seem to be the Mission Impossible (hix, I hate that film!!!!)
    I wonder if It was right to post this topic here. But anyway I just post my question here, hope I could get some help.

    wow, many, many, many.... and many thanks!
    Just add a tiny modify to check out the Batch_type
    doc_id = (select batch_id from gme_batch_header where batch_no='&batch_number' and batch_type = 0)
    Because the batch_no can be duplicated as we also create Batch and Filrm Planned Order.
    Many thanks for your support!
    P/S: Sorry for my terrible English :P

  • How can I get the phone numbers in contacts to appear with dashes between the first 3 numbers, the next 3 numbers, and the last 4 numbers?  Until very recently it did so.  Contacts on my macbook pro does show up this way.  I do have a mobile me account an

    How can I get the phone numbers in contacts to appear with dashes between the first 3 numbers, the next 3 numbers, and the last 4 numbers?  Until very recently
    it did so.  Contacts on my macbook pro does show up this way.  I do have a mobile me account and in the past syncing was no problem.  What setting has changed?

    The phone number format as well as the date language and format and the time format are controlled by the Region Format setting. Go to Settings > General >International > Region Format.  When you change a region format, you can go back one page (to International) and see an example of the date/time/phone number format that your selected region format will produce.

  • HT204053 If I have an apple ID for myself and my wife has just got a iPhone for the first time how can she get the same apps as I have for my iPhone and iPad

    If I have an apple ID for myself and my wife has just got a iPhone for the first time how can she get the same apps as I have for my iPhone and iPad by getting it off my iCloud?

    She can't from iCloud without setting up your iCloud account on her phone. But just sync the same apps from your iTunes Library on your computer to her phone.
    Your wife should setup her own iCloud account - which is separate to the iTunes Store accounts.

  • How can you get the apple tv to work in a hotel where to get on the wifi you have to still go to a website first and put in your room

    How can you get the apple tv to work in a hotel where to get on the wifi you have to still go to a website first and put in your room?

    Welcome to the Apple Community.
    Unfortunately the Apple TV doesn't have a web browser so you can't do that.

  • How can I get the JCheckBox value in JTable?

    I have a JTable with JCheckBox inside. How can I get the value when the user turn on or off the check? I need to do this when the user change the value.
    Thanks for any help.
    Renato

    Hi again,
    no - the datamodel is a class that implements the TableModel-interface - if you do not use your own model in JTable, an instance of DefaultTableModel is used - you can subclass DefaultTableModel and overwrite its setValueAt(...)-method. When you instantiate your JTable do it by passing your DefaultTableModel subclass to the constructor or in the way you do it right now and replace the default model with your model using the setModel(...)-method of JTable.
    greetings Marsian

  • How can i get the maximum salary first in the order of ascending

    Hi,
    How can i get the maximum salary first in the order of ascending.
    I need the sql query.
    my output should like:
    Emp_Name Salary
    A 5000
    SS 100
    AA 300
    DD 700
    WW 2000
    Thanks,
    MuthyaM.

    Here is an example :
    SQL> with mytable as
      2  ( select 'aa' as col1,  300 col2 from dual union all
      3    select 'ss' as col1,  100 col2 from dual union all
      4    select 'a'  as col1, 5000 col2 from dual union all
      5    select 'dd' as col1,  700 col2 from dual union all
      6    select 'ww' as col1, 2000 col2 from dual )
      7  select col1, col2
      8  from   mytable
      9  order by decode(row_number() over (order by col2 desc),1,0,1),col2;
    CO       COL2
    a        5000
    ss        100
    aa        300
    dd        700
    ww       2000
    SQL>Nicolas.

  • How can i get the timestamp of first data at continue sample mode?

    how can i get the timestamp of first data at  continue sample mode?
    6023e pci , and c++ code
    thanks !

    The tangent ist the derivative of the curve in that point. You can try to use a numerical derivative vi or keep it simple an approximate with a line through the adjacent points.
    Gabi
    7.1 -- 2013
    CLA

  • How can i get  the column name   for assigned constraint name  from  the  user_constraints   table?????

    Hi  ,
    I  have a table  so  many constraints   on so  many  columns. I  need to  know  which column has which  constraint plsql dev?? like below...
    table_name -------- col_name ------ constraint_name_of_that_col
        xxxxxx              xxxxxxx              xxxxxxxxxxxxxxxx
    or else please let me know  how can i  get the  corresponding col_name for a particular  constraint name???

    My be this can give you a help:
    [code]
    SELECT *
    FROM   ALL_CONSTRAINTS
    WHERE  R_CONSTRAINT_NAME IN (SELECT CONSTRAINT_NAME
                                                               FROM   ALL_CONSTRAINTS
                                                               WHERE  TABLE_NAME = 'TABLE_NAME'
    [/code]

  • How can I get the address book to sort by "Last" name (using v 31.3.0).

    After a computer crash, I had to load Thunderbird (v31.3.0) back into my machine running Windows 8.1, and I successfully imported my address book back up file into Thunderbird (v31.3.0).
    My problem is that I don't see an option to sort the address book by "Last" name, which was available with the version of Thunderbird I had before the crash.
    How can I get the address book to sort by "Last" name?

    In 'Address Book'
    Select address book
    'View' > 'Show name as' > 'Last/First'
    The you can sort by Name.
    Either click on 'Name' column header to change sort order,
    If reversed, then click on 'Name' column header again to reverse the order.
    Or
    'View' > 'Sort By' > choose 'Name' and 'Ascending'

Maybe you are looking for

  • External hard drive, laptop, having to re-add library folder every startup

    Hi, I have my music library on an external hard drive that is attached to my laptop. Each time I disconnect and reconnect the drive, although iTunes shows all my music I am unable to play anything. I get the message that the original file could not b

  • External backup drive connected to airport router giving  "... backup disk image ... /.../... is already in use" error.

    I just added an external backup drive to my airport router for my desktop and my laptop to use.  Initial backups worked, but now I'm getting "... backup disk image ... /.../...MacBook Pro.sparcsbundle is already in use."  This message is on laptop ev

  • Direct Digital Output through Quicktime?

    I've used iTunes for years (ever since my first iPod) and I've never had a problem with it. However two years ago I got a HiFi receiver. Nothing fancy or anything, but ever since I've been wondering if I could some how bypass my soundcard's DAC and g

  • MP3's

    I hope someone can help me. I am trying to import songs from the i-tunes store as mp3. I set mny preference to do so but they are still being imported as mp4(?) ANy one have any idea how to fix this. I am trying to download music for use in a slide s

  • Printing multiple line items

    i developed PO smartform.the requirement is that i should be able to display all line items on the entire page of total pages and in the last page after the end of the lineitems ,the secondary windows should be displayed  which are declared below the