How can I move out of a JTextArea/TextArea using the keyboard?

Sandip Chitale

Compile and run this example. Use CTRL-TAB and CTRL-SHIFT-TAB to tab through the JTextArea.


import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class TabOutTextArea {
  public static void main(String[] args) {
    JFrame f = new JFrame("TabOutTextArea Test");

    f.getContentPane().add(new JTextField(), BorderLayout.NORTH);
    f.getContentPane().add(new JScrollPane(new JTextArea()), BorderLayout.CENTER);
    f.getContentPane().add(new JTextField(), BorderLayout.SOUTH);

    f.pack();

    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
          System.exit(0);
        }});
		
    f.setVisible(true);
  }	
}

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact