Tabbing out of a JTextArea

Hi
Having a application with a number of textfields and a textarea, I would like to tab through (using the tab-key of course). The problem occurs in the textarea where the tab-key simply tabs along inside the textarea rather than moving on to the next textfield. How to fix that?
By the way... the "nextFocusableComponent" function seems to be deprecated in "J2SE 1.4.0_01", I understand that the new way to do that kind of navigation in applications is by using the "FocusTraversalPolicy". How does that work?
Regards
/swaq

I figured it out my self... Hope this will help others...
import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import javax.swing.*;
public class AreaTest extends JFrame {
private JTextArea area;
private JTextField field;
private Container contentPane;
public AreaTest() {
setSize(300,300);
contentPane = getContentPane();
area = new JTextArea();
area.setLineWrap(true);
area.getInputMap().put(KeyStroke.getKeyStroke("TAB"), "none");
area.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent event) {
if( event.getKeyCode() == KeyEvent.VK_TAB )
area.transferFocus();
contentPane.add(new JScrollPane(area), BorderLayout.CENTER);
field = new JTextField();
contentPane.add(field, BorderLayout.SOUTH);
class Test {
public static void main(String[] args) {
AreaTest area = new AreaTest();
area.show();
}

Similar Messages

  • How do you tab out of JTextArea?

    When using the tab key to change focus from one
    JComponet to the next, how do you tab out of, and
    into next JComponent when you're in an editable
    JTextArea? Is it possible?

    Move to the bottom of the text in a JTextArea with VK_CONTROL + VK_END.
    Better yet, here is how to find all the input actions that you can trigger when focus is on a JTextArea (or any given JComponent)
    JTextArea text = new JTextArea();
    InputMap im = text.getInputMap();
    KeyStroke[] ks = im.allKeys();
    SortedMap map = new TreeMap();
    for(int i=0; i<ks.length; ++i)
        map.put(im.get(ks), ks[i]);
    for(Iterator i = map.entrySet().iterator(); i.hasNext() ; ) {
    Map.Entry pair = (Map.Entry) i.next();
    System.out.println(pair.getKey() + "\n\t" + pair.getValue());

  • How do I create a new row on tab out of the last column, last row?

    JDev 11.1.2.1.0.
    I've seen a few topics on this but none that I think were really very good solutions.
    Use Case:
    On tab out of the last column in the last row, a new row should be added to the end of the table. Bonus points for setting the focus to the first <af:inputText> of the newly created row.
    Complications:
    1. I'm having a heck of a time trying to find a function that returns the column's displayed index. Sadly, <column binding>.getDisplayIndex() returns -1 unless the user has manually re-ordered the column.
    2. Value Change Listeners only fire if there is a value change. Guess that means I need to do client/server listeners to check each and every <af:inputText> for a tab press?
    3. I'm not even going to get into setting the focus. With all the templates, regions, etc. going on, it's dang near impossible.
    Any ideas on how to attack this one?
    Will

    Hi,
    You will need to use the Run Engine Installation Wizard found on the Tools menu. In addition you need to create a installation set for the operator interface.
    Look at Chapter 16 Distrubuting TestStand ( chapter 17 for version 2).
    Once you have created your installation, install is on your new system.
    The serial number etc is part of the process model. When you run the entry point 'Test UUTs' the PreUUT callback is executed which asks the user for the serial number.
    Hope this helps
    Ray Farmer
    Regards
    Ray Farmer

  • How to populate the data in fields if we tab out at one field

    Hi Gurus,
    I am new to OAF Technology and I've new requirement in custom OAF page.
    We have 12 fields like ID, Fname, Lname, Age, Address, Tphone etc..
    If we enter ID in message text input field box and tab out, then it should populate all the remaining fields data by default.
    Could anyone help me regarding this requirement?
    Thanks in Advance
    Sruthi

    Hi,
    Sruthi wrote:
    I am new to OAF Technology and I've new requirement in custom OAF page.
    We have 12 fields like ID, Fname, Lname, Age, Address, Tphone etc..
    If we enter ID in message text input field box and tab out, then it should populate all the remaining fields data by default.
    Could anyone help me regarding this requirement?---MessageTextInput filed set Action property:FirePartialAction and Event:TextInput
    ---Get the Event in co PFR
    if("TextInput".equals(pageContext.getParameter(EVENT_PARAM)))
    AM.setDafultValue();
    ---Write a method in AM
    public void setDafultValue()
    VOImpl vo=getVO1();
    if(vo!= null)
    vo.getCurrentRow().setAttribute("Number1","DefaultValue1");
    vo.getCurrentRow().setAttribute("Number2","DefaultValue2");
    ---Like this u can set default value when tab out.
    Regards
    Meher Irk

  • A black bar appeared at the bottom of the new window after I drag a tab out.

    this is actually an issue back in the mavericks safari, but the problem was somehow solvable and was not appearing every time.
    after upgrading to Yosemite, this problem appears every time.
    The problem is : when I have several tabs, then I drag a tab out, which you can see the minimized window.
    After you release it, it will become a new window as expected and intended. BUT there will be a black bar underneath.
    In the Youtube website, you can see that the upper part of the site is actually being blocked by the toolbar.
    ( I had waited for several seconds to let the toolbar to get to its original position )
    Clearly the black bar at the bottom caused this problem.
    It's a very annoying issue.
    I am not sure if it's a problem of Yosemite or Safari. But back in to mavericks, the problem also existed.
    Is there anyone out there having the same problem?
    How to Fix it ?
    P.S.1 HOWEVER, if i right-clicked the tab and select "move tab to a new window", the problem DOES NOT exist.
    P.S.2 I am using Mac Book Air(13", Mid 2013),  OS X Yosemite  (10.10.2)

    In the App store window at the top click on Purchases. Your download progress is there. If the progress seems to have stalled, click on the pause button and then restart the download. It should pick up where it left off.
    HTH

  • How to convert the date in the Parameter from to mm/dd/yyyy when you tab out of field

    Hello,
    Can some one help me out in Oracle Reports 3.0 version i am trying to
    set in the parameter form two date fields to mm/dd/yyyy.
    my questions is can we set the both of the date fields to if the user
    enters as 010202 and Tab out of the field it should automatically
    format to 01/02/2002.
    i know we can do this in forms but in the parameter form when you are
    sending as parameter to the report i am unable to do it.
    try to set date as format mask in properties but doesnt help..
    any body have any idea will be appreciated much..
    thanks in advance.

    Hi!
    Try to use dd/mm/rrrr format mask. I use it in my reports and it works fine for me. My user can enter 010101 in a date field and it is properly recognized as 01/01/2001 by reports.
    Hope it helps.

  • Why can I not tab out of table cell after running command from keyboard

    In my Jtable I have context menu with actions that can be performed on the selected cells either using mouse, or the action can be initiated directly from the keyboard using the defined acceleratorkey.
    After the action has completed you can tab out of the selected cells using the Tab key or cursor keys if the action was initiated with the mouse, but not if initiated with the keyboard but Im at a loss as to what causes the difference.
    thanks Paul

    I found this one someWhere, maybe check your code if Cell returns true = isCellEditable(row, column)
    import java.awt.event.*;
    import javax.swing.*;
    public class TableActions extends JFrame {
        private static final long serialVersionUID = 1L;
        public TableActions() {
            JTable table = new JTable(15, 5) {
                private static final long serialVersionUID = 1L;
                @Override
                public boolean isCellEditable(int row, int column) {
                    return column % 2 == 0;
    //              return false;
            table.setPreferredScrollableViewportSize(table.getPreferredSize());
            JScrollPane scrollPane = new JScrollPane(table);
            getContentPane().add(scrollPane);
            InputMap im = table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
            //  Have the enter key work the same as the tab key
            KeyStroke tab = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0);
            KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
            im.put(enter, im.get(tab));
            //  Disable the right arrow key
            KeyStroke right = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0);
            im.put(right, "none");
            //  Override the default tab behaviour
            //  Tab to the next editable cell. When no editable cells goto next cell.
            final Action oldTabAction = table.getActionMap().get(im.get(tab));
            Action tabAction = new AbstractAction() {
                private static final long serialVersionUID = 1L;
                @Override
                public void actionPerformed(ActionEvent e) {
                    oldTabAction.actionPerformed(e);
                    JTable table = (JTable) e.getSource();
                    int rowCount = table.getRowCount();
                    int columnCount = table.getColumnCount();
                    int row = table.getSelectedRow();
                    int column = table.getSelectedColumn();
                    while (!table.isCellEditable(row, column)) {
                        column += 1;
                        if (column == columnCount) {
                            column = 0;
                            row += 1;
                        if (row == rowCount) {
                            row = 0;
                        if (row == table.getSelectedRow()//  Back to where we started, get out.
                                && column == table.getSelectedColumn()) {
                            break;
                    table.changeSelection(row, column, false, false);
            table.getActionMap().put(im.get(tab), tabAction);
        public static void main(String[] args) {
            TableActions frame = new TableActions();
            frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
    }

  • Issue: LOV tabbing out loses focus

    Hi all,
    I've realised that typing some characters in a LOV field and tabbing out results in the following:
    1. The LOV popup window opens, then you select a value and the value is returned to the lov field.
    2. At this moment, the focus is LOST. I would expect the focus to be again at the lov field.
    This doesn't reproduce if you open the LOV with the LOV icon. In this case, the focus returns to the lov field, as expected.
    Is this a bug?
    Does anybody know how to solve it?
    Thanks in advance
    Version
    ADF Business Components 11.1.1.56.60
    Java(TM) Platform 1.6.0_18
    Oracle IDE 11.1.1.3.37.56.60

    Hi a.gruev,
    Thanks for your reply. I did some investigation and found that this has to do with IE8 only:
    Firefox 3.6: you enter some chars, the LOV opens, you select the value and finally, the mouse cursor stays at the end of the lov field value. OK.
    Chrome 7.0: exactly the same, but now the lov field value gets selected and then, the focus remains at the lov field. OK.
    Internet Explorer 8.0: works if I enter part of the value (which launches the LOV); if I enter the exact match, the focus is LOST. KO.
    Unfortunately we can't get rid of IE, so any suggestions for fixing this for IE will be appreciated.
    Barbara
    Edited: Anybody knows whether this is a bug?
    Edited by: Barbara Gelabert on 19-nov-2010 9:09
    Edited by: Barbara Gelabert on 22-nov-2010 6:39

  • Can't drag a tab out

    The demo video and help both state you can drag a tab out of the current window to the desktop to make a new window with that tab. Does not work on my Windows XP system. Work for anyone else?

    Also important to note, if you want to take a separate window and make it a tab in a different window, make sure the "Show Tab Bar" under the View menu is selected, and as with removing a tab, click on it and drag it downward from the tab bar and drag and drop it onto the tab bar of the other Safari window.

  • Tab out event for messageInput Text field

    Hi All,
    Can some of you please help me how to handle validation based on tab out.
    I have a field of messageInput text type in OAF standard page where user can enter a number in decimals like 11.19, 21.23 etcetera. I want to raise a message "Please enter an absolute value" the moment user enters a number with decimals and tab out. which means user will only be allowed to enter absolute values like 1,2,3,4,5..............
    Looking forward to receiving feedback.
    Thanks
    -Sunil

    Hi Sunil ,
    Since its a standard OAF page , you need to handle it through controller extension .
    Here are the steps :
    1 ) Attach PPR programtically ( In processRequest of your controller class )
    2 ) Catch the PPR Event (In processFormRequest of your controller class ) and get the value entered value
    3 ) Check if the value has any decimal point exist ( use String function in java ) and through exception accordingly .
    Code for handling fire action ( In written in your extended controller class )
    Import
    import oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;
    In PR :
    OAMessageTextInputBean stb1=(OAMessageTextInputBean)oawebbean.findIndexedChildRecursive("BeanID"); // replace the exact bean id
    i if (stb1!= null)
    FireAction firePartialAction = new FirePartialAction("pprEvent");
    stb1.setAttributeValue(PRIMARY_CLIENT_ACTION_ATTR, firePartialAction);
    stb1.setFireActionForSubmit("pprEvent",null,null,true);
    In PFR :
    if ("pprEvent".equals(pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM)))
    OAMessageTextInputBean stb1=(OAMessageTextInputBean)oawebbean.findIndexedChildRecursive("BeanID"); // repalce your exact bean id
    String MessageTextValue= stb1.getValue().toString();
    if(MessageTextValue != null)
    String.parseString(MessageTextValue ).contains("."); // Check if this returns true / false
    Throw message here accordingly .
    Let me know if its not clear
    Keerthi

  • JTable - loosing focus without tabbing out

    Hi all,
    I have a JTable and when the user goes to enter some text in a field I would like the value entered to persist to the underlying object as soon as the text is changed. This is without the user tabbing out of the JTable.
    Currently when a value is changed and the user hits a save button the value is not saved as the focus is still in the table, it all works fine as soon as the user enters the new value and tabs out of the table and then selects save,
    Does anyone have any suggestions?
    THanks,

    This can be done via your own TableCellEditor class. Create a TableCellEditor class. Implement KeyListener in this editor to save whenever the data is modified.
    You can set the default editor via setDefaultEditor() on JTable.

  • When tab out of an autoSubmit field I lose focus.

    Hello all!
    I'm using jDev 11.1.2.1.0
    I'm facing the following situation. In the employees VO there is a transient attribute which is actually the salary * commissionPct.
    In the jspx, in order to make things interactive, salary and commisionPct have autoSubmit=true. When I change either of the fields the transient column refreshes accordingly. Up to here everything is fine.
    The problem is that when I make a change to either of these fields and tab out the focus is lost. This is very annoying. It happens only in salary and commissionPct fields.
    Is there any way to avoid this??
    Thanks a lot!
    -apostolos

    Sudipto thanks for the link. Very useful.
    I actually use PPR in the employee Iterator, and this is because there is a master-detail functionality in the page. Suppose I have a case similar to department-employees case.
    If I remove the PPR then the master and detail are not synchronized.
    At the bottom you see the sums filed which is actually the product of salary and commissionPct.
    <af:table value="#{bindings.EmployeesVO1.collectionModel}"
                              var="row" rows="#{bindings.EmployeesVO1.rangeSize}"
                              emptyText="#{bindings.EmployeesVO1.viewable ? 'No data to display.' : 'Access Denied.'}"
                              fetchSize="#{bindings.EmployeesVO1.rangeSize}"
                              rowBandingInterval="0"
                              selectedRowKeys="#{bindings.EmployeesVO1.collectionModel.selectedRow}"
                              selectionListener="#{bindings.EmployeesVO1.collectionModel.makeCurrent}"
                              rowSelection="single" id="t1">
                        <af:column sortProperty="#{bindings.EmployeesVO1.hints.EmployeeId.name}"
                                   sortable="true"
                                   headerText="#{bindings.EmployeesVO1.hints.EmployeeId.label}"
                                   id="c1">
                            <af:inputText value="#{row.bindings.EmployeeId.inputValue}"
                                          label="#{bindings.EmployeesVO1.hints.EmployeeId.label}"
                                          required="#{bindings.EmployeesVO1.hints.EmployeeId.mandatory}"
                                          columns="#{bindings.EmployeesVO1.hints.EmployeeId.displayWidth}"
                                          maximumLength="#{bindings.EmployeesVO1.hints.EmployeeId.precision}"
                                          shortDesc="#{bindings.EmployeesVO1.hints.EmployeeId.tooltip}"
                                          id="it1">
                                <f:validator binding="#{row.bindings.EmployeeId.validator}"/>
                                <af:convertNumber groupingUsed="false"
                                                  pattern="#{bindings.EmployeesVO1.hints.EmployeeId.format}"/>
                            </af:inputText>
                        </af:column>
                        <af:column sortProperty="#{bindings.EmployeesVO1.hints.FirstName.name}"
                                   sortable="true"
                                   headerText="#{bindings.EmployeesVO1.hints.FirstName.label}"
                                   id="c2">
                            <af:inputText value="#{row.bindings.FirstName.inputValue}"
                                          label="#{bindings.EmployeesVO1.hints.FirstName.label}"
                                          required="#{bindings.EmployeesVO1.hints.FirstName.mandatory}"
                                          columns="#{bindings.EmployeesVO1.hints.FirstName.displayWidth}"
                                          maximumLength="#{bindings.EmployeesVO1.hints.FirstName.precision}"
                                          shortDesc="#{bindings.EmployeesVO1.hints.FirstName.tooltip}"
                                          id="it2">
                                <f:validator binding="#{row.bindings.FirstName.validator}"/>
                            </af:inputText>
                        </af:column>
                        <af:column sortProperty="#{bindings.EmployeesVO1.hints.LastName.name}"
                                   sortable="true"
                                   headerText="#{bindings.EmployeesVO1.hints.LastName.label}"
                                   id="c3">
                            <af:inputText value="#{row.bindings.LastName.inputValue}"
                                          label="#{bindings.EmployeesVO1.hints.LastName.label}"
                                          required="#{bindings.EmployeesVO1.hints.LastName.mandatory}"
                                          columns="#{bindings.EmployeesVO1.hints.LastName.displayWidth}"
                                          maximumLength="#{bindings.EmployeesVO1.hints.LastName.precision}"
                                          shortDesc="#{bindings.EmployeesVO1.hints.LastName.tooltip}"
                                          id="it3">
                                <f:validator binding="#{row.bindings.LastName.validator}"/>
                            </af:inputText>
                        </af:column>
                        <af:column sortProperty="#{bindings.EmployeesVO1.hints.Salary.name}"
                                   sortable="true"
                                   headerText="#{bindings.EmployeesVO1.hints.Salary.label}"
                                   id="sal">
                            *<af:inputText value="#{row.bindings.Salary.inputValue}"*
                                          label="#{bindings.EmployeesVO1.hints.Salary.label}"
                                          required="#{bindings.EmployeesVO1.hints.Salary.mandatory}"
                                          columns="#{bindings.EmployeesVO1.hints.Salary.displayWidth}"
                                          maximumLength="#{bindings.EmployeesVO1.hints.Salary.precision}"
                                          shortDesc="#{bindings.EmployeesVO1.hints.Salary.tooltip}"
                                          id="it6" autoSubmit="true">
                                <f:validator binding="#{row.bindings.Salary.validator}"/>
                            </af:inputText>
                        </af:column>
                        <af:column sortProperty="#{bindings.EmployeesVO1.hints.CommissionPct.name}"
                                   sortable="true"
                                   headerText="#{bindings.EmployeesVO1.hints.CommissionPct.label}"
                                   id="comm">
                            *<af:inputText value="#{row.bindings.CommissionPct.inputValue}"*
                                          label="#{bindings.EmployeesVO1.hints.CommissionPct.label}"
                                          required="#{bindings.EmployeesVO1.hints.CommissionPct.mandatory}"
                                          columns="#{bindings.EmployeesVO1.hints.CommissionPct.displayWidth}"
                                          maximumLength="#{bindings.EmployeesVO1.hints.CommissionPct.precision}"
                                          shortDesc="#{bindings.EmployeesVO1.hints.CommissionPct.tooltip}"
                                          id="it7" autoSubmit="true">
                                <f:validator binding="#{row.bindings.CommissionPct.validator}"/>
                            </af:inputText>
                        </af:column>
                        <af:column sortProperty="#{bindings.EmployeesVO1.hints.Sums.name}"
                                   sortable="true"
                                   headerText="#{bindings.EmployeesVO1.hints.Sums.label}"
                                   id="c9">
                            *<af:inputText value="#{row.bindings.Sums.inputValue}"*
                                          *label="#{bindings.EmployeesVO1.hints.Sums.label}"*
                                          *required="#{bindings.EmployeesVO1.hints.Sums.mandatory}"*
                                          *columns="#{bindings.EmployeesVO1.hints.Sums.displayWidth}"*
                                          *maximumLength="#{bindings.EmployeesVO1.hints.Sums.precision}"*
                                          *shortDesc="#{bindings.EmployeesVO1.hints.Sums.tooltip}"*
                                          *id="it8">*
                                *<f:validator binding="#{row.bindings.Sums.validator}"/>*
                            *</af:inputText>*
                        </af:column>
                    </af:table>Edited by: apostolosk on May 2, 2012 3:19 PM

  • Dragging a tab out of its place does not open it in a new window always. Behavior is erratic.

    Dragging a tab out of its place is and dropping it (say) in the middle of the screen is supposed to open the tab in a new Firefox window.
    But this behavior is often erratic and sometimes it simply does nothing, which is frustrating.
    Is there a bug already filed for this issue?

    Did this setting in about:config get changed recently?
    * browser.cache.check_doc_frequency
    These are the possible settings:
    * 0: Check once per browser session
    * 1: Check every time I view the page
    * 2: Never check (always use cached page)
    * 3 (default): Check when the page is out of date (automatically determined)

  • Tab out of quotes, parens, and brackets

    I have developed quite a bit in eclipse, for both java and flex. One of my favorite features in java development is the ability to "tab" out of quotes, and parens. I would like to see this abiltiy in mxml and as files as well. They say the things that make a product the most appealing are the small and simple things, and this is defenently one of those small things that would make flex development a whole lot nicer, especially when you are putting a bunch of attributes in mxml.
    If anyone knows of a way to enable this feature in flash builder, i would love to know how, and if there isn't any way to get this feature going, where could I post this to request it as a feature in the final version of flash builder?

    Yes, I'd like to have this too -- along with the ability to "type through" quotes and parens, i.e. if FB inserts quotes or parens for you (for instance, with MXML attribute code hints), you can still type the quote and it'll skip over the existing one, rather than inserting a second.
    I thought there was a bug for the latter, but now I can't find it. (Jason, have you seen it?)
    And Sean, I saw FB-21819 regarding your idea, thanks for opening that.
    gse

  • URGENT ISSUE Flexfield segment disabling on tab out event

    I have a flexfield on my page.
    i have to set one flexfield segment(A) disabled when we tab out of the other flexfield segment(B) (i.e.wen B loses focus)
    how do we capture such an event and show results thru a controller class?
    Is it a case of partial page rendering..?
    Pls help

    Kindly tell me even if it is technically feasible..??
    Pls respond

Maybe you are looking for

  • HOW do I create a href to an sql statement?

    Answer to query: “You sould create a href to an sql statement ( create new user / passwd : and insert in a table (C_user,C_PASSWD), to have a list of users registred at your application) A htp page can manage this you should create roles that be gr

  • How do I remove cmyk profiles from a pdf. and keep it strictly 2 color process?

    My company is trying to outsource a booklet to an offset printing company. We are strictly digital printing, and I honestly have no experience with offset. In the past I would build the documents with the pantone colors that were needed in whatever s

  • Small issue in sending mail to sap-inbox via classes

    Hi All, I am working in sending SAP mail to sap-inbox via classes.. Which i am able to work out..But got some minor struck off where when i am sending the mail from sap-report it is sucesfully reaching the user .... Issue is In the sap-inbox mail it

  • Af:inputListOfValues - bug?

    Hi, I have created a List of Values in the model layer of my application and have found a few problems with the component af:inputListOfValues. My create Organisation popup contains the following code: <af:popup id="editOrgPopup" contentDelivery="laz

  • Where can we donwload Flash MX 2004 Remoting Components?

    I've searched all around and cannot see where Adobe provides a link to download the old Flash Remoting components. All the pages I could get into are with broken links. Could those links be fixed? Thank you!