How to set column names when not using object of row data in  constructer

hello i am using JTable constructer as
public JTable(int numRows,
int numColumns)
can i set column names for the columns .How?

hi,
sure you can: Create a subclass of DefaultTableModel and overwrite the method public String getColumnName(int) which returns the column name of a specific column. Then use this subclass as the data model for the table.
best regards, Michael

Similar Messages

  • How to set column names in OVS search help of ALV EDIT

    Hi All,
    I have a OVS search help for my ALV EDIT column.This OVS will have two columns,I need to give the names(name1 , name2)  to the columns.
    I am writing the below codo in phase 0.
          ls_text-name = 'Column1'.
          ls_text-value = 'name1'.
          INSERT ls_text INTO TABLE lt_column_texts.
          ls_text-name = 'Column2'.
          ls_text-value = 'name2'.
          INSERT ls_text INTO TABLE lt_column_texts.
          ovs_callback_object->set_configuration(
                    label_texts  = lt_label_texts
                    column_texts = lt_column_texts
                    group_header = lv_group_header
                    window_title =  lv_window_title
                    table_header = lv_table_header
                    col_count    = 2
                    row_count    = 20 ).
    Below code in Phase 3.
          Assign ovs_callback_object->selection->* to <ls_selection>.
          if <ls_selection> is assigned.
            ovs_callback_object->context_element->set_attribute(
            name = `ATR1`
            value = <ls_selection>-Column1 ).
          endif.
    But,the column names are not getting set.Please provide your inputs.
    Regards,
    Salma

    hi,
    About your requirement, i don't know why you need to code in "Phase 3" of OVS.
    "Phase 3" is used for transporting your selected value to Your ALV.
    I think, the reason why you loose the result table including your customized column title, is that you loose the "Phase 2".
    Generally, in the past i used OVS as the following code simply.Just one example:
    * declare data structures for the fields to be displayed and
    * for the table columns of the selection list, if necessary
      types:
        begin of lty_stru_input,
    *   add fields for the display of your search input here
          carrid type string,
          connid type string,
        end of lty_stru_input.
      types:
        begin of lty_stru_list,
    *   add fields for the selection list here
          carrid type string,
          connid type string,
          text   type string,
        end of lty_stru_list.
      data: ls_search_input  type lty_stru_input,
            lt_select_list   type standard table of lty_stru_list,
            ls_text          type wdr_name_value,
            lt_label_texts   type wdr_name_value_list,
            lt_column_texts  type wdr_name_value_list,
      case ovs_callback_object->phase_indicator.
        when if_wd_ovs=>co_phase_0.  "configuration phase, may be omitted
    *   in this phase you have the possibility to define the texts,
    *   if you do not want to use the defaults (DDIC-texts)
          ls_text-name = 'CARRID'.  "must match a field name of search
          ls_text-value = 'Search Field-Carrid'.
          insert ls_text into table lt_label_texts.
          ls_text-name = 'CONNID'.  "must match a field name of search
          ls_text-value = 'Search Field-Connid'.
          insert ls_text into table lt_label_texts.
          ls_text-name = 'CARRID'.  "must match a field in list structure
          ls_text-value = 'Result-Carrid'.
          insert ls_text into table lt_column_texts.
          ls_text-name = 'CONNID'.  "must match a field in list structure
          ls_text-value = 'Result-Connid'.
          insert ls_text into table lt_column_texts.
          ls_text-name = 'TEXT'.  "must match a field in list structure
          ls_text-value = 'Result-Text'.
          insert ls_text into table lt_column_texts.
          lv_group_header = 'Group Header'.
          lv_window_title = 'Window Title'.
          lv_table_header = 'Table Header'.
          ovs_callback_object->set_configuration(
                    label_texts  = lt_label_texts
                    column_texts = lt_column_texts
                    group_header = lv_group_header
                    window_title = lv_window_title
                    table_header = lv_table_header
                    col_count    = 3
                    row_count    = 8 ).
    when if_wd_ovs=>co_phase_2.
    *   If phase 1 is implemented, use the field input for the
    *   selection of the table.
    *   If phase 1 is omitted, use values from your own context.
          if ovs_callback_object->query_parameters is not bound.
    ******** TODO exception handling
          endif.
          assign ovs_callback_object->query_parameters->*
                                  to <ls_query_params>.
    SELECT * INTO CORRESPONDING FIELDS OF TABLE lt_select_list FROM ZTABLE_FLIGHT
                           WHERE CARRID LIKE lw_carrid
                                 AND CONNID LIKE lw_connid
    *ovs_callback_object->set_output_table( output = lt_select_list ).*
    Hope it can help.
    Best wishes.

  • Set cursor alv grid (not using objects)

    I got a question on ALV GRID (not using objects), please let me know if you have pointers. Thanks.
    Output has 2 screens both has different contents. The output is generated using internal table1 and 2 and using FM  'REUSE_ALV_GRID_DISPLAY_LVC'  (both screen use same FM).
    First screen has multiple pages of output (say 10 pages). User scrolled page 5 and line 10 of first screen and then double clicked it takes to screen #2. After completion of screen #2, the back arrow should get back to page 5 and line 10 of screen #1. Currently the back arrow gets to screen#1 page 1 and line 1. How to remember the cursor position in alv grid and instruct the cursor to go there?
    Appreciate the input.
    Note: I tried "set cursor line n" with "Scroll" command but no luck. http://help.sap.com/saphelp_nw70/helpdata/EN/9f/dba47e35c111d1829f0000e829fbfe/content.htm

    Thanks for the inputs.
    FYI, I got it implemented using method  CALL METHOD <ref.var. to CL_GUI_ALV_GRID > ->set_current_cell_via_id
    The method is called by 'REUSE_ALV_GRID_DISPLAY_LVC' form 'PF_STATUS_SET' when the ALV grid output is presented each time.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
        EXPORTING
          i_bypassing_buffer       = 'X'
          i_callback_program       = gc_repid
          i_callback_pf_status_set = 'PF_STATUS_SET'
          i_callback_user_command  = 'USER_COMMAND'
          is_layout_lvc            = lwa_layout
          it_fieldcat_lvc          = git_fc_lvc
          i_default                = ' '
        TABLES
          t_outtab                 = git_data
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      FORM alv_event_pf_status_set USING rt_extab                
                                 TYPE slis_t_extab.
      DATA lo_ref1 TYPE REF TO cl_gui_alv_grid.
    *Get the reference to class "lo_ref1" for the ALV report
      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
        IMPORTING
          e_grid = lo_ref1.
    *set the focus of cursor in ALV
      CALL METHOD lo_ref1->set_current_cell_via_id
        EXPORTING
          is_row_no = gv_row. "row number where you want to focus the cursor
      ENDFORM.

  • How to set style italic when i use ole2 to deal with excel?

    hi ,every body.
    i received a requirement today,in which user want to set style italic?
    pls tell me how can i do it, tks!

    Use
    SET PROPERTY OF GS_FONT 'Italic' = '1' .

  • How to retrieve column name from Excel using POI HSSF eventusermodel?

    Hi ,
    I am simply reading the excel sheet and writing in a txt file. I have done the following in the switch construct. It works fine but I want to retrieve only the column header. But this code gives me all available strings in the excel sheet. Any pointer would be greatly appreciated.
    case SSTRecord sid : 
             SSTRecord sstrecord = (SSTRecord) record;
             for (int i=0; i<sstrecord.getNumUniqueStrings(); i++){      
                  System.out.println(" Column name" +  sstrecord.getString(i));
    break;bye for now
    Sat

    try labels:
            case LabelSSTRecord.sid:
                LabelSSTRecord lrec = (LabelSSTRecord) record;
                if (lrec.getRow() == 0) {
                    System.out.println(" Column name "
                            + sstrec.getString(lrec.getSSTIndex()));
                break;

  • How to find column names in a table

    Am learning the basics of SQL Plus.
    Have entered the following query:
    SELECT * FROM t_ebb_session;
    This gives me the following output.
    USER_ID SESSION_ID LAST_ACCE
    However LAST_ACCE is not the full name of the column as I get 'Invalid column name when I use it in a select statement.
    How do I display the full name?

    By default, SQL*Plus will set the column display width of a character column to its size in the database, and the heading will be the column name in uppercase, truncated to fit that width if necessary. (There is a different rule for numeric columns.)
    You can override this with the COLUMN command, e.g:
    COLUMN some_column_name FORMAT a30 HEADING "Alternative Name"
    Check out the SQL*Plus documentation for all the COLUMN options.

  • Setting column names in JTable

    can n e one tell me how to set column names for JTable..
    i don't wanna use the JTable constructor ... cuz
    my column names change...

    this is how i did it once...hope it helps
    Vector columnNames = new Vector();
    JTable previewTable = new JTable();
    previewTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    previewScrollPane.getViewport().add(previewTable, null);
    int colNo = 2; // i am displaying 2 columns
    columnNames.add("Col One");
    columnNames.add("Col Two");
    String[] tableColumnNames = {"Id Name","Type"};
    DefaultTableModel aModel = (DefaultTableModel) previewTable.getModel();
    aModel.setColumnIdentifiers(tableColumnNames);
    //add data to the table
    .//loop
    aModel.addRow(objects);
    previewTable.revalidate();
    previewTable.setModel(aModel);

  • How do I turn off background ni file activity when not using Labview? files such as nimxs.exe, nipalsm.exe, nipalsm.exe, nisvcloc.exe, nicitdl5.exe

    How do I turn off background ni file activity when not using Labview? I use labview rarely, and I also use my computer for demanding multimedia applications, including multitrack digital audio recording. I need to reduce as much background activity as possible, and taking a look with task manager I see files such as nimxs.exe, nipalsm.exe, nipalsm.exe, nisvcloc.exe, and nicitdl5.exe running even when I haven't used Labview (8 I believe). These files run even after I right click the NI icon on the lower right and turn off the application. I would like the computer to boot up without these files, and for the necessary files to be activated only when I start the program.
    Can this be done or do I have to remove labview from the system to improve performance?
    Thanks

    Hello, those processes are part of running NI services that start when Windows boots.  These processes serve varied purposes and stopping them can have undefined and unknown consiquences for your NI products.  These products run at "normal" priority meaning that they should be preempted by any process running at a higher priority which I would expect your other application to be doing given their time sensitivity.  That being said, in Windows XP (I can't speak for other OSes), you can lower their priorities even greater through task manager (right click the process»set priority) to further remove them from contention for resources.  If you want to prevent them from running you can set the service startup type to "manual" in Control Panel»Administrative Tools»Services.  Right click the process go to Properties and Under the General tab choose Startup Type»Manual.  This will start up the processes only when something directly starts it up.  LabVIEW will start these processes up as it attempts to use them.  When you shut down LabVIEW you will need to manually shut down these processes through task manager.  Again, doing this can cause problems with your NI products on your system and it is not advised.
    Travis M
    LabVIEW R&D
    National Instruments

  • How to dynamically set column name in Answers

    Hi.
    How to dynamically set column name in Answers, for example I want to put presentation variable in column header. Is this possible?
    Regards,
    Goran Ocko
    http://108obiee.blogspot.com/

    May be a rude way .. but it works.
    Add narrative view and use Java script to change the column headings based on the variables.
    <script language="javascript" type="text/javascript">
    var a = document.getElementById('idResultsTableParent');
    var rows= a.getElementsByTagName('tr');
    rows[1].cells[1].innerText ="@{Presentation Variable}";
    </script>
    Editing the same post to remove irrelevant information.
    - Girish

  • Mail app closes when not used for a while how fix?

    mail app closes when not used for a while how fix?

    This may also be due to the Sudden Termination feature built into OS X, which will effectively quit a process if the system is demanding resources. Mail can be a RAM hog at times, and if your system only has a few GB of RAM, then when other programs demand more and you have not been using Mail then the system will invoke Sudden Termination to quit it so more RAM is available elsewhere.
    Do you have only ~2-4GB of RAM in your system? Check for this in the About This Mac option in the Apple menu, and if so then consider upgrading to more if your system supports it. Alternatively you can try quitting other applications to free up more RAM.
    To see which programs are using the most RAM, open the Activity Monitor utility and choose My Processes from the drop-down menu. Then ensure Real Memory is checked in the View > Columns menu, and click this menu's title to sort the items by it.
    Keep in mind that sudden termination does not fully quit the program, so Mail may still show up in Activity Monitor when you open it even though it may be closed from the Dock.

  • Can someone tell me how to set my name so when I send a text it shows up instead of my phone number

    Can someone tell me how to set my name so when I send a text it shows up instead of my phone number

    You can't do that. Only the sending number is transmitted by the carrier with an SMS message. If the recipient has you in their address book, with most smart phones and some others, the name will display, but that's a function of the phone on the receiving end.

  • How can I get Firefox to NOT use DDE? If I uncheck it in Windows XP "Folder options" it keeps getting re-checked. When checked, it takes minutes to get Firefox to open on a page linked from Outlook.

    How can I get Firefox to NOT use DDE? If I uncheck it in Windows XP "Folder options" it keeps getting re-checked. When checked, it takes minutes to get Firefox to open on a page linked from Outlook.

    Open link/bookmark in new tab in same window:
    *Middle-click (press the mouse scroll wheel) the link
    *Ctrl+left click the link
    *right-click the link, choose "Open Link in New Tab"
    Open link/bookmark in new window:
    * Shift+Enter on the link
    * Shift+left click on the link
    See: http://www.7is7.com/software/firefox/shortcuts.html

  • How I can delete set of book that not use, it is creating wrongly?

    Dear Valued Consultant ,
    How I can delete set of book that not use, it is creating wrongly?
    Is there a way to delete Set of Book that not use, it is created wrongly?
    The Goal:
    This wrongly set of book it is appears always in any where that need select the Set of Book that may be cause select the wrongly one
    Thanks for alawys Helping

    Pl see if ML Doc 160623.1 (How to Delete a Set of Books from General Ledger?) helps.
    HTH
    Srini

  • Setting Column Names in Dynamic Pivot Query

    Hi all,
    I'm having trouble setting column names in a dynamic pivot query and was wondering if someone could please help me figure out what I need to do.
    To help you help me, I've setup an example scenario in my hosted account. Here's the login info for my hosted site at [http://apex.oracle.com]
    Workspace: MYHOSTACCT
    Username : DEVUSER1
    Password : MYDEVACCTAnd, here is my test application info:
    ID     : 42804
    Name   : dynamic query test
    Page   : 1
    Table 1: PROJECT_LIST         (Alias = PL...  Listing of Projects)
    Table 2: FISCAL_YEAR          (Alias = FY...  Lookup table for Fiscal Years)
    Table 3: PROJECT_FY           (Alias = PF...  Intersection table containing project fiscal years)
    Table 4: PROJECT_FY_HEADCOUNT (Alias = PFH... Intersection table containing headcount per project and fiscal year)Please forgive the excessive normalization for this example, as I wanted to keep the table structure similar to my real application, which has much more going on.
    In my sample, I have the "Select Criteria" region, where the user specifies the project and fiscal year range that he or she would like to report. Click the Search button, and the report returns the project headcount in a pivoted fashion for the fiscal year range specified.
    I've got it working using a hard-coded query, which is displayed in the "Hardcoded Query" region. In this query, I basically return all years, and set conditions on each column which determines whether that column should be displayed or not based on the range selected by the user. While this works, it is not ideal, as there could be many more fiscal years to account for, and this is not very dynamic at all. Anytime a fiscal year is added to the FISCAL_YEAR table, I'd have to update this page.
    So, after reading all of the OTN SQL pivot forums and "Ask Tom" pivot thread, I've been able to create a second region labeled "Dynamic Query" in which I've created a dynamic query to return the same results. This is a much more savvy solution and works great; however, the column names are generic in the report.
    I had to set the query to parse at runtime since the column selection list is dynamic, which violates SQL rules. Can anyone please help me figure out how I can specify my column names in the dynamic query region to get the same column values I'm getting in the hardcoded region?
    Please let me know if you need anymore information, and many thanks in advance!
    Mark

    Hi Tony,
    Thanks so much for your response. I've had to study up on the dbms_sql package to understand your function... first time I've used it. I've fed my dynamic query to your function and see that it returns a colon delimited list of the column names; however, I think I need a little more schooling on how and where exactly to apply the function to actually set the column names in APEX.
    From my test app, here is the code for my dynamic query. I've got it in a "PL/SQL function body returning sql query" region:
    DECLARE 
      v_query      VARCHAR2(4000);
      v_as         VARCHAR2(4);
      v_range_from NUMBER;
      v_range_to   NUMBER;         
    BEGIN
      v_range_from := :P1_FY_FROM;
      v_range_to   := :P1_FY_TO;
      v_query      := 'SELECT ';
      -- build the dynamic column selections by looping through the fiscal year range.
      -- v_as is meant to specify the column name as (FY10, FY11, etc.), but it's not working.
      FOR i IN v_range_from.. v_range_to  LOOP
        v_as    := 'FY' || SUBSTR(i, 3, 4);
        v_query := v_query || 'MAX(DECODE(FY_NB,' || i || ',PFH_HEADCOUNT,0)) '
          || v_as || ',';
      END LOOP;
      -- add the rest of the query to the dynamic column selection
      v_query := rtrim(v_query,',') || ' FROM ('
        || 'SELECT FY_NB, PFH_HEADCOUNT FROM ('
        || 'SELECT FY_ID, FY_NB FROM FISCAL_YEAR) A '
        || 'LEFT OUTER JOIN ('
        || 'SELECT FY_ID, PFH_HEADCOUNT '
        || 'FROM PROJECT_FY_HEADCOUNT '
        || 'JOIN PROJECT_FY USING (PF_ID) '
        || 'WHERE PL_ID = ' || :P1_PROJECT || ') B '
        || 'ON A.FY_ID = B.FY_ID)';
      RETURN v_query;
    END;I need to invoke GET_QUERY_COLS(v_query) somewhere to get the column names, but I'm not sure where I need to call it and how to actually set the column names after getting the returned colon-delimited list.
    Can you (or anyone else) please help me get a little further? Once again, feel free to login to my host account to see it first hand.
    Thanks again!
    Mark

  • How to pass column name at run time in function.

    how to pass column name at run time in function as parameter.
    thank in advance
    pramod patel

    Hello,
    Using dynamic sql you can pass column name to function. well I am not getting what you really want to do ? Please write in more detail. By the way I am providing one example here. see it uses dynamic sql.
    Create or replace function fun_updtest (p_columnname_varchar2 in varchar2,
    p_value_number in number)
    return number is
    v_stmt varchar2(500);
    begin
    v_stmt := 'update emp
    set '||p_columnname_varchar2||' = '||to_char(p_value_number)||'
              where empno = 7369';
    execute immediate v_stmt;
    return 0;
    commit;
    end;
    call to this function can be like this..
    declare
    v_number               number;
    begin
    v_number := fun_updtest('SAL',5000);
    end;
    Adinath Kamode

Maybe you are looking for

  • Problem with list and map in GWT

    I have a problem with map and list in GWT. I need to put a map in to a list but GWT does not support ArrayList and HashMap since they are not serialized types. Exactly I want to create following list with out using ArrayList and HashMap ArrayList<Has

  • Example using setcontenttype to write binary data?

    Hi there, I'm having trouble getting my jsp to read a binary file and send the response to an http client. I'm not sure what it could be between the getWriter, getOutputStream, setcontenttype, and other methods involved. Can anyone provide and/or poi

  • How to get the UnitOfWorkChangeSet in v. 9.0.3

    Is there any way to get the UnitOfWorkChangeSet on the version 9.0.3 of the API? I need a way to check the change status of any given row.

  • PSE 7.0

    I've been using PSE 2.0 for years and liked the create web photo gallery option so I can show my pictures on my web site. Just purchased PSE 7.0 and discovered the option is now gone. It's been on every version until 7.0 Serves me right for assuming

  • Vista - WRT54G Wireless Router Problem

    I'm sure your all tired of answering this question or variations of, but here we go. I have a WRT54G V.6 wireless router running a hard wired pretty new Hp Pavallion With Vista Home premium. It's running an AMD Athlon 64 X2 Dual Core 5000+- 2.60 GHz