Tab not changing focus in a JTextArea

Hi
I am writing a little program that at a certain point uses a JTextArea. What bugs me a lot is that the JTextArea keeps focus when I press the Tab button
I see two solutions to this.
Either I extend JTextArea into MyJTextArea and override the processKeyEvent method and from there address the processKeyEvent method from JTextComponent class
so the processKeyEvent method from JTextArea never gets a chance at catching the tab.
The second solution would be to once again extend the JTextArea class and override the processKeyEvent method, and in the method check whether tab was pressed, and in that case change the focus myself
I don't know if the first is possible, but the second should work. I'm actually rather curious about the first one. So if anyone can help me out in either addressing the super-superclass of MyJTextArea or in changing the focus manually without creating too much of a fuss, I'd be very, very thankfull
Thx in advance!
Pieter

the previous post it's rigth, you can leave the JTextArea using ctrl+tab, but if you really need pass the focus out of the JTextArea with only press tab you can do something like this     myTextArea.setDocument(new PlainDocument() {
          public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
              if (str.equalsIgnoreCase("\t"))
                    FocusManager.getCurrentManager().focusNextComponent(myTextArea);
               else
                    super.insertString(offs, str, a);
     }); hope this helps
lalo s.

Similar Messages

  • Tab not getting focus on left-click after suspend in Windows 7 64-bit.

    When I left-click on a tab in Firefox 4 rc 2 after my pc wakes up from suspend in Windows 7 64-bit the tab is not getting focus. I have to use the hotkeys in order to move to that tab. My mouse works fine in other programs.

    I have an imac
    I have an magic pad (same thing as the touch pad on a macbook really)
    I have an usb mouse I use both in windows and osx
    if your trackpad somehow was registered as actived for some reason it would seem as if it was the mouse
    had some *** situations both in windows and osx when my cat sit on the magicpad

  • When-tab-page-changed not firing

    I have 2 seperate forms opened on a single page. One displays on left side of screen and has tabs. One display on right side. If I am currently on my right side form (no tabs) and click on a tab on the left side form, it seems the 'When-tab-page-changed; trigger is not firing the first time. I have tried this on 6i and 10g webforms. If I try it on client/server 6i it works. Any suggestions?

    I just tried this with 10gR2 in web. My form with the tabs only get focus and does not call when-tab-page-changed when you click on a tab after returning from the other form.
    A 2nd button press does then call the when-tab-page-changed.

  • How can I use the enter key instead of tab to change field focus?

    I am using Acrobat 9 Pro.
    We have a fillable PDF where the users enter numbers into fields.  They want to be able to use the <enter> key on the 10-key pad instead of the <tab> key on the keyboard to move the focus to the next data entry field.
    How can I set my PDF so that it recognizes the <enter> key instead of the <tab> key for changing focus?
    Thanks!

    You can use a custom Keystroke script, something like:
    // Custom Keystroke script for text field
    if (event.willCommit && event.commitKey === 2) {
        getField("Text2").setFocus();
    Where "Text2" is the name of the next field. This doesn't disable the Tab key though. For more information, see: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.608.html

  • Tabset in page fragment , the url does not changes when we select tabs...

    Hi
    Thank you for reading my post.
    i noticed that when we use a tabSet in a page fragment , selecting tabs does not change the current URL ,
    is it a correct manner ? I think when we select a tab and it opens another page the url should change.

    HI,
    There is a relevant topic on EA discussion.
    Topic :TabSet in page fragment , selecting a tab open a page but does not change the current browset url
    https://feedbackprograms.sun.com/project/forum/thread.html?cap={3F4DA363-16D3-4D4C-920C-992ECB054B6D}&forid={CC6B8562-F896-4A44-ACB6-4684BDD05E19}&topid={361DBDF0-FFDE-4618-9FC6-86E4903A9565}
    Hope this helps.
    Please post messages related to Creator 2 EA at the feedbacks programs portal. The URL is:
    https://feedbackprograms.sun.com/login.html
    Thanks,
    RK.

  • In the advanced tab of languages and Region the time and date formats will not change

    For a certian Application I am using I need to change the format of the Time and Date. I had no problems in Mountain Lion. In the advanced tab of languages and Region the time and date formats will not change. I need the date format to read as 01/01/14 and time format to read 13:00. As I said this was easily done in Mountain Lion and all previous Apple OS. I suspect it's an issue with in the OS.

    You're right, it has been that way for a long time. I've never bothered reporting it as a bug since it's simple enough to deal with, but reporting it would be a reasonable thing to do.

  • Firefox is set to NOT change to a newly opened tab yet it is doing so anyway

    Firefox is set in Options to NOT change to the newly opened tab. However, when I open a new tab or open a new window which opens as a tab instead it is automatically switching me to that newly opened tab.
    I am using the latest version of Firefox after having had to install a new motherboard on my system and reinstalling all my programs

    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]

  • Setting focus to a JTextArea using tab

    Hi,
    I have a JPanel with a lot of controls on it. When I press tab I want to
    move focus to the next focusable component. This works fine for
    JTextFields, but when the next component is a JTextArea in a
    JScrollPane then I have to press tab 3 times to set the focus to the
    JTextArea. After pressing the tab key once I think the focus is set to
    the scrollBars of the JTextArea because when I press the up and down
    arrows the textarea is scrolled.
    How can I stop the JScrollPane from getting the focus?
    I have tried to set focusable to false on the scrollPane:
    scrollPanel.setFocusable(false);
    and the scrollBars of the scrollPane:
    scrollPanel.getHorizontalScrollBar().setFocusable(false);
    scrollPanel.getVerticalScrollBar().setFocusable(false);
    But it dosen�t work. Is this a completely wrong way of doing it?
    Please help!
    I use jdk 1.4.1
    :-)Lisa

    Not sure what your problem is. The default behaviour is for focus to go directly to the JTextArea.
    import java.awt.*;
    import javax.swing.*;
    public class Test1 extends JFrame
         public Test1()
              getContentPane().add( new JTextField("focus is here"), BorderLayout.NORTH );
              getContentPane().add( new JButton("Button1") );
              getContentPane().add( new JScrollPane( new JTextArea(5, 30) ), BorderLayout.SOUTH );
         public static void main(String[] args)
              Test1 frame = new Test1();
              frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
              frame.pack();
              frame.setVisible(true);
    }

  • Cmd + tab to change windows and not application

    You might clearly see the former Windows and Unix user in me but using cmd+Tab to switch files (not only application) is a really powerful tool. Expose is not close to be as useful. In fact I can't see what good it might be to switch from an application to another.
    Any suggestions on how to have cmd + tab change windows?
    I think I saw Adobe Photoshop behave that way.
    Thanks

    Hitting ctrl-fn-f4 works well (thanks) but the order of the files does not change depending on usage. something the current cmd-tab does.
    Quickly swapping is enjoyable when you can swap back and forth between 2 files.
    Also, ctrl-fn-f4 does not work well with Words.
    While scrolling, the flow of files stopped after le last Word window.
    Pressing ctr-fn-f4 again makes nothing anymore and then it does. I'm don't see the logic of the command.
    As for cmd-~ (Kappy), it doesn't appear to do anything. It might be because I have a French keyboard (~ is alt-ç).

  • Tab pages not changed when selecting from TAB LIST

    Hi All,
    I have a form which has 15 tabs, 1st 10 Tabs are dynamic (enabled at new form instance, depending on configuration) and 11 to 15 are Static tabs visible for all.
    My problem is when i am clicking on tabs iam able to switch tabs, but when I select tab from Tab List I am not going to the selected TAB.
    Ex: when I am in TAB 1 and Select TAB15 from Tab list My form Still Stays in TAB1 and not moving to TAB 15
    Please provide me a Solution.
    My code in WHEN TAB PAGE CHANGED is
    DECLARE
    l_curr_rec NUMBER;
         BEGIN
              l_curr_rec := :SYSTEM.CURSOR_RECORD;
              --Get the Top Default Tab Page for the Form
              SHOW_VIEW('HDR_CANVAS_FIXED');
              :global.headers:=GET_CANVAS_PROPERTY('TAB_CANVAS', topmost_tab_page);
         IF(:GLOBAL.HEADERS='AS_REC_IMAGE')THEN      
    SHOW_VIEW('AS_REC_IMAGE');
    SET_VIEW_PROPERTY('AS_REC_IMAGE',VISIBLE,PROPERTY_TRUE);
    SET_TAB_PAGE_PROPERTY('AS_REC_IMAGE',ENABLED,PROPERTY_TRUE);
              GO_BLOCK('AS_REC');
                   --Hide the other canvases except the Pricing Canvas                     
         ELSIF(:GLOBAL.HEADERS='TRIM_REC_IMAGE')THEN      
    SHOW_VIEW('TRIM_REC_IMAGE');
    SET_VIEW_PROPERTY('TRIM_REC_IMAGE',VISIBLE,PROPERTY_TRUE);
    SET_TAB_PAGE_PROPERTY('TRIM_REC_IMAGE',ENABLED,PROPERTY_TRUE);
              GO_BLOCK('TRIM_REC');
                   --Hide the other canvases except the Pricing Canvas                     
         ELSIF(:GLOBAL.HEADERS='AS_SHIP_IMAGE')THEN      
    SHOW_VIEW('AS_SHIP_IMAGE');
    SET_VIEW_PROPERTY('AS_SHIP_IMAGE',VISIBLE,PROPERTY_TRUE);
    SET_TAB_PAGE_PROPERTY('AS_SHIP_IMAGE',ENABLED,PROPERTY_TRUE);
              GO_BLOCK('AS_SHIP');
                   --Hide the other canvases except the Pricing Canvas                     
         ELSIF(:GLOBAL.HEADERS='TRIM_SHIP_IMAGE')THEN      
    SHOW_VIEW('TRIM_SHIP_IMAGE');
    SET_VIEW_PROPERTY('TRIM_SHIP_IMAGE',VISIBLE,PROPERTY_TRUE);
    SET_TAB_PAGE_PROPERTY('TRIM_SHIP_IMAGE',ENABLED,PROPERTY_TRUE);
              GO_BLOCK('TRIM_SHIP');
                   --Hide the other canvases except the Pricing Canvas                     
         ELSIF(:GLOBAL.HEADERS='EXTRA')THEN      
                   ---Show the Export Canvas---------     
    SHOW_VIEW('EXTRA');
    SET_VIEW_PROPERTY('EXTRA',VISIBLE,PROPERTY_TRUE);
    SET_TAB_PAGE_PROPERTY('EXTRA',ENABLED,PROPERTY_TRUE);
              GO_BLOCK('EXTRA');
                   --Hide the other canvases except the Pricing Canvas                     
         ELSE -- DYNAMIC TABS
    --Hide all the other  static canvases
    IF (:GLOBAL.HEADERS='CT01')THEN
         GO_BLOCK('CT01');
    ELSIF (:GLOBAL.HEADERS='CT02')THEN
         GO_BLOCK('CT02');
    ELSIF (:GLOBAL.HEADERS='CT03')THEN
         GO_BLOCK('CT03');
    ELSIF (:GLOBAL.HEADERS='CT04')THEN
         GO_BLOCK('CT04');
    ELSIF (:GLOBAL.HEADERS='CT05')THEN
         GO_BLOCK('CT05');
    ELSIF (:GLOBAL.HEADERS='CT06')THEN
         GO_BLOCK('CT06');
    ELSIF (:GLOBAL.HEADERS='CT07')THEN
         GO_BLOCK('CT07');
    ELSIF (:GLOBAL.HEADERS='CT08')THEN
         GO_BLOCK('CT08');
    ELSIF (:GLOBAL.HEADERS='CT09')THEN
         GO_BLOCK('CT09');
    ELSE --ELSIF (:GLOBAL.HEADERS='CT10')THEN
         GO_BLOCK('CT10');
    END IF;
              END IF;
         END;
    Thanks,
    Durga Srinivas.
    Edited by: DurgaSrinivas_886836 on Dec 3, 2012 8:12 PM

    In your trigger, you are doing a SHOW_VIEW ('HDR_CANVAS_FIXED'); before you select the :GLOBAL.HEADERS information. I'm not sure what HDR_CANVAS_FIXED is, but I am wondering if that is what is messing you up. What happens if you either comment that out:
    DECLARE
      l_curr_rec     NUMBER;
    BEGIN
      l_curr_rec := :SYSTEM.CURSOR_RECORD;
      --Get the Top Default Tab Page for the Form
      --SHOW_VIEW ('HDR_CANVAS_FIXED'); /* <-------------------------------------------------------Comment it out */
      :global.headers := GET_CANVAS_PROPERTY ('TAB_CANVAS', topmost_tab_page);
      IF (:GLOBAL.HEADERS = 'AS_REC_IMAGE') THEN
        SHOW_VIEW ('AS_REC_IMAGE');
        .or if it is necessary move it to after the :GLOBAL.HEADERS:
    DECLARE
      l_curr_rec     NUMBER;
    BEGIN
      l_curr_rec := :SYSTEM.CURSOR_RECORD;
      --Get the Top Default Tab Page for the Form
      :global.headers := GET_CANVAS_PROPERTY ('TAB_CANVAS', topmost_tab_page);
      SHOW_VIEW ('HDR_CANVAS_FIXED'); /* <------------------------------------ Swap it with :global.headers */
      IF (:GLOBAL.HEADERS = 'AS_REC_IMAGE') THEN
        SHOW_VIEW ('AS_REC_IMAGE');
        SET_VIEW_PROPERTY ('AS_REC_IMAGE', VISIBLE, PROPERTY_TRUE);
        SET_TAB_PAGE_PROPERTY ('AS_REC_IMAGE', ENABLED, PROPERTY_TRUE);
        GO_BLOCK ('AS_REC');
      --Hide the other canvases except the Pricing Canvas
      ELSIF (:GLOBAL.HEADERS = 'TRIM_REC_IMAGE') THEN
        SHOW_VIEW ('TRIM_REC_IMAGE');
        .

  • Links are set to open in new tab, not current tab. However since update to FF 14, they open in current tab. How can I change this back?

    I would like links I click on to open in a new tab, not the current tab. In the Tools>Options, I have it set to do this. However, since the update to 14.0.1, I can't get it to open in a new tab. This is for all web sites and email.
    What can I do to change it?
    Thanks.

    Thank you John99. I used a combination of your suggestions above. The "Reset Firefox" worked the best, after I did a System Restore!
    Thanks for your help.

  • The bookmark tab went from the right side to the left side. I did not change that. what cause the change from the right side to the left side?

    The bookmark tab went from the right side to the left side. I did not change that. what cause the change from the right side to the left side? Also the the Mozilla Firefox tab on the upper left hand corner changed.
    Its was a red colored tab and now its blue in color. I did not change any thing!

    Hey jimmiet,
    There were some recent ui changes around the downloads manager. What version where you on before? Anyway, you can customize things in Firefox really easily. Take a look at [[Customize Firefox controls, buttons and toolbars|this article on customizing Firefox]] for details. Should be a piece of cake to move the bookmarks button.
    As for the color of the button, you might be in [[Private Browsing - Browse the web without saving information about the sites you visit|Private Browsing]] mode. That changes the color of the button from orange to a purplish color.
    Matt

  • Color not changing on Selected Menu tab

    I'm creating a custom css and in doing so have been trying to change the text color of the selected menu tab. I've added it to my stylesheet but it is not changing upon running it. If I change the menu tab specifically via the properties of the tab, it will change. Is 'color' something we can change?
    Here is a snipet of my css:
    .af|menuTabs::selected {color:red;
    white-space:nowrap;
    font-family:Arial,Helvetica,Geneva,sans-serif;
    font-size:200%;
    background-color:white;
    font-weight:bold;
    text-decoration:none;
    Thanks,
    Lisa

A: Color not changing on Selected Menu tab

Your '.' before af|menuTabs is wrong.
It's just "af|menuTabs::selected" not ".af|menuTabs::selected".
Also, you need to use the ::selected-link pseudo-element to style the color of the text.
/* Make the selected tab bold */
af|menuTabs::selected-link
font-weight: bold;
font-size: 14pt;
color: green;
}

