Problem in Adding two buttons under same column header (in JTable)

Hi,
I have a JTable and to a particular column i want to add two buttons.
Here the two buttons should be under the same column header and i need to add listners to these.
Any idea how to do this?
Thanks & regards
Neel

Of course as your header is drawn by a renderer, the buttons don't actually work, but you can listen for mouse clicks within the area of the header and see which button the mouse position was over.
See the Java Table Sorter Demo code for how to add a mouse listener to the header...
http://java.sun.com/docs/books/tutorial/uiswing/components/example-1dot4/index.html#TableSorterDemo
....and from there you should be able to determine where in the component the click occured by using the getX() and getY() methods of the MouseEvent to determine which button in the renderer component was clicked. Use something like Rectangle.contains() to match the click location against the buttons.

Similar Messages

  • How to display 2 lines in the same column header of jTable?

    Please could you help me to display 2 character lines in the same column header of a JTable?
    And how to make a fusion between to cells?
    Thank you very much

    In Swing, most components will accept text in the html format
    http://java.sun.com/docs/books/tutorial/uiswing/components/html.html
    You can then use <br> tags to make your header text multiline

  • I have two iPods under same account information and lost one but when I try and track it only the one that isnt lost shows up, is there somewhere I can go to fix this?

    I have two iPods under same account information and lost one but when I go to track it only the one that isnt lost shows up, is there somewhere I can go to fix this?

    They cannot be tracked unless connected to WiFi.

  • How to insert a button on the column header of a table in webdynpro java

    Hi
    Can anyone tell me how to insert a button on the column header of a table in webdynpro java?
    regards
    sunit

    Hi sunit,
    Instead of adding button in the column header , in the column
    add a fixed top cell.
        right click on the column
        Insert FixedTopCell
        Right click on the fixedTopCell
        insert Editor.
       select button.
    then button will be only in the top most row.
    Hope it will satisfy ur requirement
    Regards
    Smitha

  • Printing problem when adding a button to print the whole page

    Hello,
    I added a button with printing option = Apply to self, Print = page.
    The result is that it prints only the i-view in which the button is located. I want the whole page to be printed. The page is composed of several i-views and I also use layers.
    Has someone an idea ?
    Thanks a lot,
    Thomas

    Hi Thomas,
    I received exact the same problem case during our visual composer developments. On SPS 14 the print functionality worked as expected with the print option u201Cprint pageu201D. After the implementation of SPS 16 we had to use u201Cprint screenu201D.
    Hopes this helps.
    Best regards
    RB

  • Adding two boxes in same branch group

    Hi,
    I am new to Java3D. I want to add two boxes in same branch group at different location so that both of them are visible simultaneously. Can i achieve it?
    Thanks and regards,
    Rahul

    Thanks.
    But Still i have problem. Probably i was not clear earlier. My problem is not just to add these boxes. But in addition i want to same behaviours like Rotation, Zooming, Translation etc on all of these boxes. So that they all can be zoommed, translated, rotated by equal factor simulataneously.
    Please help me.
    Thanks lot
    Regards
    Rahul

  • Display two lines under one column in ALV

    Hello Friends,
    I have a situation... i need to display two or three lines under single column in ALV report.
    example:
    col1               col2           col3                col4
    AAA               10            456.78             TEST PURPOSE HBDFJEHBEJBE EBDF B EFH
                                                                 EDEHFKHEKFHEKJCFEKJFHKEJHFKEHFEFJK
                                                                 DJFHGCGD
    AAA               20            121.78             TEST PURPOSE HBDFJEHBEJBE EBDF B EFH
    BBB               10            11.78               TEST PURPOSE HBDFJEHBEJBE EBDF B EFH EJ
                                                                 EFKBEJF KEFHEKJFHEJ KFEHKE HFKEH
                                                                 MEFBHEJFB EFBEJ EFGJEGF JEGFEGEKJE KEFHK
                                                                 EFKEFEKLKL
    Anyone has idea?
    Thanks in advance
    Regards
    Raghu

    Hi,
      You can do this by doing some additional coding..
    Ex..
    **  Let's assume you are using the internal table t_output for displaying the ALV...
    **  and t_final contains the data..t_text which contains the multiple lines texts...for the
    ** column col4...
         DATA: s_output LIKE LINE OF t_output.
         DATA: v_flag      TYPE xfeld.
         LOOP AT t_final INTO s_final.
    * Clear the work areas.
            CLEAR: v_flag,
                         s_output.
    * Move all the data.
           MOVE ls_final TO s_output.
            LOOP AT t_text WHERE col1 = s_final-col1.
    * First time move all the columns to the output internal table...for the rest of the records
    * just populate the col4..
                IF v_flag IS INITIAL.                     " For the first time.
                   s_output-col4 = t_text-text.         " Move the text.
                   APPEND s_output TO t_output.
                   v_flag = 'X'.
                ELSE.
                   clear s_output.
                   s_output-col4 = t_text-text.         " Move the text.
                   APPEND s_output TO t_output.
                ENDIF.
            ENDLOOP.
    * IF there is no text found just append the output internal table with blank col4.
            IF sy-subrc <> 0.
                   APPEND s_output TO t_output.
            ENDIF.
         ENDLOOP.
    Hope the example is clear...
    Thanks
    Naren

  • Two buttons in same jsp page

    hello to java people
    My ? is, jsp page named as login.jsp, In this page i want to use two buttons.
    If i click on one buton it will goto sucess.jsp and for another button it will go to find.jsp.
    i.e, two actions in same page, is it possible ?
    help me by giving sample code.
    thanks

    thanks balu for ur answer.
    pure java ?
    But my doubt is see we take one form
    <form action="sucess.jsp">
    <input text...>
    <input text...>
    <input type=submit name=sucess>
    <input type=submit name=find>
    </form>
    means whether i take two buttons as submit and names r diff..
    but at top only one action is there .
    how can they know to which page it has to go?
    do u understand my ?
    can u please give some sample code so that i can understand
    thanks

  • I can get the apple logo on the phone but nothing else. Have tried resetting by pressing the two buttons at same time but no response. Any ideas please?

    iphone only displays logo, nothing beyond this. any suggestions please other than two buttons pressed at same time? thanks, stu

    See Here for Device Unresponsive
    http://support.apple.com/kb/ts1445
    The Basic Troubleshooting Steps are:
    Restart..  Reset..  Restore from Backup..  Restore as New...
    Try this First... You will Not Lose Any Data...
    Turn the Phone Off... ( if it isn’t already )
    Press and Hold the Sleep/Wake Button and the Home Button at the Same Time...
    Wait for the Apple logo to Appear and then Disappear...
    Usually takes about 15 - 20 Seconds... (But can take Longer...)
    Release the Buttons...
    Turn the Phone On...
    If that does not help... See Here:
    Backing up, Updating and Restoring
    http://support.apple.com/kb/HT1414

  • I have a white screen on my ipod.  i have tried pushing the two buttons at same time but it doesn't work. i tried restoring on itunes but can't because of the password on ipod

    My ipod 4th gen. has a white screen.  i have tried pushing the two buttons but it didn't work.    I have tried to restore on i tunes but because there is a pass code on the ipot, it won't let me.  Any ideas?

    Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
    If recovery mode does not work try DFU mode.                        
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings        
    For how to restore:
    iTunes: Restoring iOS software

  • Problem gui_download  -Data looks messy without proper column header

    Dear SDNers,
    Scenario:
    Using FM GUI_download to download excel file to Presentation server.
    Excel file downloads perfecly fine on presentation server with proper column headers when the OS is not XP/Vista.
    Issue:
    when i run this program on my system having Windows Vista,Excel downloads but the column header is all jumbled up without proper differetation.
    Kindly let me know what the the issue could be?
    My Effort:
    I did some googling and found that in Function Modules GUI_DOWNLOAD and GUI_UPLOAD.
    The form of the file name depends on the underlying operating system.
    To make your programs portable to different operating systems, we should use the function module FILE_GET_NAME.
    which returns the system-dependent name for an abstract file name.
    Kindly let me know if this is correct.
    Reason am asking is now i dont have access to code and check the same since i dont have authorization.
    Regards,
    SuryaD.
    Edited by: SuryaD on Jan 12, 2010 2:20 PM

    No response.So closing the thread.

  • Problem in updating first column header in JTable

    hi
    I am using JTable in my application. I want to change first column name of JTable every time when a JList is selected. I am using DefaultTableModel for JTable. I added first column in Constructor and another in a method. I have to edit only first column header. How can i do this???
    I used this code but it is not working.
    table.getColumnModel().getColumn(0).setHeaderValue("Name of column");
    table.getTableHeader().resizeAndRepaint();
    Your help will be appreciated.
    Thanks in advance
    Sonal

    table.getColumnModel().getColumn(0).setHeaderValue("Name of column");
    table.getTableHeader().repaint();Works for me so post a SSCCE ( http://www.sscce.org/ ) that shows the problem.

  • How to attach and anchor a Button to a Column Header in a Datagridview

    I am trying to attach buttons to Header Columns within a DataGrid so the buttons will move with the Header Column when the DataGrid resizes.  Columns are set in Properties to Fill.  I am using Visual Studio 2013 - Windows Form Designer. 
    The problem is I'm not sure how to anchor the buttons to the columns so they move with specific columns when the DataGrid is resized. 

    Hi MarcB2015,
    >> The problem is I'm not sure how to anchor the buttons to the columns so they move with specific columns when the DataGrid is resized. 
    To be honesty, I could not understood you clearly. What do you mean by “Columns are set in Properties to Fill”? Which property you set to Fill? Did you set the DataGridView.AutoSizeColumnsMode Property?
    In my option, if you set DataGridView.AutoSizeColumnsMode as “Fill”, and resize the datagridview, the column would be resized too.
    For more information about DataGridView.AutoSizeColumnsMode Property, you could refer the link below:
    https://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.autosizecolumnsmode%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396
    If I misunderstood you, please feel free to let me know.
    Best Regards,
    Edward
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to join 2 rows under single column header

    i want to join 2 or more rows under a single column header. as shown "container details" is the column name with "h", "w", and "s" and the sub column names. so my header should contain all these four names and my 3 rows under h,w and s should be clubed under this container details.
    anyone help me out. thanks in advance.
    container details
    | h | w | s

    Bummer, I just tried the link (which I saved from a couple months ago) and it doesn't work. This was a great site for showing how to do various things in Swing. Sorry for the bad link. Maybe someone saved the sites info or knows where it may have moved. Dang...

  • Problem in displaying Column Heading using JTable

    I am using JTable component in my applet. I am trying to retrieve records from a database and want to display the same in the table using JTable component. In that procees my data is shown in the table but I am not able to display the column heading.
    Please suggest.

    you could user JScrollPane to show the column's head.
    if you don't want to use JScrollPane ,you should use the getTableHeader() method and add the header into the pane

Maybe you are looking for

  • How to test servlet using Junit test????

    Hello everybody Does anybody know how to test an servlet class using Junit without using Cactus test . Is it possible to test a servlet using Junit without cactus test.Plz tell me the process how to test a servlet using Junit test . Regards srikant

  • I am not able to pay for apps on my new i4 ???

    i am not able to pay for the apps on my i4....for example whats app....why is it so?? the same thing is happening in my friend new i4 too....it is ios6.1.3...please help..!!

  • Remove 'name change' feature in AC 10 PSS section

    I have configured AC 10 recently, while checking the password reset feature I found "name change" option in that section. I found it strange, that users can change the name (sap user id) of themselves in SAP backend systems. I think users should only

  • Java.lang.SecurityException: Authentication for user system denied in realm wl_realm Error.

              Getting this security exception when trying to pull a message from one weblogic           instance JMS queue, and sending the message (via a MDB) to another machine's JMS           queue.           Ex. Here's the scenario.           Two Win

  • Need medical dictionary to use within Apple's dictionary.app

    I'm in desparate need of finding a medical dictionary that I can add to the main Library/Dictionaries/ directory, so that it will be seamlessly integrated (that's why I have a Mac, right?) into Apple's Dictionary. But... I've spent too long looking f