Regarding JTable selection

Hi,
I did one non-editable JTable. If I press "F2" button on selected row of that table, It's throwing following exception on console. Please try to provide solution for me.
Regards & Thanks,
Sukumar
java.lang.NullPointerException:
at javax.swing.plaf.basic.BasicTableUI$3.actionPerformed(BasicTableUI.java:675)
at javax.swing.JComponent.processKeyBinding(JComponent.java, Compiled Code)
at javax.swing.JComponent.processKeyBindings(JComponent.java, Compiled Code)
at javax.swing.JComponent.processKeyEvent(JComponent.java, Compiled Code)
at java.awt.Component.processEvent(Component.java, Compiled Code)
at java.awt.Container.processEvent(Container.java, Compiled Code)
at java.awt.Component.dispatchEventImpl(Component.java, Compiled Code)
at java.awt.Container.dispatchEventImpl(Container.java, Compiled Code)
at java.awt.Component.dispatchEvent(Component.java, Compiled Code)
at java.awt.LightweightDispatcher.processKeyEvent(Container.java, Compiled Code)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java, Compiled Code)
at java.awt.Container.dispatchEventImpl(Container.java, Compiled Code)
at java.awt.Window.dispatchEventImpl(Window.java, Compiled Code)
at java.awt.Component.dispatchEvent(Component.java, Compiled Code)
at java.awt.EventQueue.dispatchEvent(EventQueue.java, Compiled Code)
at java.awt.EventDispatchThread.pumpOneEventForComponent(EventDispatchThread.java, Compiled Code)
at java.awt.EventDispatchThread.pumpEventsForComponent(EventDispatchThread.java:95)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:90)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

A little busy to help people.
But happy you found my posted message.
http://forum.java.sun.com/thread.jsp?thread=137174&forum=57&message=1135327
Still, I do not research how to unregister yet,
but you can register "null" action.
Good luck.

