Programatically click the table header?

hello
how do you programatically click the table header? i have some panels in a table...there is a button in each one that says "remove" to remove that panel from the table. when i tablemodel.removeRow(thisRow), it sorta does: the row is gone, the overall count is reduced, but it displays wrong until i click on the table header..
for example..if it lists job 1, 2, 3, 4, and 5. if i delete job #2. 1, 2, 4, 5 are left. when i click on the header it shows: 1, 3, 4, 5 as it should. any query i make to what is there before the header shows the same thing: 1, 2, 4, 5. wierd eh? so i need a way to click on that header programatically. i know its a hack, but i cant figure out why its not deleting the right oen for that little time before the header-click.

When you say table, I'm assuming you mean JTable since you're using
a TableModel.
You might try just encouraging the table to redraw itself as that's
probably what is happening when you click the header. I've noticed
that is often required when removing components. Anyways, I'd try
experimenting with calls to
repaint() and/or
validate() or invalidate()
on the JTable or its parent and see what happens.
: jay

Similar Messages

  • Clicking the table header column programmatically

    Hi
    For sorting of the JTable I've used the TableSorter API provided in this site. What I need to do is by clicking on another panel the panel containing the JTable should be displayed sorting the respective column. So what I need to do is click the table header column programmatically. Do you know how can I do that.
    Thanx.

    Take a look at setSortingStatus function in TableSorter.
    If you want ascending sort just call:
    setSortingStatus(columnIndex, 1);This is the code executed when you press table header, it might give you some more insight:public void mouseClicked(MouseEvent e) {
                JTableHeader h = (JTableHeader) e.getSource();
                TableColumnModel columnModel = h.getColumnModel();
                int viewColumn = columnModel.getColumnIndexAtX(e.getX());
                int column = columnModel.getColumn(viewColumn).getModelIndex();
                if (column != -1) {
                    int status = getSortingStatus(column);
                    if (!e.isControlDown()) {
                        cancelSorting();
                    // Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} or
                    // {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is pressed.
                    status = status + (e.isShiftDown() ? -1 : 1);
                    status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1}
                    setSortingStatus(column, status);
            }

  • Clicking on table header throws exception

    I'm using Windows Look and Feel. I made a table and applied the custom renderer to the table header. When I click the table header it throws a NullPointerException relating to the plaf.
    javax.swing.plaf.basic.BasicTableHeaderUI$MouseInputHandler.mouseClicked(Unknown Source)+
    Anybody any Idea. Adding the mouse Listener solves this problem but I dont want to use the listeners just for that reason.

    Take a look here:
    http://www.codeguru.com/java/articles/218.shtml

  • How to add the Row count(number of rows in table)  in  the table header?

    Hi,
    I'm having a table. This table is viewed when i click on a search button.
    <b>On the table header it should dynamically display the number of rows in the table, i.e., the row count.</b>
    How to do this? could any one explain me with the detailed procedure to achieve this.
    Thanks & Regards,
    Suresh

    If you want to show a localized text in the table header, you should use the <b>Message Pool</b> to create a (parameterized) message "tableHeaderText" like "There are table entries".
    Next, create a context attribute "tableHeaderText" of type "string" and bind the "text" property of the table header Caption UI element to this attribute.
    Whenever the table data has changed (e.g. at the end of the supply function for the table's data source node), update the header text:
    int numRows = wdContext.node<TableDataSourceNode>().size();
    String text = wdComponentAPI.getTextAccessor().getText
      IMessage<ComponentName>.TABLE_HEADER_TEXT,
      new Object[] { String.valueOf(numRows) }
    wdContext.currentContextElement().setTableHeaderText(text);
    Maybe you want to provide a separate message for the case that there are no entries.
    Alternatively, you can make the attribute calculated and return the header text in the attribute getter.
    Armin

  • Right click on Table header

    Hi,
    Is there any way to capture the right click on the table header of JTable? Can anyone tell me the way to do this.
    Thanks and Regards,
    R.Vishnu Varadhan.

    Thanks for the help.
    Its working.
    Regards,
    R.Vishnu Varadhan.

  • How to hide the table header if no data present

    Hi
    I need to hide the table header if no data present. Table has 5 column. if no any clolumn has data then this table section should not be display.
    i am using <?if:count(Installation_Event_S19)= 0?> but this is not work for me.
    Could you please help me out.
    Thanks
    Indrajeet Kumar

    Hi Priya,
    Thank you very much !!! its work fine.
    Thanks
    Indrajeet Kumar

  • Sorting the report by clicking the column header

    Hello,
    Currently working on a requirement where i need to sort the report by clicking the column header. Can anyone please help me on this.
    Suppose i have 3 colums deptno,dname,sal fields in my report. if i click deptno column header,  report has to sort by deptno.Like that i need for other columns also.
    Any help is really appreciated
    Thanks
    Ram

    Hello,
    You can sort the fields using method suggested by Cauvery. However if you would like to have Ascending/ Descending sort order control at column header, then would require to implement few additional steps.
    First do the sorting of field using the way suggested by Cauvery. Once sorting is done, right  click on the column name and  select the option ' Bind Sort Control'. You will see the sorted field in the window. select the field and click ok.
    Now you would get 2 arrows on column. If you click upper arrow, fields would be sorted in Ascending Order and if you click on down arrow, it would  be in Descending order.
    Regards,
    Chinmay Athavale

  • Preserve the table header while scrolling table

    Hi,
    How do I preserve the table header (giving details of what column contains what data)-- I mean:   |
                            v
    Name      I-number       department
    to stay on the screen, and have only my table as scrollable?
    currently my table contains a lot of data and the second page on scroll comes with the problem of what each column on each row of data means.
    Thanks,
    Adi

    Hello Thomas,
    I am facing the same problem.To resolve this I made two containers one is transparent type for header column and another scroll container to display table contents.These two containers are inside the root container with the flow layout .
    But the prob is the table that is inside scroll cotainer is displaying in the next row instead of the new row.
    Is there any solution of this.
    Best Regards,
    Shikha

  • Fixing the Table Header in the default JSF Table

    I am using the default JSF Table in Sun JS Creator (Version JSC 2 EA 2) with a
    Scroll Bar Option (instead of Pagination Control). However I have not
    been able to fix the table header and scroll only the data rows in the
    table.
    I have tried to use CSS style for table header, but it has not worked
    either. Where do I set the CSS style - in JSCreator JSF Datatable or
    JSCreator Table component, neither seems to work for me?
    Is there any other way to fix the table header default JSF Table in Sun
    JS Creator?
    Using the scroll bar is critical user requirement for me and fixing the
    table header will ensure that I can use the default JSF Table in Sun JS
    Creator, alternatively we will have to use some other JSF table e.g.
    from myFaces or an HTML Table and lose on the productivity benefit of
    JSCreator.

    Hi,
    There please just replace the If with IIF mentioned in Visakh Post. There is spell mistake
    It should be
    =IIF(CountRows("Dataset") > 0, True,False)
    Regards, PS

  • Changing the table header's cursor on roll over

    Hi,
    I would like to change the cursor when the user rolls the mouse pointer over the table header.
    I have tried with header.setCursor(new Cursor(Cursor.HAND_CURSOR)); but it didn't work out.
    Thanks.

    Hi, problem is causing this method in BasicTableHeaderUI:
    public void mouseMoved(MouseEvent e) {
    &nbsp&nbspif (canResize(getResizingColumn(e.getPoint()))) {
    &nbsp&nbsp&nbsp&nbspsetCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
    &nbsp&nbsp} else {
    &nbsp&nbsp&nbsp&nbspsetCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    &nbsp&nbsp}

  • How to set a Excel-like column-Filtering in the Table Header using swings

    I am currently working on the Database applications.Where i need to do column filter in the header field of the jTable, (i.e i need to keep a button in the Column header and when i click the button, it should pop-up a jList which has a unique values of the entire column. when i select that value it will show corresponding rows in the jTable). Can anyone pls help me....
    Thanks
    Karthik

    You can [get the table column header|http://java.sun.com/javase/6/docs/api/javax/swing/JTable.html#getTableHeader()] and add a mouse listener to it which waits for a popup menu trigger to display a popup menu.
    In that popup menu, you can display a list which contains the unique values of the column which was clicked on. Once a value is
    selected, you can filter the rows using that value.

  • Has anyone tried changing the color of the table header in Dynamic Pages?

    When you generate the sample Dynamic Page you get a table header with the color of #C0C0A0.
    Has anyone ever found where this value is coming from within the database ?
    I'd like to change it so I can control the background color in the TH tag for Dynamic Pages.
    TIA
    Mark.

    You probabli dispay the data as
    <oracle> select empno,empname from scott.emp</oracle>
    However, you could do it like this:
    <oracle>
    being
    htp.p('<table>');
    htp.p('<tr>');
    htp.p('<td bgcolor=#ffaabb>empno</td>');
    htp.p('<td bgcolor=#ffaabb>empname</td>');
    htp.p('</tr>');
    for c in (select empno,empname from scott.emp) loop
    htp.p('<tr>');
    htp.p('<td>');
    htp.p(c.empno);
    htp.p('</td>');
    htp.p('<td>');
    htp.p(c.empname);
    htp.p('</td>');
    htp.p('</tr>');
    end loop;
    htp.p('</table>');
    end;
    </oracle>
    htp is package in sys schema in oracle.

  • How To apply bold property to the table header

    Hi All,
    Please advice me that how to apply bold property and backgroud color to the table column header.?
    Any help is greatly appreciated.
    Thanks in advance.
    Sathya Rani M

    You can loop through the rows and apply the "fillColor" property for rows. Loop length is the "headerRowCount" of the table.
    In the same loop you could also loop (a loop within a loop) through all cells of a row and set its "texts" obejct, which is an array, to the text style you wish. Or you could apply a paragraph style or a character style, that is pre-defined.
    Uwe

  • ***How to Invoke backing bean method by DOUBLE-CLICK the table ROW!!***

    Hi,
    How can I collect the selected row value & navigate to next page by DOUBLE-CLICK the result table row.
    My application got searchResult page where I am displaying the list of user in result table. Then selecting any one row and navigating to master details page by clicking the continue button. Button Action method will collect the selected row userID which I am forwarding to the masterDetails page.
    Same functionality I want to do by double click the row instead of clicking the button!!. I want to trigger the backing bean method if the user double click the row basically. Please help me in this how to do this?
    Current button action method:
    *public String userSelected() {*
    FacesCtrlHierNodeBinding binding = (FacesCtrlHierNodeBinding) searchResultTable.getSelectedRowData();
    currentRow = binding.getRow();
    selectedNetID = (String) currentRow.getAttribute("netid");
    System.out.println("selectedNetID -->"+selectedNetID);
    requestContext.getPageFlowScope().put("netid",selectedNetID);
    return "continue";
    *}*

    Puthanampatti ,
    Yes, I am using the same. Below is my code. I am trying to get the object of the MAIN jspx page region (where I am displaying the fragments) and refresh the one. But cant able to get the object for the region it is returning null. without refresh seems the navigation wont work.
    public void doDbClick(ClientEvent clientEvent) {
    FacesCtrlHierNodeBinding binding = (FacesCtrlHierNodeBinding) searchResultTable.getSelectedRowData();
    currentRow = binding.getRow();
    selectedNetID = (String) currentRow.getAttribute("netid");
    System.out.println("selectedNetID -->"+selectedNetID);
    requestContext.getPageFlowScope().put("netid",selectedNetID);
    try{
    FacesContext facesCtx = FacesContext.getCurrentInstance();
    NavigationHandler nh = facesCtx.getApplication().getNavigationHandler();
    nh.handleNavigation(facesCtx, "", "continue");
    System.out.println("region obj -->" +facesCtx.getViewRoot().findComponent("advse1"));
    // Refresh the current region; advse1 is the id of the region component inside jspx page
    AdfFacesContext.getCurrentInstance().addPartialTarget(facesCtx.getViewRoot().findComponent("advse1"));
    catch(Exception e){
    System.out.println("Error is: " +e);
    Is this correct coding to get the region object?? actually the "result table" and "Master details" are 2 different fragments which are linked with task-flow and the task flow is part of main jspx page as a region. I am using that region ID to get the obj, but cant able to get so....!!! any idea

  • How to add One Button to the Table Header.

    Hi,
    I would like to have few Table Header columns as Button and Other Table Header Columns as String. And each Button should have separate action. Please let me know, how can i implement this one.
    Thanks
    Mohan

    do not cross post, this is a bad habit. now do you know about www.google.com. well this is a search engine, learn how to use it before you post. i got this link with this keyword search.
    http://www.exampledepot.com/egs/javax.swing.table/pkg.html
    http://forum.java.sun.com/thread.jspa?threadID=560605&tstart=15
    hope this helps you
    regards
    Aniruddha

Maybe you are looking for

  • 1680x1050 not working with ATI card

    I can't seem to get the 1680x1050 native resolution of my LCD working with my ATI X1650 in Arch "current". I've tried configuring X with both: Xorg -configure and hwd -xa and adding the Modes line to xorg.conf manually and using both the ati and the

  • In-app purchase fail

    As my name suggests I a boom beach fan so I bought a 25$ card and bought the 22.99$ option and was left with 98¢ but I never received the gems or got a bill of purchase and yet it took my money so I went on live chat and told the chat person and he s

  • Range of Airport Extreme between two buildings

    We will soon have a studio in our barn 130 feet from the house wired with cable internet. Will Airport Extreme send the signal that far and work well-no trees, clear line of sight, with basic barn construction and insulation in the studio/apartment w

  • New iPod 80GB not working on older iHome

    I just got a new 80GB iPod and when I went to put it on my iHome the iPod didn't do anything. Didn't try to charge or anything. The iHome works just fine with my old 15GB but not the new one. The iHome is about 2 years old. Do the older iHomes not wo

  • Off-center -- tablet preview

    My tablet view seems off-center http://aa2001.businesscatalyst.com/index.html although the design view is fine I can't find any extra boxes/elements to throw it off.