Your '.' before af|menuTabs is wrong.
It's just "af|menuTabs::selected" not ".af|menuTabs::selected".
Also, you need to use the ::selected-link pseudo-element to style the color of the text.
/* Make the selected tab bold */
af|menuTabs::selected-link
font-weight: bold;
font-size: 14pt;
color: green;
}

  • HT1657 My movies on Apple TV have started taking around an hour to download and I've not changed anything for this to happen. I've been told to go to Settings on iTunes, to reduce the resolution but there isn't a settings tab. Can anyone help?

    My movies on Apple TV have started taking around an hour to download and I've not changed anything for this to happen. I've been told to go to Settings on iTunes, to reduce the resolution but there isn't a settings tab. Can anyone help?

    On the main menu, isn't there a settings icon next to the green one that says "Computer" ?

  • How do I check internet usage history? When i use the "History" tab on the tool bar all I see is today's activity & the calendar does not change when I click on it. Thanks

    How do I check internet usage history? When i use the "History" tab on the tool bar all I see is today's activity & the calendar does not change when I click on it. Thanks

    zedzed,
    Here's another thought.
    Navigate to HD > Users > Library > Safari: Make a duplicate of History.plist.
    To duplicate the file, click once to highlight it. Press the Command + D keys.
    Drag the History,plist copy file to the Desktop.
    Highlight it. Press the Command + I keys, to get info.
    Change Open With to TextEdit.
    When you open the file in TextEdit, it will be difficult to read, but you will be able to pick out some sites.
    ali b

  • Maybe you are looking for

    • How can I delete an email not in my address book but remembered by Mail?

      If I type the name of a friend eg "Sam" into the address line, I expect it to pull the "Sam" from my address book. But mail remembers emails for "Sam" that I don't want to use, in its history. Can I delete them one by one, or all at once?

    • GL Account - Movement type

      Hi all, Where we maintain GL Account - Movement type? What is TCode? Thanks,

    • Connecting desktop to tv

      How can i connect my hp omni 120 all in one desktop to my hdtv

    • Virtual Rooms and Knowldge Management - Best Options

      Hi experts, One of our partner companies have a requirement for creating different project rooms and sharing documents in these rooms. They have documents with sizes up to 60 MB to share and they need to do the upload/ download through internet. I wo

    • Aperture 2 and iPhoto

      Hello, Does anyone know if when you import iPhoto pictures into Aperture 2, does Aperture copy over the originals into the Aperture Library, or does it just create thumbnails in the Aperture Library. What I am trying to determine is whether or not Ap