Sorting JTable using keyboard

Hi all,
Is it possible to sort JTable using keyboard? There is a key to get the focus to a column header by clicking the key F8. I don't find any key to sort the table based on the column which is in focus. Is there any solution for this?
Thanks,
Ganesh

You miss the point of that link, there is no need to write any custom code.
I have already tried to implement Keyboard listener of JTableHeader which must be similar to using Key Bindings.You should NOT use a KeyListener, Swing was designed to use KeyBindings
The problem I am facing is that I am unable to find the column which got the key strokeYou don't have to write any code, the functionality you want is already supported with a Key Binding. Just use the "space" key.
If you don't like the space key, then you can assign the Action to any other KeyStroke. The link shows you how to do that in 3-4 lines of code.

Similar Messages

  • Sorting JTable using TableSorter

    I am using Sun's implementation of TableSorter to sort a JTable. How to modify the TableSorter to implement descending order sorting without holding the shift key. Any sample source is greatly appreciated.
    Thanks
    Anand

    Is it necessary to use TableSorter? If your data model is implemented as a Collection (more specifically, as a List), you could just use Collections.sort() and Collections.reverse(). You can keep a boolean flag to indicate which direction the sorting was done previously - based on the state of that flag, you can decide which direction to sort the next time. Sorry, I don't have a code snippet at the mo.

  • Sorting Columns in JTable Using Different Comparators

    Is there any way to sort each column in a JTable using different comparators?

    you'll have to write your own tableSorter

  • Select non-consecutive files using keyboard

    Hi - I am trying to select several files in Finder using keyboard only. Sort of thing you would do with the CTRL key in Windows. I want to select several songs to open in my iTunes, but not all of them. And the songs are not listed one after another. I don't want to use the mousepad as it tends to open one of the selected file if I press the mousepad a tad too long. I just want to quickly scroll with arrow keys and mark the ones I want to select with another key. How can this not be possible on OS X?

    Thanks, it's just not helpful. Sometimes you happen to accidentally double-click, epsecially when you are selecting a large number of files. The problem here was that I was trying to select songs from my folder to open in iTunes so that I would transfer them to my iPhone afterwards in one go. The moment I would accidentally double-click wth the trackpad, the entire selection that I had made would open in iTunes and start playing, which meant that I would have to switch to iTunes and press pause. I did not want to put the computer on silence because I had some other music playing on YouTube at the same time. Overall, it's a disturbance. If someone at Apple were smarter, they would have allowed for a simle selection of non-consecutive files by keyboard, as Windows does it. Scrolling and selecting with the trackpad is not very convenient in this case, because you have to use the trackpad and the keyboard (CMD) at the same time. In a situation like this, a user should be able to perform this operation with keyboard only, simply because it is more convenient that way. If Windows with its operating system has been allowing to do this for ages, Apple with its ambition to be smarter and easier than PC should have been able to tackle this problem long time ago.

  • Using Keyboard keys in Fields setting in Crystal Report Design ?

    Hi Experts
    I want to know that how can I change text object or a field size or position by keyboard. sometimes it works and sometimes not. What is the setting for using keyboard.
    Thanks
    Regards
    Gorge

    Keyboard keys will only work under certain modes in CR.  You have to check the mode constantly to see in which ways they work.  There are too many conditions may cause them not work.  That list could be too long to find them all.  You would have a good grasp on the rule after you familiar with them.
    Thanks,
    Gordon

  • My keyboard on macbook pro (laptop) is acting weird. One key is not responding at all. Have verified using Keyboard viewer and some other keys are printing the unresponsive character at random.

    my keyboard on macbook pro (laptop) is acting weird. One key is not responding at all. Have verified using Keyboard viewer and some other keys are printing the unresponsive character at random. "z" is the unresponsive character.
    Is it a damaged keyboard ?
    The laptop is just 2 months old, will Apple replace it with a new one if its indeed a damaged keyboard or just repair, I use it for official purposes so being without a laptop is not much of an option.

    No one here works for Apple, so we don't know what Apple might or might not do.  If it's a genuine defect, they will of course repair it under warranty.  It is not their responsibility if it effects your ability to work or not, so that's on you.
    If, however, they determine that the key is problematic as a result of your misuse of the laptop, then everything is on you.  And trust me, if they find a glob of dried up beer or coffee there, they will charge you.
    Your only choice is to take it in for repair.

  • I am Unable to Type or use Keyboard in Firefox 18.0 anywhere including URL bar and Search Bar. how should rectify this?

    I am unable to type anything or use keyboard to type in Firefox. I am using Firefox 18.0 installed on Windows 7.
    I am able to Paste into the URL bar and also the Search bar but absolutely not able to type in it.
    I have already tried the "reset" option but still unable to type.
    Also tried Firefox in safe mode with disabled addons but still unable to type.
    Installed a fresh copy of firefox after uninstalling Firefox and deleting the old folder "Mozilla Firefox" from windows. but still unable to type.
    Please tell me a solution to this.

    I'm not on a laptop so I don't have a FN key. But on my desktop F9 + Windows key appears to have resolved the issue for me. Thanks for the help!

  • Why is it so hard to just use Keyboard controls to navigate Finder?

    In pre OS X days I and my co-workers would use only keyboard shortcuts to navigate file servers faster than the network could even refresh the display just using Command keys and Tab and letters…
    In Finder if I want to move to the shortcuts side-bar (the way you can in an Open dialogue box with Tab) it seems to require cursor action, and since I use a tablet that means moving RH away from keyboard and gripping pen, which we all seem to hold between thumb and palm.
    If I hit Tab with a Finder window active, I get the current directory of files and I can manually move thorugh Cmd-Sft-D for desktop and then drill down etc etc  I also find it can be really hard to make a window or floating pallete the active window, and even when it is, impossible to highlight the correct field/content just using Keyboard shortcuts. I'm finding hard to beleive I not missing something, this being Apples OS and Apple have had unviersal access for a few decades!

    Hmmm, if these are commonly used Folders, try dagging them to the right side of the Dock between Applications & trash.

  • Deleting a row from a JTable using AbstractTableModel

    Hi,
    Can someone please help me on how should i go about deleting a row in a jtable using the AbstractTableModel. Here i know how to delete it by using vector as one of the elements in the table. But i want to know how to delete it using an Object[][] as the row field.
    Thanks for the help

    Hi,
    I'm in desperate position for this please help

  • Page up and down without using keyboard

    can any body tell me, how can I write the code for page up and page down in alv grid report without using keyboard.I have make a report(showing in alv grid formate) and I am using menu printer(se41) and gave P,P+,P-,P-- in function key.
    and call this function in report using pf-status. but i didnot get the result without keyboard.while using keyboard page up and page down it is working fine.

    Hi Rakesh,
                    This is the code for ur problem check it once.We have to use this code according to ur requirement ok..The compulsory condition is data is present in the internal table not in database table.If it is in database table move it to internal table first.And follow the below logic that will work fine 4 ur problem check it once.
    *Local Variables
      DATA: lv_temp  LIKE sy-tabix.
    CASE sy-ucomm.
    *Fetch the FIRST Line from the Internal Table.
        WHEN 'FIRS'.
          READ TABLE gt_data INTO wa INDEX 1.
          lv_temp = sy-tabix.
    *Fetch the NEXT Line from the Internal Table.
        WHEN 'NEXT'.
          lv_temp = lv_temp + 1.
          READ TABLE gt_data INTO wa INDEX lv_temp.
    *Fetch the PREVIOUS Line from the Internal Table.
        WHEN 'PREV'.
          lv_temp = lv_temp - 1.
          READ TABLE gt_data INTO wa INDEX lv_temp.
    *Fetch the LAST Line from the Internal Table.
        WHEN 'LAST'.
          READ TABLE gt_data INTO wa INDEX sy-tfill.
          lv_temp = sy-tfill.
    Award points if helpful.
    Kiran Kumar.G.A
                     Have a Nice Day..

  • How to switch frames using keyboard

    Hi,
    I'm new to Actionscript. Now using Actionscript 3.0
    I have to switch next or previous frame in timeline using
    keyboard. I wrote
    ======================================================================================
    stage.addEventListener(KeyboardEvent.KEY_DOWN, goTimeline);
    function goTimeline(event:KeyboardEvent):void
    nextFrame();
    ======================================================================================
    How can I assign arrow keys to switch frames...
    Regards,
    Shaji T.U

    Here's a simple class that moves a circle with the key
    arrows...
    Take a look at how it works and edit it so it suits your
    needs.
    Good luck.

  • HT1167 removing insert/ overwrite using keyboard?

    How do you removeinsert/ overwrite using keyboard?

    What application are you typing in? Microsoft Word 2004, for example, can switch to insert text mode.
    -Doug

  • How do I highlight and copy material from one document to another by using keyboard commands? The tool bar is not appearing as it typically does.

    How do I copy material from one document to the next by using keyboard commands.  I am copying from Word into and external database and the external system seems to be covering my tool bar from which I would typically click editing shortcut commands.

    Highlight what you want to copy, then command - C. To paste, select where you want it to go, then command - V.

  • Query on sorting  XML using XSLT and getting the same XML as output !

    Hi,
    Looking for one information regarding sorting XML using XSLT , with the sorted XML as output. For eg. my XML is :
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="sort1.xsl"?>
    <levelone>
         <child ID="1" sort="5">
              <name>Paul</name>
         </child>
         <child ID="2" sort="1">
              <name>Adam</name>
         </child>
         <child ID="3" sort="2">
              <name>Will</name>
         </child>
    </levelone>
    and XSL :
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/levelone">
         <xsl:copy>
         <xsl:apply-templates>
              <xsl:sort select="@sort"/>
         </xsl:apply-templates>
              </xsl:copy>
         </xsl:template>
         <xsl:template match="child">
              <xsl:copy-of select="."/>
         </xsl:template>
    </xsl:stylesheet>
    This does the sort based on Name. But I want to get the same xml as output with the name sorted. Eg.
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="sort1.xsl"?>
    <levelone>
         <child ID="2" sort="1">
              <name>Adam</name>
         </child>
         <child ID="1" sort="5">
              <name>Paul</name>
         </child>
         <child ID="3" sort="2">
              <name>Will</name>
         </child>
    </levelone>
    Any pointers will be highly appreciated.
    - Thanks

    Don't you want <xsl:sort select="name"/> rather than <xsl:sort select="@sort"/>?

  • Not able to use keyboard in OK prompt

    Hi Experts,
    how are you doing. i am facing one problem with my machine. i am not able to use keyboard at OK prompt. when i login into the machine with username and passwd i am able to use my keyboard.
    now i just want to install solaris 10 on my machine which is running solars 8 now. when i press stop+A key to boot cdrom my keyboard is stucked up. what could be the problem.
    after some attemps like STOP+D it is asking "select your locale: , but i am not able to enter any thing.
    how do i solve my problem.
    Thanks in Advance.
    Regards,
    pavan

    hi there,
    try to shutdown your machine and re-plugged your keyboard. what happened before was my server is attached to a kvm. after plugging the keyboard directly to the server, it resolved the issue. no harm trying.
    rgds.

