Key-changing focus in JLists

Consider the following JList -
String[] testData = {"one", "two", "three", "four", "five"};
JList testList = new JList(testData);When testList has focus, pressing 't' will cause the selection to traverse between items beginning with 't'. This also happens when pressing 'f' or 'o', although the behaviour is somewhat inconsistent in all cases (e.g. it doesn't work all of the time).
How to disable this behaviour? The API documentation makes no mention of it, so I assume that it is specific to PLAFs (I use Metal by default). The only solution I have found to work thus far is to invoke the following after JList initialisation -
EventListener[] listeners = testList.getListeners(java.awt.event.KeyListener.class);
for(int j=0; j<listeners.length; j++) {
  testList.removeKeyListener((java.awt.event.KeyListener) listeners[j]);
}However, this seems like an absurdly heavy weight solution to such a silly problem. Is there a getter/setter I've not seen? I've already tried tinkering with InputMaps and ActionMaps, but they don't seem to have an effect.
Cheers,
Damien.

I tried using the div tag and changing focus to an transparent screen so that it is seamless to the user.
That does not work too. When you change focus by burring and then focus on the transparent screen the cursor acts wierd and remain in wait state all the time.
Any idea what am I doing wrong here?
V I

Similar Messages

  • Shift keys change focus

    I have a MacBook running OSX10.6. Someone else was using it the other day and now whenever I hit my Shift key, it changes the focus to either the task bar or the other open app(s). I have reset the keyboard settings in System Preferences, tried another keyboard and still have the same issue. I created a new user account and the Shift key functions properly in the new profile. Any ideas where else to look to restore the normal behavior?
    Thanks!

    I'm having the exact same problem.
    using a mac mini, OS X 10.7.4 and wireless keyboard.

  • Problem while adding both Key And Focus Listeners to JTextField

    Hi!
    I have something peculiar while adding Key and Focus Listener to JTextField. Suppose i add just Key Listener then everything's fine and i could keep track of keys being pressed. But as soon as i add a Focus Listener to it with the code to select full text in focusGained() method, it starts reponding wrongly to arrow keys pressed and does not perform desired actions. For let arrow key it moves caret by one for the first time after that it does not resond to that unless caret is changed by using mouse. If right arrow key is pressed the it moves the caret to last position from wherever it is. For UP and DOWN it selects the full text(This should be done when it gets focus)
    public void focusGained(FocusEvent fe)
    setCaretPosition(0);
    moveCaretPosition(getDocument().getLength());
    Can someone help me out on this?
    thanks and regards,
    Amit.

    None of those things will cause your JFrame to resize itself. And this is probably a good thing, because your JFrame shouldn't change size once you have created it. Why not create your JPanel so that it has enough space for you to add the component later? Or why not just add the component to start with and then enable it or make it editable when you decide that's necessary?

  • Apple loops not folloiwng key changes

    They follow tempo changes, but not key changes. Using both "green" and "blue" loops from the Loop Browswer, as well some audio takes I recorded and converted to Apple Loops using the Loop Utility. Same result for all.
    Ideas? Thanks.

    thanks.. heres a another question now that i have it making the changes.
    is there a way to select what follows the changes and what doesnt. for example
    I edit my drum tracks in phatmatik and then bring the midi files into logic. I don't want them to change, because the drums sounds would be off and in some case triggering no sounds.
    thanks

  • Hardware key changed and license with error

    I need your help, it was switched card
    my network server and the time to start again
    machine does not take leave SAP. to review
    Because of this, is because the hardware key change, cree
    a new license key with the new hardware, but
    When I load it indicates that you can not validate.
    Someone can help me with this.
    thanks
    Manuel

    Dear Manuel Sandoval,
    Try loading the license from the operation system level using SAPLICENSE command also as said above delete the existing old license and install the new license.
    Regards,
    Sharath

  • RE_RHTRANS0 usage for mass language key changes

    Hello,
    Does anyone know if it is possible to use RE_RHTRANS0 for mass language key changes, i.e. to have it as a background job?
    I tried to execute RHTRANS0 or RHTRANS0_NO_ALV in the background, but the translation record is not getting created. I think because report output requires an additional manual step to select a row and save. Is there a way to skip this step and automatically change language key for all records in the output?
    Thank you.
    Erika

    Hi,
    Could you please tell more about your solution? I understand how is possible "to press" save button in batch input but how you can automatically fill all not-translated fields in target language with texts from source language?
    Thanks
    Ilgvars Lopatko

  • How do I do a key change from one section to another?

    My latest song is in the key of E minor but the prechorus is in C.  When I switch the key for the prechorus it switches it for the entire song.  Is there a way to have the key be specific to a section?

    Lucky you, they just sort of fixed this kinda, if you're willing to do some gymnastics.  By using the new import feature they added the other day, you can export your intro in the key you want, create a second song in the new key, then import your export as a recording (purple clip) which has both the loss and benefit of not being able to adjust to tempo or key changes the way instruments (green clips) and loops (blue clips) can.
    For a better explanation see the help file under:  Build a GarageBand Song / Edit Regions

  • Change Focus to Other Application?

    Hi
    I would like to know if there is some way to change the focus to other applications without using Robot to manually change the focus (like the user would do) or using native methods.
    This is because one of my friends has a problem with a program that keeps taking the focus. An application can then be used to bring the focus back to the program he was currently using.
    It would be nice if there was methods for this in standard Java so we don't have to use native methods, and it would be quite a cumbersome to use Robot)
    (I have searched for it, but the only help I could find so far was about changing focus between components within your own application)

    Yes. That is what I wrote, but isn't there a smart way to do it, like using excisting classes to change focus between applications? - Maybe a class which can also iconify the other applications or such?
    I doubt it exists since it would be hard to make platform independant, but I think it's worth to look for.

  • Changing focus - window issues and .chm

    Two questions:
    1) When choosing any mailto: or website link from a .chm, a
    new window opens, as expected, but the TOC changes to "hidden."
    When click anywhere in the Help window, the TOC shows. Going back
    and forth from the message window/website and the help file, you
    will see the behavior. Our QA flagged this as a potential issue.
    Is this the expected behavior? Or, is there a setting to
    prevent it from hiding? (I would like the Contents, Search, and
    Index tabs to show when the .chm is first opened.) However, I don't
    see the purpose of the Show/Hide being activated when changing
    focus.
    2) After opening a message window or web page from a .chm,
    the Help window remains on top of the message window/web page. The
    message window is indeed active for composing (is in focus), but it
    is often necessary to reposition the help window (which is
    annoyingly still on top of the new window) to be able to
    compose--same with being able to see the full web page.
    Again, is this expected? Is there a setting for having true
    focus -- not always having the .chm stay on top but go behind when
    you change focus to compose a message or view a web page that you
    have initiated from the .chm?
    Thank you very much for any tips you can suggest.
    -- Anne Jackson
    Sr. Technical Writer, SunGard
    Ann Arbor, MI

    Anne,
    There is a setting for a window to be "top-most." I may not
    be able to tell you how to get there in RH as I use an old version.
    In the project settings, window definitions, find
    properties/advanced/extended styles and be sure Top-most window is
    deselected.
    If you can't find it in RH, you can add 2 (hex) to the
    NavPaneStyle parameter in the window definition in your .hhp file
    John

  • How to change focus in programmatic way?

    Hi,
    1. how to change focus in programmatic way?
    2. is there any way to define tab index?
    With Regards,
    Wai Phyo

    1). http://docs.oracle.com/cd/E16162_01/apirefs.1112/e17491/tagdoc/af_scrollComponentIntoViewBehavior.html
    2). no

  • Changing Focus of JTabbedPanes

    Hai Friends,
    I am on the way of developing a QUERY ANALYSER. Mean while i got a problem. in my product I am using two JTabbedPanes(1 & 2).
    In TabbedPane1 i have a text area (to write the query) and the tabbedpane2 on which two panes( one for dispaying the result on a JTable and other for displaying messages.).
    The problem is Ilike to view(change Focus) the message if some error occurs and shift to other pane if some results obtained to JTable.
    i couldn't make it possible..
    some one help me.....
    Tino Simon.

    1) Because you are too impatient. Your question in no
    more important than anybody elses
    2) Because you've already been given the solution.I am extremely SORRY Mr.camickr.
    I was in a hurry to finish my module, which cause some troubles in my codes. The solution you've given really works. The problem was lack of my concentration.
    Any way THANK YOU very much.
    Once more I am begging Pardon.
    Tino Simon.
    .

  • JTextfield:  Changing focus, then doing stuff

    So I have 3 JTextFields that are essentially "connected" (I automate tabbing and such back and forth). I have no problem gaining focus, whether it be transferFocusBackward(), or whatever else. My problem is when getting the focus I cannot do anything with it like taking the letter the user typed and insert it into the next field.
    My code that I used is in KeyTyped and I do a
    JTextField fake = new JTextField();
    fake.transferFocus();
    JTextField newFocus = ((JTextField)KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
    newFocus.setText(String.valueOf(event.getKeyChar))
    When I check to see who the focus is on before and after I call transferFocus(), it doesn't change JTextFields (I know because I name them differently and ask their names). Does someone know a better way...that actually changes focus, when it is called, or have any workarounds?

    Nevermind I figured a workaround for it. I set the setFocusCycleRoot to true in the constructor, and then said
    JTextField fake = new JTextField();
    JTextField newFocus = ((JTextField)this.getFocusTraversalPolicy().getComponentBefore(this, fake));
    //I stuck what the user typed at the beginning of the text field...not really sure which is the better way
    newFocus.setText(event.getKeyChar()+newFocus.getText());
    fake.transferFocus();
    The reason it wasn't working is because swing hadn't actually acknowledged that the focus had changed yet...apparently this happens later.
    The reason I had asked was that there was an edge case on the three JTextField, lets say the user types something into the first text field and moves to the next field, then randomly goes back, well, when they press a letter, then they would just jump to the next JTextField, and the letter wouldn't appear...i think that would be more confusing than having the letter appear in the next text field, but meh, we'll see.

  • Activate (or change focus) on ADF Paneltab using javascript

    Hello,
    I am trying to embed an oracle form inside ADF page. I need to activate or change focus on an adf panel tab when I click on a link. I need to use javascript for this as I cannot afford a trip to the server (and hence a backing bean is not an option), as every time the page refreshes the form loses its session. Is there a way to activate/disclose a paneltab using javascript?
    Regards,
    Anirban

    This problem seems to be resolved. We can use javascript as well as a managed bean to do this. I was missing the setDisclosed(true/false) function. The best part is, even without a partial trigger or a partial submit, we can do this without refreshing the page when using a managed bean.
    When using javascript, we can use the below method:
    function f1(event) {
    var v1 = event.getSource();
    v1.setDisclosed(true);
    }

  • Lock/Key change not permitted( time constraint 1)

    Hello,
    Users are unable to change the Basic for an employee . When they change and try to save they get this error message"
    Lock/Key change not permitted( time constraint 1) ". what could be the reason for this , is this related to any authorization issue ? Please help

    Hi Sagar,
    This is not authroization issue.
    The change you are doing is not in the right time period. Please contact your HCM funtional consultant
    Remember all the changes in HR bounded by time period

  • Karaoke and Key Changer?

    Hello
    Are there any plugins for itunes?
    So that i can change the key/pitch of my music?
    Also I would like to play mp3+g files. So karaoke. Is this also possible?
    Thanks

    The app Karaoke Anywhere is what your after and has an in built key changer. However it is not fully compatible with iTunes 11.

Maybe you are looking for

  • Deploy teststand with labview ui

    Hi, I'm using teststand now since 9 months and now I have to distribute my application to a testing machine. I have some questions about this process. But first I discribe my application: I have a labview ui, which has 3 main tasks: 1.) Start selecte

  • Copy existing structure in the query

    Hello, I have couple of existing structures in the query, my requirement is I need to create a new structure similar to the existing stricture. Is there anyway to copy the existing structure. Please help me. Thanks, John

  • Call Blocking

    Greetings of the day !!! i'm using Blackberry Curve 9360 from last 2 last yrs... & it is perfect partner for me.Now these days i m receiving some unwanted calls & i want to block them. but when i use call blocking option it asks for a enabling passwo

  • Job termination in source system

    Dear All,      I am trying to load payroll data using Datasource ZHR_PY_1 . I am doing init data for the first time using infopackage for this datasource. I have tried to pull a couple of years, 2 months, even 1 day of data, but all give me the same

  • Custom cell in UITableView

    Hello! How create a cell with different(flexible) height, that it depend of the content? TIA