Selecting a column in the JTableHeader

Hi all,
I am currently working on an application where the user (by d n' d or cut n' paste) should be able to add data to a table. It works fine to add data to the table and display it by using a renderer, but it seems to be impossible to add data to the header. The header won't get selected when clicking on it (and thus never receives the focus...). I have tried various ways of using mouse listeners, overriding the isFocusTraversable() in JTableHeader, setting table.setColumnSelectionAllowed(true), and header.setRequestFocusEnabled(true), but nothing is working. How on earth can I select a column header?

You definitely will have to roll your own: as is JTableHeader does not support the notion of selection.
To do so, you will need to change several things:
1. make the XXTableHeaderUI aware of selection (it always sends false for both isSelected and hasFocus when it repaints the renderer)
2. have a custom headerRenderer that respects the flags selected/focus
3. make some object responsible for sending notification if the value for the columnHeader does change - as is the columnNames are stored in the TableModel, but nothing happens when they are changed; so easiest would be to make a customTableModel responsible for firing some event.
4. make the header listen to the changes.
As you see, it's quite involved. Good luck
Jeanette

Similar Messages

  • How to get the selected rows & columns in the table?

    hi everybody,
                         In my application the table is kept inside the event structure.I select the cells  in the table (using mouse) on running time.How to get the selected number of rows & columns in that table?

    Hello,
    You can fill selected values of the table by writing to it or the corresponding property using a property node - the table is just a 2D array of strings.  I think for your "disable" question you are referring to the shortcut menu (when you right click).  If you are using LabVIEW 8.x, you can edit or disable that shortcut menu - just right click on your table at edit time and choose Advanced >> Run-Time Shortcut Menu.
    Best Regards,
    JLS
    Best,
    JLS
    Sixclear

  • How to write a query to select a column where the column value ends with %

    Hii people!!
    I want to select bag_code where bag_code ends with %, e.g. A2389% from the table bags using the following
    query:
    select bag_code from bags where bag_id in
    (select bag_id from store where store_id = 3266)
    and bag_code like '%_%'
    Now the problem's it returns all the possible bag codes in the store with store_id 3266.
    how should i write such a query?
    Abhishek.

    I could even imagine
    SQL> create index r on emp(reverse(ename));
    Index created.
    SQL> select empno,ename from emp where reverse(ename) like 'T%';
         EMPNO ENAME     
          7788 SCOTT      It is too sad that we have to use fbi, since reverse index does exists, but it does not get use for range scan :-(
    SQL> create index r on emp(ename) reverse;
    SQL> select * from emp where ename like '%T';to tune thomas query, if you are only looking for %, then you could do
    where ... decode(substr(bags.bag_code, -1),'%',1) is not null
    and
    create [bitmap] index fbi_pct on bags(decode(substr(bag_code, -1),'%',1));
    Regards
    Laurent

  • What is the difference betwwen SELECT ALL Column and Select Speceific Colum

    Hi All,
    If the block size of the database is 8K and average row length is 2K and if we select all column of the table the I/O show that it had read more blocks then compare to
    specific column of the same table. Why is this?
    Secondly if Oracle brings a complete block is the db buffer cache, while reading block from disk, they why there is a difference of block count in two queries.
    This difference reveals to me when I check the EXPLAIN PLAN for two different queries against the same table but one select all columns and the other one select specific column.
    Kindly help me in clearing this confusion.
    Regards,
    Kamran

    user1514587 wrote:
    >
    Usually, indexes are smaller (contain fewer blocks) than the table - ergo, select empno from emp could be satisfied by reading fewer blocks.
    what if there is a composite Index on a table containing 3 to 4 columns and the size of table is in 100 of GB and Index size itself is vey large then I think Oracle will go for FTS and small Index scan will be expensive. Kindly Share your thoughts.
    Regards,
    KamranHandle:     user1514587
    Status Level:     Newbie (5)
    Registered:     May 9, 2011
    Total Posts:     21
    Total Questions:     13 (12 unresolved)
    I think you wastes everyone's time here since you rarely get answer to any posted question

  • Force a GROUP BY to a dimension without including the column in the SELECT

    Post Author: ewagener
    CA Forum: Desktop Intelligence Reporting
    I have a SUM measure object in my universe that has a Select statement consisting of a COUNT(distinct([Some column on Fact Table])).  I would like to force a join to a dimension table and subsequent GROUP BY statement for one column on the dimension table anytime that this measure object is used. 
    I know that I can force the join from the fact table to the dimension table by simply putting the join syntax in the WHERE clause of the measure object.  Example
    SELECT COUNT(distinct ([Some column on Fact Table]))
    WHERE FACT.DIM_KEY = DIM.DIM_KEY
    The SQL that BusObj generates is correct and a join is made whenever the object is used, even by itself.  Now I want to force BO to include a GROUP BY clause for one of the columns that is on the dimension table, while not forcing the user to select that column in the report.  The SQL that I would like BO to generate is:
    SELECT COUNT(distinct ([Some column on Fact Table]))
    WHERE FACT.DIM_KEY = DIM.DIM_KEY
    GROUP BY DIM.FIELD_A
    I know a u201Cwork aroundu201D is to just include FIELD_A in my report and then hide it or remove it from the results.  This works because I have the appropriate join defined in my universe linking the fact table to the dimension table on the PK/FK relationship.  My report writer user does not want to have to add the column then remove it from the report, however, even though it gives her the correct answer.  She has asked if we could do all of that behind the scenes.  I also know that the ultimate solution would be do declare another fact grain and either use a view or a new fact table altogether.  It may come to that, however, I am looking for a quick solution to just force the object to do a GROUP BY to a field in a dimension not selected in the report.
    Thanks,
    Ed

    Post Author: amr_foci
    CA Forum: Desktop Intelligence Reporting
    i think you have to revise the Structre Query Language of your DBMS
    there is nothing called Group by without a dimension to group by it
    good luck
    Amr

  • Preview's PDF text select ignores columns and misses word spaces

    I have a number of scanned pdf newspaper articles that I was attempting to copy the text from. Preview appears to register the existence of columns, as there is a pale blue background between the columns.
    However when I use the text select tool, it completely ignores the column - and just selects across all columns. And when I paste the text into my text editor, it's missing all the spaces between the words, and the font size is always huge.
    Conversely, Adobe reader in XP has no problem selecting by column, and the pasted text is also an exact replication of the original content. I don't know why Preview performs so badly in this regard? Anyone else experience any issues with pdf text select?

    Anyone else experience any issues with pdf text select?
    Yes, and not just recently.
    There is a reason Preview is named, well, preview. It is not an authoring environment and PDFs are not meant to serve in that context either...unless maybe you understand all of inherent the font traps, tricks & tips and how to tune your scanning/OCR software to keep rework to a minimum.
    Scanning PDFs is always tricky, and without the occasional heavy metal to bring to the task, it just seems to be that more problematic.
    Keep trying, but I'd really suggest to look to other tools at this time.

  • How to programmatically select a column in a JTable

    Hi,
    I'm writing a program which requires me to select a column in the JTable through code. The problem is that I could only find getSelectedColumn() function in JTable and no setSelectedColumn().
    Please let me know if there is any workaround for this.
    Regards,
    Derreck

    Hi,
    table.setColumnselectionInterval(index0,index1);
    The above line will suffice your requirement.
    Cheers,
    Gokul.

  • Columns in the table

    Hi,
    Suppose I have a table with 50 columns.
    First I want to display five specific columns in a order then the remaining 45 columns should be displayed without specifying in the select statement.
    Please let me know the SQL statement.
    Thanks and Regards,
    A.Mohammed Rafi.

    Sorry I think u have misinterpreted the question.
    my clarification is suppose if we have 50 columns in a table
    i want to select few columns and the reamining columns should be displayed with being specified in the select statement.

  • Missing Column in the appraisal template

    I have selected a column in the category and in the criteria. I have assigned the value list. But this particular column is not getting displayed. All columns except this one only is displaying. Do you know where wrong, I might have done.

    Hi Vishal,
    Check OSS Note 1284562.
    Donnie

  • Dynamic selection of columns in report and print the output

    Hi,
    I tried to have dynamic selection of columns in SQL query using lexical parameter. The hitch is how to print those selected column in excel ouput ?
    Suppose
    I have select &col from table_name
    Initial value of &col is col1 and in data layout only col1 appears
    where &col was replaced with more than a column (col1,col2,col3)
    now how to print the column selected at the run time,
    i have coded in Before Report Trigger
    :cell_val := ' <td><rw:field id:"cl1" src="col1"></rw:field></td>
    <td><rw:field id:"cl2" src="col2"></rw:field></td>
    <td><rw:field id:"cl3" src="col3"></rw:field></td> ' ;
    and this user parameter was replaced in web source using JSP expression
    <rw:getvalue id: "v_cell" src:"cell_val"></rw:getvalue>
    <rw:foreach src:"g_val">
    <table>
    <tr>
    <% =v_cell%>
    </tr>
    </table>
    </rw:foreach>
    but in the output i can see only blank columns
    Regards
    Suresh

    The strings replaced by expression <%= v_cell %>
    should print the field values contained in col1,col2,col3 columns, but nothing is printed . i think the custom tags (rw...) are not replaced by the jsp expression properly.

  • How to display only selected columns in the table on the tableview

    Hi All,
    I am displaying in the below tableview the data from the SFLIGHTS tables in the tableview using flow logic. It displays all the columns in the database table. How can I set in the code to display only selected columns and not all columns.
    Also, in these columns displayed I want to make the key columns of SFLIGHT as non editable and the rest of the columns in SFLIGHT editiable. Can you please kindly share the code to implement this.
    <%@page language="abap" %>
    <%@extension name="htmlb" prefix="htmlb" %>
    <htmlb:content design="design2003" >
      <htmlb:page>
        <htmlb:form>
          <htmlb:tableView id              = "tv1"
                           visibleRowCount = "10"
                           selectionMode   = "lineEdit"
                           table           = "<%= flights %>"
                           filter = "SERVER"
                           sort = "server"
                           iterator        = "<%= iterator %>" />
        </htmlb:form>
      </htmlb:page>
    </htmlb:content>
    Thanks
    Karen

    Hi,
       Please try this code.
    <!-- To display Table control on BSP page with table internal table it_hist  --!>
              <htmlb:tableView id              = "TV_HIST"
                               headerText      = "Previous History"
                               headerVisible   = "TRUE"
                               footerVisible   = "TRUE"
                               design          = "ALTERNATING"
                               selectionMode   = "LINEEDIT"
                               visibleRowCount = "5"
                               fillUpEmptyRows = "TRUE"
                               table           = "<%= it_hist %>"
                               width           = "500" >
    <!--  to show selected columns give required field name --!>
    <htmlb:tableViewColumns>
      <htmlb:tableViewColumn columnName          = "FIELD1"
                                         title               = "COLUMN1"
                                         horizontalAlignment = "CENTER"
                                         width               = "65" >
                  </htmlb:tableViewColumn>
      <htmlb:tableViewColumn columnName          = "FIELD2"
                                         title               = "COLUMN2"
                                         horizontalAlignment = "CENTER"
                                         width               = "65" >
                  </htmlb:tableViewColumn>
      <htmlb:tableViewColumn columnName          = "FIELD3"
                                         title               = "COLUMN3"
                                         horizontalAlignment = "CENTER"
                                         width               = "65" >
                  </htmlb:tableViewColumn>
      <htmlb:tableViewColumn columnName          = "FIELD4"
                                         title               = "COLUMN4"
                                         horizontalAlignment = "CENTER"
                                         width               = "65" >
                  </htmlb:tableViewColumn>
    <!--  to make column editable set edit property to TRUE --!>
      <htmlb:tableViewColumn columnName          = "FIELD4"
                                         title               = "COLUMN4"
                                         edit = "TRUE"
                                         horizontalAlignment = "CENTER"
                                         width               = "65" >
                  </htmlb:tableViewColumn>
                </htmlb:tableViewColumns>
              </htmlb:tableView>

  • How to make columns in the select list dynamic

    Hi
    I need to make columns in the select query dynamic.I have three tables.Table 1 contains master information lets say name of group(A group consists of members of various skill sets) and its period(A group is of specific period lets say for 18 months).Table 2 contains different skill sets corresponding to a group i.e there is one to many relationship between table 1 and table 2.Table 3 contains months information of skill sets.For example if skill set 1 is required for 5 months then there will be 5 rows(for each month) in table 3 corresponding to a skill set i.e there is again one to many relationship between table 2 and table 3.Tabale 3 will also contain man month value for perticular month.I need to show all the periods of a group and its sum of man month value for all skill sets.
    If group1 is of 6 months (starts nov2006 and ends Apr2007) and has 5 skill sets then there will be one entry in table 1 and 5 entry in table 2(For skill set).For each entry in table 2 there will be 6 entry in table 3(for each month).I need to write a query which would display
    Group name   nov2006   dec2006   jan2007   feb2007  mar2007 apr2007
    Gr1             10          15      21      17         18         22--These are sum of man month of all skill set for a particular groupIf Gr 2 is of 9 months then it would disply all the information in respective months.i.e for group 2 nine months information and group 1 six months information
    Pls help
    Thanks in advance
    Sas

    Hi,
    From your requirement, we understand that you want to make Rows in table 3 as Columns.
    Please search pivot in this Forum.
    Regards
    K.Rajkumar

  • Re: Getting the current selected Row & column in adf table

    Hi,
    Our requirement is we have to retrieve both the current row and column in adf table.
    We can retrieve the current row in the backing bean like
    ViewObject view = getViewObject();
    view.getCurrentRow();
    Is it possible to retrieve selected column id or column header text as we are getting for row?
    please give some sample.
    Thanks,
    Vijay.
    Edited by: Vijayakumar Palanisamy on Jun 23, 2011 2:23 AM

    Hi John
    My exact requirement,
    1.     We have collection of records in adf table
    2.     Each cell in the row has commandImageLink (Like adding approver, edit approver, delete etc)
    Currently it’s working fine for me in the commandImageLink listener, but the problem is table is refreshed 2 time,
    while selecting a record and commandImageLink is clicked, I have to avoid 2 times refreshing,
    If it’s possible to identify a particular cell in the row selection, I can avoid the image link listener.
    we are using Jdeveloper11.1.1.4.0
    Please suggest.
    Thanks,
    Vijay

  • Inserting multiple selection from checkbox in to one column of the database

    Hi,
    how to insert multiple selection from checkbox into one column of the database.(I select array of values from checkbox ,then how to insert tat array of values iinto single column name).
    Anyone can u reply me
    Thanx

    hhhmmm.... is this what you mean?
    lets say you hava a checkbox1 with values value1, value2, value3 and you selected all there of them? then you want then to be stored in the database in one column?
    now the question is:
    Is it going to be one column one row?
    datafield
    value1,value2,value3
    Or one column multiple row?
    datafield
    value1
    value2
    value3
    Which is it?

  • Inserting multiple selection from checkbox into one column of the database

    Hi,
    How to insert multiple selection values from checkbox into one column of the database.
    Anyone can u help me
    Thanx

    hi
    try to use request.getParameterValues("fieldname")

Maybe you are looking for