Similar Messages

  • Tricky Query regarding JTables.

    This is a bit tricky regarding JTables
    I have run the flwg query
    select id_status 'STATUS',id_entity 'ENTITY'
    from TableA
    group by id_status,id_entity
    Output
    STATUS ENTITY
    100      AGL
    123      BSS
    234      RDB
    245      GERI have now both the rows and cols in 2 vectors.
    The Output I want is this:
    Depending on the No.of entities displayed above,these then
    become the column headings and the 4 rows will be shown as one row:
    OUTPUT REQUIRED:
    Type   AGL   BSS   RDB   GER
    Files  100   123   234   245I am able to display the 4 entity names as columns names by :
    for ( int i = 0; i < rowCount; i++ ) {
      m_colName.add(stm.getValueAt(i,2) );  // Where m_colName is a vector.
    JTable table = new Table(m_rowName,m_colName);Now how do I read the data from the row Vector which now contains 4 rows
    as one row and display them
    This is my current row display (which is my current row display)
    for ( int i = 0; i < rowCount; i++ ) {
         m_rows    = new Vector();
         for ( int z = 0; z < colCount; z++ ) {
              m_rows.add(stm.getValueAt(i,z) );
         // Vector of vectors.
         m_rowValues.addElement(m_rows);
    }I may have to modify the above code so that the 4 rows are displayed as one row
    and displayed as discussed above.
    My present output is
    AGL   BSS  RDB  GER
    100
    123
    234
    245Please help me now to read the 4 rows as one row and display them.

    Wrong use of rows/columns. Try like below:
    for ( int i = 0; i < colCount; i++ ) {
         m_rows    = new Vector();
         for ( int z = 0; z < rowCount; z++ ) {
              m_rows.add(stm.getValueAt(i,z) );
         // Vector of vectors.
         m_rowValues.addElement(m_rows);
    }You weren't so far from it ;-)

  • Help regarding JTable in Java Swing

    hi,
    i m confused regarding JTable in Swing. i hav added a JTextField in a cell of a JTable. i hav attached a kay listener with that textfield . But when i m selecting that cell ,where i hav added that textfield with a single click and typeing any key i m not getting that keyevent. But when i m selecting the same with a doulbe click and typing any thing i m getting that event .
    can any one tell me why the discrepency taking place. that textfield is
    there in that cell .then how it does make any difference with a single and double click.
    regards

    i hav added a JTextField in a cell of a JTableYou don't add a text field to a cell in a table. You add a text String to the TableModel. When the user double clicks on the cell an 'editor' is invoked and the text is copied to the editor (which by default is a JTextField). So the KeyStrokes go to the editor text field.
    When you just single click on a cell the table still has focus, not the editor, to the KeyStroke character is passed directly to the text field without the text field actually getting focus.

  • Urgent Regarding Jtable TAB and Arrow keys

    Hi guys and gals,
    In my project i need urgnet help regarding Jtable.I want to use DOWN ARROW key same as TAB function.When i reach the first row last editing coulmn by using arrow key,then i habe to creating a new row with default values.And if press UP key if that row contains no values i have to delete.Plz help me in this regard.
    sreeni

    I meant that the laptop freezes in gdm and in console (tty1). In gdm i can't even type any character. And in console i can login but when i press the tab key (autocompletation) it stops. The only thing i can do is press the power button.
    Actually my keymap is es_ES. And i think that it's working fine because the n tilde and pipes work fine.

  • Cross-JTable selection

    In a scenario where there are two JTable's in order to implement "locked (frozen) columns", one has to address the cross-JTable selection issue that occurs when both tables' "columnSelection" and "rowSelection" properties are enabled, and the user clicks & drags the mouse to select a range of cells across the two JTables.
    Has anyone ever done this?
    Mert

    Interesting question - I would try to register one mouseListener to both tables that makes sure the events are redispatched if the mouse exits the one and enters the other during a addSelection.Or you can try to patch the BasicTableUI.MouseHandler to go on with addSelection even after a mouseExited during a mouseDragged. Never tried it, though. (Always assuming that one there is one selectionListener that extends a selection in one table to the other)
    Greetings
    Jeanette

  • Regarding at selection screen event

    hi experts,
                   i m working on hr abap report with the help of pnp ldb i made my selection screen using report category 'PY_DEF'  now what i want that i m not using the first selction screen which contains current period  details etc but when i click on the payroll period button the second selection screen is coming no doubt... containing payroll area current period ,other periods etc here i m entering payroll area eq 'ka' and  other periods from '012006' to '122006' ,,here i want to validate the user input that it sud be of one year that is from 1 to 12.....for this i know i will use at selection event but how can i use it for the second selection screen not for first screen......... plz help me....

    Do u realy need the first selection screen having the current period? If u don't need then u can hide the field in the report category, by passing only the payroll area with other period, in this case we can validate through selection screen..
    Reward points ... if found helpful...
    Regards,
    Sowmen Das

  • JTable selection problem with jdk1.5.0_05

    Today I tried the new jdk1.5.0_05 release and noticed with a JTable I can only select a single column and row with the mouse. With jdk1.5.0_05 I could select multiple cols and rows with the mouse. I looking at the listselectionmodel for the jtable i see it is set to mulitple. Is this a bug in the new java 1.5 release?

    Yeah, the .jar files are definitely there and the
    small class I just wrote is in the Classes directory.Yes, but you're calling javac.exe, not some jars. Did you check that javac.exe is there? Stupid question, yes, but I've seen it all...
    I changed the path in Control Panel -> System ->
    Advanced -> Environment Variables. I've also beendoing this is the command prompt:
    set
    CLASSPATH=%CLASSPATH%;C:\Java\jdk1.5.0\bin;C:\Java\Cla
    ssesNo need to add the /bin directory to the classpath, there are no classes in it...

  • Intermittent JTable Selection Problem

    Hi,
    Everyone once in a while, under NT with 1.4.x, I have problems selecting and highlighting row under JTable. It happens a good bit, but this does not happen all the time. When the table is buggy, it does not keep the row selected nor does it highlight the row. You may have the row selected on a mousedown, but once you release the mouse it's done.
    Since this is happening for a variety of JTable's I didn't bother to send Java code. Has anyone else encountered this sort of thing? Or does anyone know what I should be looking at?
    The intermittent part is what's killing me. It makes it hard to track down with any high degreee of confidence in the answers.
    thanks for any input or suggestions,
    Geoff

    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    public class Test extends JFrame {
      public Test() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container content = getContentPane();
        String[] head = {"One","Two","Three"};
        String[][] data = new String[40][3];
        for (int r=0; r<40; r++) {
          data[r] = new String[3];
          for (int c = 0; c < 3; c++) data[r][c] = "R" + r + "-C" + c;
        content.add(new JScrollPane(new JTable(data,head)));
        setSize(400, 400);
        show();
      public static void main(String args[]) { new Test(); }
    }I've been clicking until my fingers bled. Can't see a problem.

  • Regarding the select-options on the selection screen

    In select-options the low and high fileds must be displayed in the following explained manner...
    How to get the low field value as 1000 (default) and it must be in display mode (not possible to change the value) and high field must be empty and it has to allow us to enter the value.
    How to get this....?
    Please help me in this regard...
    Thank u very much
    Regards..
    Nagarjuna

    TABLES : mara.
    SELECT-OPTIONS: s_matnr FOR mara-matnr.
    INITIALIZATION.
      S_MATNR-SIGN  = 'I'.  "inclusion
      S_MATNR-OPTION = 'BT'    "between
      S_MATNR-LOW = '1000'.
      APPEND s_matnr.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF screen-name EQ 'S_MATNR-LOW'.
          screen-input = 0.
          MODIFY screen.
          EXIT.
        ENDIF.
      ENDLOOP.
    Reward if Helpful.

  • Regarding the select query

    Hi Experts,
    I have a select query as follows:
    select field1 field2  from db1 into table it1.
    Now suppose the it1-field1 contains values a,b and c.
    Now I want to select fields a,b and c from another db table db2.
    Instead of hard coding like this:
    select a b c from db2 into table it2.....
    How can I do this?
    Points will be awarded.
    Regards,
    Soumya.

    Hi Soumya ,
    Pleas use FOR ALL ENTRIES syntax , in this way you can select the records from db2 which are available or selected in db1.
    Like Header And Item table.
    You select records frm header table . then for corres ponding header records you select from detail table db2 .....
    Condition is the field containg a,b,c  is key field in both tables ...
    Reward points if it helps you .
    Regards
    Amber S

  • Urgent: regarding sub select statement

    I making a report in which i have to display the STOCK and i want to do the sum in a select statement of the value coming from the field AFRU-GMNGA so that i can do calculation of the value of 1st field to be subtracted from the last value of the same field .
    can anybody provide me example of it as i am currently using dis select statement:-
    SELECT AMATNR ALGORT BGMNGA BVORNR C~MEINS FROM AFPO AS A
      INNER JOIN AFRU AS B ON AAUFNR = BAUFNR
        INNER JOIN MARA AS C ON AMATNR = CMATNR
          INTO TABLE ITAB
          WHERE MTART IN MAT_TYPE AND A~MATNR IN P_MATNR .
    plzz help me out as it is really urgent to me.

    Hi,
    Go thr the below select query.
    select tvkwzwerks a350kschl a350vkorg konpkbetr
           from tvkwz inner join a350 on tvkwzvkorg = a350vkorg inner join konp
           on a350knumh = konpknumh into table itab where  tvkwz~werks = '1003'
           and a350~kschl = 'ZCPA'.
    Regards,
    vijay

  • Regarding max select statement.

    hi ,
        i m using max in select statement but its nt showing the o/p,cud u plz help me..thnx in advce.here i m giving the code....
    tables:s032.
    select-options:s_matnr for s032-matnr.
    data:begin of itab occurs 0,
         matnr like s032-matnr,
         letztzug like s032-letztzug,
         end of itab.
    select  matnr
    MAX( letztzug )
    into corresponding
    fields of
    table itab from s032 where matnr in s_matnr
    group by matnr
    order by
    matnr
    loop at itab.
    write:/ itab-matnr,itab-letztzug.
    endloop.

    select matnr
    MAX( letztzug )
    into
    table itab from s032 where matnr in s_matnr
    group by matnr
    order by
    matnr
    dont use corresponding fields of clause it is not matching the field name with max function.
    regards
    shiba dutta

  • Regarding LDB selection screen

    Hi All,
    I copied a standard LDB program "RCATSCMP".
    I have a date fields in selection screen.
    When i debuged the standard program i am getting the date values PN-BEGDA and PN-ENDDA.
    but when iam debugging my program iam not getting any values for these fields.
    How to get these values.
    Thanks in Advance
    kiran i

    Hi Kiran,
      Please check the attributes of the copied program
      and see whether it has logical data base 'PNP' is
      there are not.
    Thanks & Regards,
    Siri.

  • Regarding at Selection-Screen

    Hi Experts,
    In the selection-screen, i have 2 radiobuttons .
    parameters : rb1 radiobutton group g2 ,
                 rb2 radiobutton group g2 .
    and 4 input fields.
    SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.  " OBLIGATORY.
    SELECT-OPTIONS : S_MTART FOR MARA-MTART NO INTERVALS NO-EXTENSION.
    SELECT-OPTIONS : S_WERKS FOR MARA-MATNR NO INTERVALS NO-EXTENSION.
    parameters : lifnr like lfa1-lifnr .
    Now my requirement is when i execute the report by default the 1st radiobutton is selected. For this radiobutton,
    i want to display only the first 3 select-options. And when the user clicks on the second radiobutton,
    the parameter LIFNR should appear without pressing enter button. Again when the user clicks on
    1st radiobutton the parameter field LIFNr should not appear.
    Please can anybod yrpovide the code.
    Thanks in advance.

    Hi,
    Test the Code Bellow it is working as per your requirement,
    TABLES: mara.
    PARAMETERS : rb1 RADIOBUTTON GROUP g2 USER-COMMAND a DEFAULT 'X',
    rb2 RADIOBUTTON GROUP g2 .
    SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
    SELECT-OPTIONS : s_matnr FOR mara-matnr MODIF ID s1. " OBLIGATORY.
    SELECT-OPTIONS : s_mtart FOR mara-mtart NO INTERVALS NO-EXTENSION MODIF ID s1.
    SELECT-OPTIONS : s_werks FOR mara-matnr NO INTERVALS NO-EXTENSION MODIF ID s1.
    SELECTION-SCREEN END OF BLOCK a.
    SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE text-002.
    PARAMETERS : lifnr LIKE lfa1-lifnr MODIF ID s2.
    SELECTION-SCREEN END OF BLOCK b.
    BREAK-POINT.
    AT SELECTION-SCREEN OUTPUT.
      IF rb1 = 'X'.
        LOOP AT SCREEN.
          IF screen-group1 = 'S2'.
            screen-active = 0.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ELSEIF rb2 = 'X'.
        LOOP AT SCREEN.
          IF screen-group1 = 'S1'.
            screen-active = 0.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.
    Best Regards,
    Faisal

  • Regarding At selection-screen on Radiobutton    output....

    Hi...
    This is the code I used, to check AT SELECTION-SCREEN ON RADIOBUTTON.
    But, after displaying the error message,
    all fields are becoming inactive in selection screen.
    CODE:
    TYPES : BEGIN OF st_employee,
                  cid TYPE zintelli_emp-cid,              
                 cname TYPE zintelli_emp-cname,         
             l   ocation TYPE zintelli_emp-location,           
                phno TYPE zintelli_emp-phno ,          
                gender TYPE zintelli_emp-gender,       
            END OF st_employee.
    DATA :  it_employee TYPE STANDARD TABLE OF      st_employee,
            wa_employee TYPE st_employee,
            v_cid TYPE  zintelli_emp-cid.
    SELECTION-SCREEN BEGIN OF SCREEN 500 TITLE title.
    PARAMETERS : p_cid TYPE st_employee-cid obligatory.
    PARAMETERS : p_cname TYPE st_employee-cname,       
                 p_culoc TYPE st_employeelocation,    
                 p_phno TYPE st_employee-phno. 
    SELECTION-SCREEN SKIP 2.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(6) rc1.
    PARAMETERS : rb_1 RADIOBUTTON GROUP b .
    SELECTION-SCREEN COMMENT 15(7) rc2.
    PARAMETERS :  rb_2 RADIOBUTTON GROUP b.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN SKIP 2.
    SELECTION-SCREEN PUSHBUTTON /35(10) pb1 USER-COMMAND pb1.
    SELECTION-SCREEN SKIP 5.
    SELECTION-SCREEN END OF SCREEN 500.
    CALL SELECTION-SCREEN '500'.
    INITIALIZATION.
      title  = 'CUSTOMER INFORMATION'.
      pb1 = 'INSERT'.
      rc1 = 'MALE'.
      rc2 = 'FEMALE'.
    AT SELECTION-SCREEN ON RADIOBUTTON GROUP b.
      IF rb_1 EQ 'X'.
        p_cid = p_cid+0(1).
        IF p_cid NE 'M'.
          MESSAGE e020(z50871msg) WITH 'The id should start with "M" '.
         EXIT.
        ENDIF.
      ELSE.
        p_cid = p_cid+0(1).
        IF p_cid NE 'F'.
          MESSAGE e020(z50871msg) WITH 'The id should start with "F" '.
          EXIT.
        ENDIF.
        ENDIF.
    Regards
    sandeep.

    At selection-screen on FIELD
              Will give work like: If given input is wrong then it will give the Error message and all other fields will be diasable except the entered wrong on At selection-screen on FIELD.
    until you give the right input it won't go for next At Selection-screen On FILED.
    If you Don't want to disable other fields Use ONLY AT SELECTION-SCREEN.
    Regards,
    Umashankar

Maybe you are looking for