Maybe you are looking for

  • Gathering table statistics

    Hi, I am trying to gather statistics on a sample table dept.I created a statstable as follows begin DBMS_STATS.CREATE_STAT_TABLE ( 'scott' ,'dept_stats_tab'); end; But when i open the statstable "Dept_stats_tab" i am not able to understand the meanin

  • Group By reports with Serial Numbers

    hi, i am creating group by reports with serial numbers. i use the following code to generate the serial numbers using a formula column: function SNOFormula return Number is SNO NUMBER(5); begin SNO := :SNO + 1; RETURN(SNO); end; I am able to acheive

  • Planning strategy 50

    Dear all, I am using strategy 50 for my FG. I have created PIR for FG for 300 qty & created saleorder of 320 qty for FG. while doing availability check for sale order it is confirming only 300 qty bcoz PIR exists for only 300 qty. after this i saved

  • Using Built-In Double Buffering

    Im making a game and tryign to reduce the flicker, iv tried many handmand double buffer solutions, but none of them seem to work. I am now trying to use the built in one, but cant figure it out.

  • New to Retek (Technical)

    Hi everyone, I am new to Oracle Retek. I have worked previously on Oracle Apps for 3 years. I notice that technical forums are not available for Retek. Can you please guide me as to how can we go about any customization in Retek? Regards, Pradeep