Tab in JTextArea

hi,
how can i deactivate the Tab in JTextArea.
when i click on Tab in JTextArea i get a real Tab with 8 Chars(i can control the size!)
but i want that Tab goes to the next Object.
thx.

And if you need to set the action yourself, you would use something like this (though you would want it a lot cleaner I would imagine...)
KeyMap km = jTextArea.getKeyMap();
km.removeKeyStrokeBinding(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,0));
km.removeKeyStrokeBinding(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,KeyEvent.CTRL_MASK));
Action tabAction = new Action(jTextArea) {
     private Component currentFocusOwner;
     public Action (Component comp) {
          currentFocusOwner = comp;
     public void actionPerformed(ActionEvent e) {
          currentFocusOwner.transferFocus();
tabAction.putValue(Action.Action_Command_Key, "Tab");
km.setActionForKeyStroke (KeyStroke.getKeyStoke(KeyEvent.VK_TAB,0), tabAction);You will want to look into the API for KeyMaps, Actions, and KeyEvents to put it all together (looking into the JTextArea heirarchy won't hurt either...)

Similar Messages

  • Implement soft tab in JTextArea?

    Hi
    Does anyone know how I can implement soft tab in
    JTextArea?
    Or put it this way, override default tabbing behaviour
    and inserts string " " whenever user press tab.
    Thanks in advance
    Okidoki

    For backspace you can do the same thing, removing only the previous character(s).
    class MyTabKey extends KeyAdapter {
         public void keyPressed(KeyEvent e) {
              int keyCode = e.getKeyCode();
              if (keyCode == KeyEvent.VK_TAB ) {
                   e.consume();
                   JTextArea textArea = (JTextArea)e.getSource();
                   int tabSize = textArea.getTabSize();
                   StringBuffer buffer = new StringBuffer();
                   for ( int i = 0; i < tabSize; i++ )
                   buffer.append(" ");
                   textArea.insert( buffer.toString(), textArea.getCaretPosition() );
              if (keyCode == KeyEvent.VK_BACK_SPACE) {
                   e.consume();
                   JTextArea textArea = (JTextArea)e.getSource();
                   int tabSize = textArea.getTabSize();
                   int end  = textArea.getCaretPosition()-1;
                   int start  = end - tabSize;
                   textArea.replaceRange("",  start, end);
    }Hope this helps,
    Denis

  • Tab to change component focus not "real tab" in jtextarea

    Hi,
    Assume you have four text field in one panel. The first text field get focus. Then you press tab, the focus will change to next text field... and so on..... If you put one text area in that panel..... the story begins....
    When you press tab in text area, it will do "real tab" in that text area....
    How do I disable that? I want it so that when you press tab in text area, it will change the focus to next element not do "real tab"...
    Thank you.

    Feel free to remove parts of the code that you feel
    are not required. The code was only posted as a
    suggestion. If there are some lines of code that you
    don't want then please remove then. You are under no
    obligation to use the code as posted. To make the
    code shorter you could try shortening the method
    names. I used "tabForward" and "tabBackward". You
    could use "f" and 'b" to shorten the names.Hehe, nice to have you back.

  • Switching tab behavior in JTextArea

    I think by default Multiline text areas in windows will tab to the next focusable component by pressing the tab button and will create a tab character within the text area by pressing ctrl-tab. JTextArea has the opposite behavior. Does anyone know how to make JTextArea have the default windows behavior? I've looked all over this site for two days and have tried many of the suggestions and many of my own ideas without being able to get this work. Please help if you can.
    porcaree

    i do have a similar problem.
    can u suggest me u r ideas.
    thanks
    vijay

  • Override "crtl + tab" key behaviour with "tab" key for JtextArea .

    I am trying to override the "crtl + tab" key behaviour for JTextArea with "tab" key plus add my own action. I am doing the following.
    1. Setting Tab as forward traversal key for the JTextArea (the default traversal key from JTexArea is "crtl + Tab").
    2. Supplementing the "crtl + Tab" key behaviour with my custom behaviour.
    For the point 2 above, I need to get hold of the Action represented by the "crtl + Tab" key so that I could use that and then follow with my own custom action. But the problem is that there is no InputMap entry for "crtl + tab". I dont know how the "crtl + tab" key Action is mapped for JTextArea. I used the following code to search the InputMap.
                System.out.println("Searching Input Map");
                for (int i = 0; i < 3; i++) {
                    InputMap iMap = comp.getInputMap(i);
                    if (iMap != null) {
                        KeyStroke [] ks = iMap.allKeys();
                        if (ks  != null) {
                            for (int j = 0;j < ks.length ;j++) {
                                System.out.println("Key Stroke: " + ks[j]);
                System.out.println("Searching Parent Input Map");
                for (int i = 0; i < 3; i++) {
                    InputMap iMap = comp.getInputMap(i).getParent();
                    if (iMap != null) {
                        KeyStroke [] ks = iMap.allKeys();
                        if (ks  != null) {
                            for (int j = 0;j < ks.length ;j++) {
                                System.out.println("Key Stroke: " + ks[j]);
                }In short, I need to get the Action associated with the "crtl + tab" for JTextArea.
    regards,
    nirvan.

    There is no Action for Ctrl+TAB. Its a focus traversal key.

  • JTextArea - invisible characters

    Hi together,
    how can I make invisible characters like "carriage return", "line feed" or "tab" in JTextArea visible?
    Some text editors can enable a feature, like
    tab will be displayed as ->
    carriage return will be displayed as CR
    line feed will be displayed as LF
    A.

    RSyntaxTextArea has a method that toggles visibility of whitespace (spaces and tabs) but not newlines. You can make newlines "visible" by the code suggested above, but note that it inserts a real character at the end of each line. That means that it's really only a good solution for read-only documents.
    The following should work:
    textArea.setWhitespaceVisible(true);
    textArea.setText(textArea.getText().replaceAll("\n", "\u00b6\n"));Note that the code snippet above must be done after the call to textArea.setSyntaxEditingStyle("whatever").

  • Problematic focus traversal (JTextArea)

    I have a data entry dialog with several JTextFields and one JTextArea.
    Focus traversal (with the tab key) works nicely between instances of JTextField, but it is not possible to tab out of the JTextArea to the next JTextField (as a tab is inserted in the text area instead). I've have looked up swing focus traversal in books, but no cigar when it comes to dealing with JTextAreas
    Does anyone know how to fix this? I don't need to enter tabs into the text area.
    thanks,
    Andy

    There is a Swing forum for Swing related questions.
    Have you tried searching the forum?. Using keywords "+jtextarea +tab" would be a good place to start. You'll be amazed how many times this question has been asked/answered before.
         This example shows two different approaches for tabbing out of a JTextArea
    import java.awt.*;
    import java.util.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class TextAreaTab extends JFrame
         public TextAreaTab()
              // Reset the FocusManager
              JTextArea textArea1 = new JTextArea(5, 30);
              textArea1.setText("1\n2\n3\n4\n5\n6\n7\n8\n9");
              JScrollPane scrollPane1 = new JScrollPane( textArea1 );
              getContentPane().add(scrollPane1, BorderLayout.NORTH);
              textArea1.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, null);
              textArea1.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, null);
              scrollPane1.getVerticalScrollBar().setFocusable(false);
              scrollPane1.getHorizontalScrollBar().setFocusable(false);
              //  Replace the Tab Actions
              JTextArea textArea2 = new JTextArea(5, 30);
              textArea2.setText("1\n2\n3\n4\n5\n6\n7\n8\n9");
              getContentPane().add(new JScrollPane(textArea2), BorderLayout.SOUTH);
              InputMap im = textArea2.getInputMap();
              KeyStroke tab = KeyStroke.getKeyStroke("TAB");
              textArea2.getActionMap().put(im.get(tab), new TabAction(true));
              KeyStroke shiftTab = KeyStroke.getKeyStroke("shift TAB");
              im.put(shiftTab, shiftTab);
              textArea2.getActionMap().put(im.get(shiftTab), new TabAction(false));
         class TabAction extends AbstractAction
              private boolean forward;
              public TabAction(boolean forward)
                   this.forward = forward;
              public void actionPerformed(ActionEvent e)
                   if (forward)
                        tabForward();
                   else
                        tabBackward();
              private void tabForward()
                   final KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
                   manager.focusNextComponent();
                   SwingUtilities.invokeLater(new Runnable()
                        public void run()
                             if (manager.getFocusOwner() instanceof JScrollBar)
                                  manager.focusNextComponent();
              private void tabBackward()
                   final KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
                   manager.focusPreviousComponent();
                   SwingUtilities.invokeLater(new Runnable()
                        public void run()
                             if (manager.getFocusOwner() instanceof JScrollBar)
                                  manager.focusPreviousComponent();
         public static void main(String[] args)
              TextAreaTab frame = new TextAreaTab();
              frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
              frame.pack();
              frame.setLocationRelativeTo(null);
              frame.setVisible(true);

  • Can swing handle Tab Character?

    I output a Message Box using swing like this:
    String s = new String("Sun \tMon \tTue \tWed \tThu \tFri \tSat\n");
    JOptionPane.showMessageDialog(null, s, "The Date!", JOptionPane.PLAIN_MESSAGE);But seems like it cannot print the Tab Character.

    JTextAreas can read tab characters, you might try
    JTextArea textArea = new JTextArea("Sun \tMon \tTue \tWed \tThu \tFri \tSat\n");
    JOptionPane.showMessageDialog(null, textArea, "The Date!", JOptionPane.PLAIN_MESSAGE);

  • Replace range still not working!

    I cannot get replaceRange to work properly on a textArea, with words longer or shorter than the word i want to replace it meeses it all up! here is my code:
    EditReplaceMenuItem.addActionListener(new ActionListener() {//action listener for "replace" menu item in edit menu
    public void actionPerformed(ActionEvent e) {
    String replace = JOptionPane.showInputDialog(null, "Replace:");//find word to replace
    String with = JOptionPane.showInputDialog(null, "With:");//get word to replace with
             int index = jtp.getSelectedIndex();//get selected tab index
             JTextArea textArea = textAreas.get(index);//get textarea coreesponding to tab
             String text = textArea.getText();//get text from that textarea
    //replace code
    int startIndex = 0;
    Scanner scan = new Scanner(text);
    while(scan.hasNext())
       String current = scan.next();
       if(current.equals(replace))
          int start = text.indexOf(replace, startIndex);
          int end = start + replace.length();
          textArea.replaceRange(with, start, end);
       startIndex += current.length();
    });     here is a series of scrennshots which may help you see my problem : )
    http://i41.photobucket.com/albums/e254/frahasio/howstrange.jpg
    please help!

    Is there a particular reason why you're not using
    replaceAll(String regex, String replacement)which is defined for Strings?
    #

  • Validation in JTextField

    Hi ,
    I have a JTextField, a JComboBox , a JButton , a JList and a JTable in my Frame. I enter a value in JTextField which has to be validated with a constant. Where do u write the validation ?
    i have written the validation in focus lost of JTextField.
    This causes problem when i click on the jtable or jcombobox. When i click on the combobox after entering a wrong value in the textfield, cursor remains in the jtextfield but i am able selected a value from the jcombobox as well.
    Following is the sample code.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.table.*;
    * Title:
    * Description:
    * Copyright: Copyright (c) 2001
    * Company:
    * @author
    * @version 1.0
    public class EnabledTest extends JFrame implements FocusListener
    JTextField jTextField1 = new JTextField();
    JTextField jTextField2 = new JTextField();
    JComboBox jComboBox1 = new JComboBox();
    JList jList1 = new JList();
    JButton jButton1 = new JButton();
    JTable jTable1 = new JTable();
    public EnabledTest()
    try
    jbInit();
    addListeners();
    catch(Exception e) {
    e.printStackTrace();
    public static void main(String[] args)
    EnabledTest enabledTest1 = new EnabledTest();
    enabledTest1.setVisible(true);
    enabledTest1.setBounds(0,0,400,400);
    public void addListeners()
    jTextField1.addFocusListener(this);
    jTextField2.addFocusListener(this);
    jComboBox1.addFocusListener(this);
    jList1.addFocusListener(this);
    jButton1.addFocusListener(this);
    public void focusGained(FocusEvent e)
    public void focusLost(FocusEvent e)
    if(e.getSource() == jTextField1)
    jTextField1_validationPerformed(e);
    private void jbInit() throws Exception
    jTextField1.setText("jTextField1");
    jTextField1.setBounds(new Rectangle(49, 39, 144, 38));
    this.getContentPane().setLayout(null);
    jTextField2.setBounds(new Rectangle(227, 40, 144, 38));
    jTextField2.setText("jTextField1");
    jComboBox1.setBounds(new Rectangle(52, 115, 141, 34));
    jComboBox1.addItem("one");
    jComboBox1.addItem("two");
    jList1.setBounds(new Rectangle(239, 110, 135, 120));
    jButton1.setText("jButton1");
    jButton1.setBounds(new Rectangle(56, 187, 127, 29));
    jTable1.setBounds(new Rectangle(55, 251, 330, 117));
    jTable1.setModel(new DefaultTableModel(3,3));
    this.getContentPane().add(jTextField1, null);
    this.getContentPane().add(jTextField2, null);
    this.getContentPane().add(jComboBox1, null);
    this.getContentPane().add(jList1, null);
    this.getContentPane().add(jButton1, null);
    this.getContentPane().add(jTable1, null);
    private void jTextField1_validationPerformed(FocusEvent e)
    jTextField1.removeFocusListener(this);
    int intValue = new Integer(jTextField1.getText()).intValue();
    if (intValue > 100)
    JOptionPane.showMessageDialog(this, "Should be < 100");
    jTextField1.requestFocus();
    jTextField1.addFocusListener(this);
    }

    It is fairly easy to validate for a range. I added this kind of validation (attached (*)). At any time you may want to set the validity range of your NumericJTextField. I did it as follows:
    this.numericTextField.setValidityRange(-999, +999);
    I tested and it does work nicely - couldn't fool it.
    (*) Is there any holy way to post files without having to cut and paste them as a whole in this doubly holy tab-eater JTextArea :-(
    package textfieldvalidator;
    * Title: NumericJTextField
    * Description: An example JTextFiled that accepts only digits
    * Copyright: nobody - use it at will
    * Company:
    * @author Antonio Bigazzi - [email protected]
    * @version 1.0 First and last
    import javax.swing.*;
    import javax.swing.text.*;
    import java.awt.*;
    public class ValidatorExample extends JPanel {
    NumericJTextField numericTextField; // accepts only digit
    JTable table;
    public ValidatorExample() {
    this.setLayout(new BorderLayout());
    this.numericTextField = new NumericJTextField("1234X5");
    this.numericTextField.setBackground(Color.black);
    this.numericTextField.setForeground(Color.yellow);
    this.numericTextField.setCaretColor(Color.white);
    this.numericTextField.setFont(new Font("Monospaced", Font.BOLD, 16));
    this.numericTextField.setValidityRange(-999, +999);
    this.table = new JTable(
    new String[][] { {"a1a", "b2b", "c3c"}, {"456", "777", "234"}},
    new String[] {"Col 1", "Col 2", "Col 3"}
    this.add(this.numericTextField, BorderLayout.NORTH);
    this.add(this.table, BorderLayout.CENTER);
    public static void main(String[] args) {
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setContentPane(new ValidatorExample());
    f.setLocation(300, 75);
    f.pack();
    f.setVisible(true);
    // ===================== the meat ============================
    // the specialized JTextField that uses a restrictive doc model
    class NumericJTextField extends JTextField {
    NumericJTextField() {this("", 0);}
    NumericJTextField(String text) {this(text, 0);}
    NumericJTextField(int columns) {this("", columns);}
    NumericJTextField(String text, int columns) {
    super(new NumericDocument(), text, columns);
    public void setValidityRange(int min, int max) {
    ((NumericDocument)this.getDocument()).setValidityRange(min, max);
    // check what may have been there already (via constructor)
    this.setText(this.getText());
    // the restricted doc model - non-numbers make it beep
    class NumericDocument extends PlainDocument {
    protected int minValue = Integer.MIN_VALUE;
    protected int maxValue = Integer.MAX_VALUE;
    public void setValidityRange(int minValue, int maxValue) {
    this.minValue = minValue;
    this.maxValue = maxValue;
    public void insertString(int offset, String text, AttributeSet a)
    throws BadLocationException {
    // digits only please (or bring your own restriction/validation)
    StringBuffer buf = new StringBuffer(text.length());
    for (int i = 0; i < text.length(); i++) {
         if (Character.isDigit(text.charAt(i))) {
         buf.append(text.charAt(i));
         } else {
         java.awt.Toolkit.getDefaultToolkit().beep();
    super.insertString(offset, buf.toString(), a);
    // get the whole "document" back for range validation
    while(true) {
    String num = this.getText(0, this.getLength());
         if (num.length() == 0) break;
         int value = Integer.parseInt(num);
         if (value >= this.minValue && value <= this.maxValue) {
         break;
         } else {
         // beeep and chop (or whatever reaction for out of range)
         java.awt.Toolkit.getDefaultToolkit().beep();
         this.remove(this.getLength() - 1, 1);
    // Note: in insertString, length is 1 when typing, but it can be anything
    // when the text comes from the constructor, when it is pasted, etc.
    }

  • Add new type of component

    I want the user to be able to select which type of component gets added to each new tab in a JTabbedPane
    for example, if the user opted to have a JTextArea in each new Tab
    we could use
    tabbedPane.add("new Tab", new JTextArea());
    //But what if the user doesnt want a JTextArea they actually want a JButton, so this doesnt work
    //or
    JComponent newTabComponent = new JTextArea();
    tabbedPane.add("new Tab",newTabComponent);
    //this doesnt work as all swing components can only be child to one parent, so the op wont be able to add more than one tabany ideas how to implement this feature , thanks in advance
    Calypso

    found out how to do it, heres an example
                JComponent c;
                    try {
                        c = tabbedPane.getNewTabComponent().getClass().newInstance();
                        c.setPreferredSize(tabbedPane.getPreferredSize());
                        tabbedPane.add(c);
                    } catch (InstantiationException ex) {
                        System.err.println("IE "+ex);
                    } catch (IllegalAccessException ex) {
                        System.err.println("IAE "+ex);
                    } catch (NullPointerException ex){
                        System.err.println("NPE "+ex);
                    }  

  • 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();
    }

  • 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());

  • Making the Tab key not work in the JTextArea

    In my view I have a JTextArea along with a bunch of JTextFields and JComboBoxes. The user is usually going to tab out of a field in order to go to the next field. What's happening is when the user tries to tab out of the JTextArea, the cursor just moves by a tab length within the JTextArea instead of going to the next field. And if the JextArea has some text in it and if the user tabs into the JTextArea, the whole text gets selected and on hitting the next tab, it gets wiped out.
    I am trying to make the JTextArea not respond to the tab by writing the following code. Keymap keyMap = JTextComponent.getKeymap(JTextComponent.DEFAULT_KEYMAP);
    KeyStroke tabKey = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0, false);
    keyMap.removeKeyStrokeBinding(tabKey);
    jTextArea1.setKeymap(keyMap);But it's still not working. Can anybody tell what's wrong with that code. Or is there any other way to do it? Any help/hints appreciated.
    Thanks.

    >
    If you're using jdk1.4, those other solutions won't
    work because the focus subsystem has changed radically
    (see
    http://java.sun.com/j2se/1.4/docs/api/java/awt/doc-file
    /FocusSpec.html). The upshot is that you have to
    specifically register the keystrokes that you want to
    use for focus traversal. In your case, you have to
    re-register the Tab and Shift-Tab keys, and
    they don't seem to have provided a simple way to do
    that. Here's what I come up with:Set forwardTraversalKeys = new TreeSet();
    forwardTraversalKeys.add(KeyStroke.getKeyStroke(
    KeyEvent.VK_TAB));
    forwardTraversalKeys.add(KeyStroke.getKeyStroke(
    KeyEvent.VK_TAB, InputEvent.CTRL_MASK));
    textArea.setFocusTraversalKeys(
    KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
    forwardTraversalKeys);
    Set backwardTraversalKeys = new TreeSet();
    backwardTraversalKeys.add(KeyStroke.getKeyStroke(
    KeyEvent.VK_TAB, InputEvent.SHIFT_MASK));
    backwardTraversalKeys.add(KeyStroke.getKeyStroke(
    KeyEvent.VK_TAB, InputEvent.SHIFT_MASK |
    K | InputEvent.CTRL_MASK));
    textArea.setFocusTraversalKeys(
    KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
    backwardTraversalKeys);Or, you can just press CTRL+TAB instead of TAB when
    you get to the JTextArea :).=====================================
    i used the above thing but i am getting exceptions classcast exception n method not found (forwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB));)keystroke.get keyStroke(int)???? where i am going wrong as it will be quite helpful for me am using jdk1.4.1_02
    thnaks

  • Moving the Focus with the TAB key in a JTextArea Component

    Dear Friends,
    I have exhausted all options of moving focus from JTextArea to next component. I have also tried all suggestions available in this forum. But i'm not able to solve my problem. Can any one help me.
    Thanx in advance.

    I had the same problem before. Here is what i did.
    JTextArea txtArea = new JTextArea(2,15);
    Set forwardTraversalKeys = new HashSet();     
    forwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));          
    txtArea.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,forwardTraversalKeys);          
    Set backwardTraversalKeys = new HashSet();          
    backwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK));          
    txtArea.setFocusTraversalKeys( KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, backwardTraversalKeys);
    JScrollPane scrollPane = new JScrollPane(
         txtArea,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    // the scrollbar of the JScrollPane is focusable that's why it requires
    // another TAB key to transfer the focus.
    scrollPane.getVerticalScrollBar().setFocusable(false);

Maybe you are looking for

  • Passing value from JSP to JApplet

    Hello, I am stuck up with a problem, can anyone please tell me how do i pass a value from a JSP page to a JApplet, and the parameter passed through JSP should be displaed in the JTextArea. It would be kindful if any of you could help. Thanks Sanam

  • Merging data from 2 schemas with same object structure into one schema

    Hi I want to merge data from 2 schemas in different environments ( say test1 and test 2) into 1 schema ( say Test_final) for testing. Both these schemas are having same structure, the data can be same or different. What I did is that I took an export

  • Failing Hardware? How can I tell?

    I have a late-2006 C2D 1.83 Macbook, 2Gb RAM, 30 Gb free on the HD. I have about a month of Applecare left. In the last few weeks, I've developed both an audio and video issue that might be connected. Audio- Sometimes when watching something (can be

  • When I click an app update brings up someone elses email address?

    Hi all Need help with changing an email address, I have tried everything. I have an app with an update notification but i cant change the email address....

  • What's the best way to determine which row a user clicked on via a link?

    Hello. Probably simple question, but my googleing is failing me. I have a table, with a column that is a command link. How can I determine which row the user clicked on? I need to take that value, and pass it to a different page to bind it for a diff