Reposting - JTextArea inside Jtable - Tab, Focus issues

Sorry for reposting this again...I didn't format the code in my previous post.
I am facing the following problems with JTextArea inside Jtable Cell
1. blinking cursor not visible on the cell(0,0) first time the UI is shown, although it has the focus
2. blinking cursor not visible on the 5th column (JTextArea) when it receives the focus nor the characters are visible when i start typing. i have to manually double click to force the focus to shift to the cell.
3. focus does not shit out of the 5th column (JTextArea) after pressing the tab key or enter key once. i have to do that twice to force the focus out.
Following is the code which i have implemented. Please let me know what is being missed out to rectify the above problems.
Thanks.
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.DefaultCellEditor;
import javax.swing.InputMap;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
public class test extends JFrame {
     JTable table;
     public test() {
          table = new JTable(15, 5) {
               public boolean isCellEditable(int row, int column) {
                    return column % 2 == 0;
                    // return true;
               public void changeSelection(final int row, final int column,
                         boolean toggle, boolean extend) {
                    super.changeSelection(row, column, toggle, extend);
                    if (editCellAt(row, column)) {
                         getEditorComponent().requestFocusInWindow();
          table.setPreferredScrollableViewportSize(table.getPreferredSize());
          table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
          TextAreaRenderer textAreaRenderer = new TextAreaRenderer();
          TextAreaEditor textEditor = new TextAreaEditor();
          table.getColumnModel().getColumn(4).setCellRenderer(textAreaRenderer);
          table.getColumnModel().getColumn(4).setCellEditor(textEditor);
          JTextField tf = new JTextField();
          tf.setBorder(BorderFactory.createEmptyBorder());
          table.setDefaultEditor(Object.class, new DefaultCellEditor((tf)));
          JScrollPane scrollPane = new JScrollPane(table);
          DefaultCellEditor dce = (DefaultCellEditor) table
                    .getDefaultEditor(Object.class);
          dce.setClickCountToStart(1);
          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() {
               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;
                         // Back to where we started, get out.
                         if (row == table.getSelectedRow()
                                   && column == table.getSelectedColumn()) {
                              break;
                    table.changeSelection(row, column, false, false);
          table.getActionMap().put(im.get(tab), tabAction);
          table.setSurrendersFocusOnKeystroke(true);
     public static void main(String[] args) {
          test frame = new test();
          frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
          frame.pack();
          frame.setLocationRelativeTo(null);
          frame.setVisible(true);
import java.awt.Component;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
public class TextAreaRenderer extends JTextArea implements TableCellRenderer {
     private final DefaultTableCellRenderer adaptee = new DefaultTableCellRenderer();
     /** map from table to map of rows to map of column heights */
     private final Map cellSizes = new HashMap();
     public TextAreaRenderer() {
          setLineWrap(true);
          setWrapStyleWord(true);
     public Component getTableCellRendererComponent(//
               JTable table, Object obj, boolean isSelected, boolean hasFocus,
               int row, int column) {
          // set the colours, etc. using the standard for that platform
          adaptee.getTableCellRendererComponent(table, obj, isSelected, hasFocus,
                    row, column);
          setForeground(adaptee.getForeground());
          setBackground(adaptee.getBackground());
          setBorder(adaptee.getBorder());
          setFont(adaptee.getFont());
          setText(adaptee.getText());
          // This line was very important to get it working with JDK1.4
          TableColumnModel columnModel = table.getColumnModel();
          setSize(columnModel.getColumn(column).getWidth(), 100000);
          int height_wanted = (int) getPreferredSize().getHeight();
          addSize(table, row, column, height_wanted);
          height_wanted = findTotalMaximumRowSize(table, row);
          if (height_wanted != table.getRowHeight(row)) {
               table.setRowHeight(row, height_wanted);
          return this;
     private void addSize(JTable table, int row, int column, int height) {
          Map rows = (Map) cellSizes.get(table);
          if (rows == null) {
               cellSizes.put(table, rows = new HashMap());
          Map rowheights = (Map) rows.get(new Integer(row));
          if (rowheights == null) {
               rows.put(new Integer(row), rowheights = new HashMap());
          rowheights.put(new Integer(column), new Integer(height));
      * Look through all columns and get the renderer. If it is also a
      * TextAreaRenderer, we look at the maximum height in its hash table for
      * this row.
     private int findTotalMaximumRowSize(JTable table, int row) {
          int maximum_height = 0;
          Enumeration columns = table.getColumnModel().getColumns();
          while (columns.hasMoreElements()) {
               TableColumn tc = (TableColumn) columns.nextElement();
               TableCellRenderer cellRenderer = tc.getCellRenderer();
               if (cellRenderer instanceof TextAreaRenderer) {
                    TextAreaRenderer tar = (TextAreaRenderer) cellRenderer;
                    maximum_height = Math.max(maximum_height, tar
                              .findMaximumRowSize(table, row));
          return maximum_height;
     private int findMaximumRowSize(JTable table, int row) {
          Map rows = (Map) cellSizes.get(table);
          if (rows == null)
               return 0;
          Map rowheights = (Map) rows.get(new Integer(row));
          if (rowheights == null)
               return 0;
          int maximum_height = 0;
          for (Iterator it = rowheights.entrySet().iterator(); it.hasNext();) {
               Map.Entry entry = (Map.Entry) it.next();
               int cellHeight = ((Integer) entry.getValue()).intValue();
               maximum_height = Math.max(maximum_height, cellHeight);
          return maximum_height;
import java.awt.KeyboardFocusManager;
import java.awt.event.FocusEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.util.HashSet;
import java.util.Set;
import javax.swing.DefaultCellEditor;
import javax.swing.JComponent;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
public class TextAreaEditor extends DefaultCellEditor {
     public TextAreaEditor() {
          super(new JTextField());
          final JTextArea textArea = new JTextArea();
          textArea.setWrapStyleWord(true);
          textArea.setLineWrap(true);
          JScrollPane scrollPane = new JScrollPane(textArea);
          scrollPane.setBorder(null);
          Set forwardTraversalKeys = new HashSet();
          forwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));
          textArea.setFocusTraversalKeys(
                    KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
                    forwardTraversalKeys);
          Set backwardTraversalKeys = new HashSet();
          backwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,
                    InputEvent.SHIFT_MASK));
          textArea.setFocusTraversalKeys(
                    KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
                    backwardTraversalKeys);
          scrollPane.getVerticalScrollBar().setFocusable(false);
          scrollPane.getVerticalScrollBar().setFocusable(false);
          editorComponent = scrollPane;
          delegate = new DefaultCellEditor.EditorDelegate() {
               public void setValue(Object value) {
                    textArea.setText((value != null) ? value.toString() : "");
               public Object getCellEditorValue() {
                    return textArea.getText();
     public void lostFocus() {
          stopCellEditing();
}

Sorry for reposting this again...I didn't format the code in my previous post.
I am facing the following problems with JTextArea inside Jtable Cell
1. blinking cursor not visible on the cell(0,0) first time the UI is shown, although it has the focus
2. blinking cursor not visible on the 5th column (JTextArea) when it receives the focus nor the characters are visible when i start typing. i have to manually double click to force the focus to shift to the cell.
3. focus does not shit out of the 5th column (JTextArea) after pressing the tab key or enter key once. i have to do that twice to force the focus out.
Following is the code which i have implemented. Please let me know what is being missed out to rectify the above problems.
Thanks.
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.DefaultCellEditor;
import javax.swing.InputMap;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
public class test extends JFrame {
     JTable table;
     public test() {
          table = new JTable(15, 5) {
               public boolean isCellEditable(int row, int column) {
                    return column % 2 == 0;
                    // return true;
               public void changeSelection(final int row, final int column,
                         boolean toggle, boolean extend) {
                    super.changeSelection(row, column, toggle, extend);
                    if (editCellAt(row, column)) {
                         getEditorComponent().requestFocusInWindow();
          table.setPreferredScrollableViewportSize(table.getPreferredSize());
          table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
          TextAreaRenderer textAreaRenderer = new TextAreaRenderer();
          TextAreaEditor textEditor = new TextAreaEditor();
          table.getColumnModel().getColumn(4).setCellRenderer(textAreaRenderer);
          table.getColumnModel().getColumn(4).setCellEditor(textEditor);
          JTextField tf = new JTextField();
          tf.setBorder(BorderFactory.createEmptyBorder());
          table.setDefaultEditor(Object.class, new DefaultCellEditor((tf)));
          JScrollPane scrollPane = new JScrollPane(table);
          DefaultCellEditor dce = (DefaultCellEditor) table
                    .getDefaultEditor(Object.class);
          dce.setClickCountToStart(1);
          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() {
               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;
                         // Back to where we started, get out.
                         if (row == table.getSelectedRow()
                                   && column == table.getSelectedColumn()) {
                              break;
                    table.changeSelection(row, column, false, false);
          table.getActionMap().put(im.get(tab), tabAction);
          table.setSurrendersFocusOnKeystroke(true);
     public static void main(String[] args) {
          test frame = new test();
          frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
          frame.pack();
          frame.setLocationRelativeTo(null);
          frame.setVisible(true);
import java.awt.Component;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
public class TextAreaRenderer extends JTextArea implements TableCellRenderer {
     private final DefaultTableCellRenderer adaptee = new DefaultTableCellRenderer();
     /** map from table to map of rows to map of column heights */
     private final Map cellSizes = new HashMap();
     public TextAreaRenderer() {
          setLineWrap(true);
          setWrapStyleWord(true);
     public Component getTableCellRendererComponent(//
               JTable table, Object obj, boolean isSelected, boolean hasFocus,
               int row, int column) {
          // set the colours, etc. using the standard for that platform
          adaptee.getTableCellRendererComponent(table, obj, isSelected, hasFocus,
                    row, column);
          setForeground(adaptee.getForeground());
          setBackground(adaptee.getBackground());
          setBorder(adaptee.getBorder());
          setFont(adaptee.getFont());
          setText(adaptee.getText());
          // This line was very important to get it working with JDK1.4
          TableColumnModel columnModel = table.getColumnModel();
          setSize(columnModel.getColumn(column).getWidth(), 100000);
          int height_wanted = (int) getPreferredSize().getHeight();
          addSize(table, row, column, height_wanted);
          height_wanted = findTotalMaximumRowSize(table, row);
          if (height_wanted != table.getRowHeight(row)) {
               table.setRowHeight(row, height_wanted);
          return this;
     private void addSize(JTable table, int row, int column, int height) {
          Map rows = (Map) cellSizes.get(table);
          if (rows == null) {
               cellSizes.put(table, rows = new HashMap());
          Map rowheights = (Map) rows.get(new Integer(row));
          if (rowheights == null) {
               rows.put(new Integer(row), rowheights = new HashMap());
          rowheights.put(new Integer(column), new Integer(height));
      * Look through all columns and get the renderer. If it is also a
      * TextAreaRenderer, we look at the maximum height in its hash table for
      * this row.
     private int findTotalMaximumRowSize(JTable table, int row) {
          int maximum_height = 0;
          Enumeration columns = table.getColumnModel().getColumns();
          while (columns.hasMoreElements()) {
               TableColumn tc = (TableColumn) columns.nextElement();
               TableCellRenderer cellRenderer = tc.getCellRenderer();
               if (cellRenderer instanceof TextAreaRenderer) {
                    TextAreaRenderer tar = (TextAreaRenderer) cellRenderer;
                    maximum_height = Math.max(maximum_height, tar
                              .findMaximumRowSize(table, row));
          return maximum_height;
     private int findMaximumRowSize(JTable table, int row) {
          Map rows = (Map) cellSizes.get(table);
          if (rows == null)
               return 0;
          Map rowheights = (Map) rows.get(new Integer(row));
          if (rowheights == null)
               return 0;
          int maximum_height = 0;
          for (Iterator it = rowheights.entrySet().iterator(); it.hasNext();) {
               Map.Entry entry = (Map.Entry) it.next();
               int cellHeight = ((Integer) entry.getValue()).intValue();
               maximum_height = Math.max(maximum_height, cellHeight);
          return maximum_height;
import java.awt.KeyboardFocusManager;
import java.awt.event.FocusEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.util.HashSet;
import java.util.Set;
import javax.swing.DefaultCellEditor;
import javax.swing.JComponent;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
public class TextAreaEditor extends DefaultCellEditor {
     public TextAreaEditor() {
          super(new JTextField());
          final JTextArea textArea = new JTextArea();
          textArea.setWrapStyleWord(true);
          textArea.setLineWrap(true);
          JScrollPane scrollPane = new JScrollPane(textArea);
          scrollPane.setBorder(null);
          Set forwardTraversalKeys = new HashSet();
          forwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));
          textArea.setFocusTraversalKeys(
                    KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
                    forwardTraversalKeys);
          Set backwardTraversalKeys = new HashSet();
          backwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,
                    InputEvent.SHIFT_MASK));
          textArea.setFocusTraversalKeys(
                    KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
                    backwardTraversalKeys);
          scrollPane.getVerticalScrollBar().setFocusable(false);
          scrollPane.getVerticalScrollBar().setFocusable(false);
          editorComponent = scrollPane;
          delegate = new DefaultCellEditor.EditorDelegate() {
               public void setValue(Object value) {
                    textArea.setText((value != null) ? value.toString() : "");
               public Object getCellEditorValue() {
                    return textArea.getText();
     public void lostFocus() {
          stopCellEditing();
}

Similar Messages

  • JTextArea inside Jtable - Tab, Focus issues

    I am facing the following problems with JTextArea inside Jtable Cell
    1. blinking cursor not visible on the cell(0,0) first time the UI is shown, although it has the focus
    2. blinking cursor not visible on the 5th column (JTextArea) when it receives the focus nor the characters are visible when i start typing. i have to manually double click to force the focus to shift to the cell.
    3. focus does not shit out of the 5th column (JTextArea) after pressing the tab key or enter key once. i have to do that twice to force the focus out.
    Following is the code which i have implemented. Please let me know what is being missed out to rectify the above problems.
    Thanks.
    import java.awt.event.ActionEvent;
    import java.awt.event.KeyEvent;
    import javax.swing.AbstractAction;
    import javax.swing.Action;
    import javax.swing.BorderFactory;
    import javax.swing.DefaultCellEditor;
    import javax.swing.InputMap;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JTextField;
    import javax.swing.KeyStroke;
    public class test extends JFrame {
         JTable table;
         public test() {
              table = new JTable(15, 5) {
                   public boolean isCellEditable(int row, int column) {
                        return column % 2 == 0;
                        // return true;
                   public void changeSelection(final int row, final int column,
                             boolean toggle, boolean extend) {
                        super.changeSelection(row, column, toggle, extend);
                        if (editCellAt(row, column)) {
                             getEditorComponent().requestFocusInWindow();
              table.setPreferredScrollableViewportSize(table.getPreferredSize());
              table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
              TextAreaRenderer textAreaRenderer = new TextAreaRenderer();
              TextAreaEditor textEditor = new TextAreaEditor();
              table.getColumnModel().getColumn(4).setCellRenderer(textAreaRenderer);
              table.getColumnModel().getColumn(4).setCellEditor(textEditor);
              JTextField tf = new JTextField();
              tf.setBorder(BorderFactory.createEmptyBorder());
              table.setDefaultEditor(Object.class, new DefaultCellEditor((tf)));
              JScrollPane scrollPane = new JScrollPane(table);
              DefaultCellEditor dce = (DefaultCellEditor) table
                        .getDefaultEditor(Object.class);
              dce.setClickCountToStart(1);
              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() {
                   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;
                             // Back to where we started, get out.
                             if (row == table.getSelectedRow()
                                       && column == table.getSelectedColumn()) {
                                  break;
                        table.changeSelection(row, column, false, false);
              table.getActionMap().put(im.get(tab), tabAction);
              table.setSurrendersFocusOnKeystroke(true);
         public static void main(String[] args) {
              test frame = new test();
              frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
              frame.pack();
              frame.setLocationRelativeTo(null);
              frame.setVisible(true);
    import java.awt.Component;
    import java.util.Enumeration;
    import java.util.HashMap;
    import java.util.Iterator;
    import java.util.Map;
    import javax.swing.JTable;
    import javax.swing.JTextArea;
    import javax.swing.table.DefaultTableCellRenderer;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumn;
    import javax.swing.table.TableColumnModel;
    public class TextAreaRenderer extends JTextArea implements TableCellRenderer {
         private final DefaultTableCellRenderer adaptee = new DefaultTableCellRenderer();
         /** map from table to map of rows to map of column heights */
         private final Map cellSizes = new HashMap();
         public TextAreaRenderer() {
              setLineWrap(true);
              setWrapStyleWord(true);
         public Component getTableCellRendererComponent(//
                   JTable table, Object obj, boolean isSelected, boolean hasFocus,
                   int row, int column) {
              // set the colours, etc. using the standard for that platform
              adaptee.getTableCellRendererComponent(table, obj, isSelected, hasFocus,
                        row, column);
              setForeground(adaptee.getForeground());
              setBackground(adaptee.getBackground());
              setBorder(adaptee.getBorder());
              setFont(adaptee.getFont());
              setText(adaptee.getText());
              // This line was very important to get it working with JDK1.4
              TableColumnModel columnModel = table.getColumnModel();
              setSize(columnModel.getColumn(column).getWidth(), 100000);
              int height_wanted = (int) getPreferredSize().getHeight();
              addSize(table, row, column, height_wanted);
              height_wanted = findTotalMaximumRowSize(table, row);
              if (height_wanted != table.getRowHeight(row)) {
                   table.setRowHeight(row, height_wanted);
              return this;
         private void addSize(JTable table, int row, int column, int height) {
              Map rows = (Map) cellSizes.get(table);
              if (rows == null) {
                   cellSizes.put(table, rows = new HashMap());
              Map rowheights = (Map) rows.get(new Integer(row));
              if (rowheights == null) {
                   rows.put(new Integer(row), rowheights = new HashMap());
              rowheights.put(new Integer(column), new Integer(height));
         * Look through all columns and get the renderer. If it is also a
         * TextAreaRenderer, we look at the maximum height in its hash table for
         * this row.
         private int findTotalMaximumRowSize(JTable table, int row) {
              int maximum_height = 0;
              Enumeration columns = table.getColumnModel().getColumns();
              while (columns.hasMoreElements()) {
                   TableColumn tc = (TableColumn) columns.nextElement();
                   TableCellRenderer cellRenderer = tc.getCellRenderer();
                   if (cellRenderer instanceof TextAreaRenderer) {
                        TextAreaRenderer tar = (TextAreaRenderer) cellRenderer;
                        maximum_height = Math.max(maximum_height, tar
                                  .findMaximumRowSize(table, row));
              return maximum_height;
         private int findMaximumRowSize(JTable table, int row) {
              Map rows = (Map) cellSizes.get(table);
              if (rows == null)
                   return 0;
              Map rowheights = (Map) rows.get(new Integer(row));
              if (rowheights == null)
                   return 0;
              int maximum_height = 0;
              for (Iterator it = rowheights.entrySet().iterator(); it.hasNext();) {
                   Map.Entry entry = (Map.Entry) it.next();
                   int cellHeight = ((Integer) entry.getValue()).intValue();
                   maximum_height = Math.max(maximum_height, cellHeight);
              return maximum_height;
    import java.awt.KeyboardFocusManager;
    import java.awt.event.FocusEvent;
    import java.awt.event.InputEvent;
    import java.awt.event.KeyEvent;
    import java.util.HashSet;
    import java.util.Set;
    import javax.swing.DefaultCellEditor;
    import javax.swing.JComponent;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    import javax.swing.KeyStroke;
    public class TextAreaEditor extends DefaultCellEditor {
         public TextAreaEditor() {
              super(new JTextField());
              final JTextArea textArea = new JTextArea();
              textArea.setWrapStyleWord(true);
              textArea.setLineWrap(true);
              JScrollPane scrollPane = new JScrollPane(textArea);
              scrollPane.setBorder(null);
              Set forwardTraversalKeys = new HashSet();
              forwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));
              textArea.setFocusTraversalKeys(
                        KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
                        forwardTraversalKeys);
              Set backwardTraversalKeys = new HashSet();
              backwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,
                        InputEvent.SHIFT_MASK));
              textArea.setFocusTraversalKeys(
                        KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
                        backwardTraversalKeys);
              scrollPane.getVerticalScrollBar().setFocusable(false);
              scrollPane.getVerticalScrollBar().setFocusable(false);
              editorComponent = scrollPane;
              delegate = new DefaultCellEditor.EditorDelegate() {
                   public void setValue(Object value) {
                        textArea.setText((value != null) ? value.toString() : "");
                   public Object getCellEditorValue() {
                        return textArea.getText();
         public void lostFocus() {
              stopCellEditing();
    --------------------------------------------

    I am facing the following problems with JTextArea inside Jtable Cell
    1. blinking cursor not visible on the cell(0,0) first time the UI is shown, although it has the focus
    2. blinking cursor not visible on the 5th column (JTextArea) when it receives the focus nor the characters are visible when i start typing. i have to manually double click to force the focus to shift to the cell.
    3. focus does not shit out of the 5th column (JTextArea) after pressing the tab key or enter key once. i have to do that twice to force the focus out.
    Following is the code which i have implemented. Please let me know what is being missed out to rectify the above problems.
    Thanks.
    import java.awt.event.ActionEvent;
    import java.awt.event.KeyEvent;
    import javax.swing.AbstractAction;
    import javax.swing.Action;
    import javax.swing.BorderFactory;
    import javax.swing.DefaultCellEditor;
    import javax.swing.InputMap;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JTextField;
    import javax.swing.KeyStroke;
    public class test extends JFrame {
         JTable table;
         public test() {
              table = new JTable(15, 5) {
                   public boolean isCellEditable(int row, int column) {
                        return column % 2 == 0;
                        // return true;
                   public void changeSelection(final int row, final int column,
                             boolean toggle, boolean extend) {
                        super.changeSelection(row, column, toggle, extend);
                        if (editCellAt(row, column)) {
                             getEditorComponent().requestFocusInWindow();
              table.setPreferredScrollableViewportSize(table.getPreferredSize());
              table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
              TextAreaRenderer textAreaRenderer = new TextAreaRenderer();
              TextAreaEditor textEditor = new TextAreaEditor();
              table.getColumnModel().getColumn(4).setCellRenderer(textAreaRenderer);
              table.getColumnModel().getColumn(4).setCellEditor(textEditor);
              JTextField tf = new JTextField();
              tf.setBorder(BorderFactory.createEmptyBorder());
              table.setDefaultEditor(Object.class, new DefaultCellEditor((tf)));
              JScrollPane scrollPane = new JScrollPane(table);
              DefaultCellEditor dce = (DefaultCellEditor) table
                        .getDefaultEditor(Object.class);
              dce.setClickCountToStart(1);
              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() {
                   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;
                             // Back to where we started, get out.
                             if (row == table.getSelectedRow()
                                       && column == table.getSelectedColumn()) {
                                  break;
                        table.changeSelection(row, column, false, false);
              table.getActionMap().put(im.get(tab), tabAction);
              table.setSurrendersFocusOnKeystroke(true);
         public static void main(String[] args) {
              test frame = new test();
              frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
              frame.pack();
              frame.setLocationRelativeTo(null);
              frame.setVisible(true);
    import java.awt.Component;
    import java.util.Enumeration;
    import java.util.HashMap;
    import java.util.Iterator;
    import java.util.Map;
    import javax.swing.JTable;
    import javax.swing.JTextArea;
    import javax.swing.table.DefaultTableCellRenderer;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumn;
    import javax.swing.table.TableColumnModel;
    public class TextAreaRenderer extends JTextArea implements TableCellRenderer {
         private final DefaultTableCellRenderer adaptee = new DefaultTableCellRenderer();
         /** map from table to map of rows to map of column heights */
         private final Map cellSizes = new HashMap();
         public TextAreaRenderer() {
              setLineWrap(true);
              setWrapStyleWord(true);
         public Component getTableCellRendererComponent(//
                   JTable table, Object obj, boolean isSelected, boolean hasFocus,
                   int row, int column) {
              // set the colours, etc. using the standard for that platform
              adaptee.getTableCellRendererComponent(table, obj, isSelected, hasFocus,
                        row, column);
              setForeground(adaptee.getForeground());
              setBackground(adaptee.getBackground());
              setBorder(adaptee.getBorder());
              setFont(adaptee.getFont());
              setText(adaptee.getText());
              // This line was very important to get it working with JDK1.4
              TableColumnModel columnModel = table.getColumnModel();
              setSize(columnModel.getColumn(column).getWidth(), 100000);
              int height_wanted = (int) getPreferredSize().getHeight();
              addSize(table, row, column, height_wanted);
              height_wanted = findTotalMaximumRowSize(table, row);
              if (height_wanted != table.getRowHeight(row)) {
                   table.setRowHeight(row, height_wanted);
              return this;
         private void addSize(JTable table, int row, int column, int height) {
              Map rows = (Map) cellSizes.get(table);
              if (rows == null) {
                   cellSizes.put(table, rows = new HashMap());
              Map rowheights = (Map) rows.get(new Integer(row));
              if (rowheights == null) {
                   rows.put(new Integer(row), rowheights = new HashMap());
              rowheights.put(new Integer(column), new Integer(height));
         * Look through all columns and get the renderer. If it is also a
         * TextAreaRenderer, we look at the maximum height in its hash table for
         * this row.
         private int findTotalMaximumRowSize(JTable table, int row) {
              int maximum_height = 0;
              Enumeration columns = table.getColumnModel().getColumns();
              while (columns.hasMoreElements()) {
                   TableColumn tc = (TableColumn) columns.nextElement();
                   TableCellRenderer cellRenderer = tc.getCellRenderer();
                   if (cellRenderer instanceof TextAreaRenderer) {
                        TextAreaRenderer tar = (TextAreaRenderer) cellRenderer;
                        maximum_height = Math.max(maximum_height, tar
                                  .findMaximumRowSize(table, row));
              return maximum_height;
         private int findMaximumRowSize(JTable table, int row) {
              Map rows = (Map) cellSizes.get(table);
              if (rows == null)
                   return 0;
              Map rowheights = (Map) rows.get(new Integer(row));
              if (rowheights == null)
                   return 0;
              int maximum_height = 0;
              for (Iterator it = rowheights.entrySet().iterator(); it.hasNext();) {
                   Map.Entry entry = (Map.Entry) it.next();
                   int cellHeight = ((Integer) entry.getValue()).intValue();
                   maximum_height = Math.max(maximum_height, cellHeight);
              return maximum_height;
    import java.awt.KeyboardFocusManager;
    import java.awt.event.FocusEvent;
    import java.awt.event.InputEvent;
    import java.awt.event.KeyEvent;
    import java.util.HashSet;
    import java.util.Set;
    import javax.swing.DefaultCellEditor;
    import javax.swing.JComponent;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    import javax.swing.KeyStroke;
    public class TextAreaEditor extends DefaultCellEditor {
         public TextAreaEditor() {
              super(new JTextField());
              final JTextArea textArea = new JTextArea();
              textArea.setWrapStyleWord(true);
              textArea.setLineWrap(true);
              JScrollPane scrollPane = new JScrollPane(textArea);
              scrollPane.setBorder(null);
              Set forwardTraversalKeys = new HashSet();
              forwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));
              textArea.setFocusTraversalKeys(
                        KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
                        forwardTraversalKeys);
              Set backwardTraversalKeys = new HashSet();
              backwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,
                        InputEvent.SHIFT_MASK));
              textArea.setFocusTraversalKeys(
                        KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
                        backwardTraversalKeys);
              scrollPane.getVerticalScrollBar().setFocusable(false);
              scrollPane.getVerticalScrollBar().setFocusable(false);
              editorComponent = scrollPane;
              delegate = new DefaultCellEditor.EditorDelegate() {
                   public void setValue(Object value) {
                        textArea.setText((value != null) ? value.toString() : "");
                   public Object getCellEditorValue() {
                        return textArea.getText();
         public void lostFocus() {
              stopCellEditing();
    --------------------------------------------

  • Tab focus issue with 2 popups open

    Hi!
    I've just got a nasty problem with 2 popups and a tab focus.
    First poup automatically opens second popup and if you press TAB
    key focus goes to the first popup window - underneath the top one.
    As a matter of fact - if you open the second popup by
    clicking on the button in the first window - no problem. It happens
    only if the first window opens second via AS.
    I've found on the internet the following
    article:
    But my joy was premature - this piece code:
    quote:
    SystemManager.activate( popup );
    is simply uncompilable. I tried other methods, like:
    this.systemManager.activate(this);
    without any luck.
    Does anybody know the solution to this problem?
    Thanks in advance!
    Cheers,
    Dmitri.

    Manfred,
    Thanks for your reply. I tried requestFocus() and it gives the same results. Also Sun's 1.4.0 API (http://java.sun.com/j2se/1.4/docs/api/) mentions the following with respect to the requestFocus() method in the JComponent class:
    Because the focus behavior of this method is platform-dependent, developers are strongly encouraged to use requestFocusInWindow when possible.
    That is why I used requestFocusInWindow.
    S.L.

  • JTextField and JTextArea don't get focus occuasionally

    I am developing a Java Swing Applet. At edit mode, JComboBox, JCheckBox, JRadioBox, and JButton work fine, but JTextField and JTextArea can't get focus occuasionally while I click them.
    Anyone has idea?
    Thanks

    Thank you Himanshu,
    but that's not exactly what my issue is. This link describes the undesired effect of ending up outisde of the player window and in the browser.
    My problem is kind of the opposite. When I launch the page in the html file I cannot use the tab key to get to any of the controls in the captivate window. I'm stuck in the browser unless I click on the captivate window. That is not acceptable if we want it accessible without using a mouse. I found a way to make it work for chrome like I stated above, but not in FF. Do you have any ideas for this?
    Thanks!
    Monique

  • JTable - losing focus on keystroke

    hello the following code is supposed to create a new table row when the TAB key is pressed while being at the last cell of the JTable.
    table.setSurrendersFocusOnKeystroke(false);     
                InputMap imap = table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
                imap.put(KeyStroke.getKeyStroke(10, 0), "_navigate");
                imap.put(KeyStroke.getKeyStroke(9, 0), "_navigate");
                table.getActionMap().put("_navigate", new NavigateAction());
         private class NavigateAction extends AbstractAction{
              public NavigateAction(){
                   super();
              public void actionPerformed(final ActionEvent e)
                   int allRows=table.getRowCount()-1;
                   int allCols=table.getColumnCount()-1;
                   int atRow=table.getSelectedRow();
                   int editCol=table.getEditingColumn();
                   if(allRows==atRow && allCols==editCol &&(editCol==-1 || editCol==allCols))
                        runActionAddRow();     // add a row if the cell positionned at is the last cell of the last row
                 Action action = table.getActionMap().get("selectNextColumnCell");     // move on to the next cell
                 e.setSource(table);
                 action.actionPerformed(e);
                 SwingUtilities.invokeLater(new Runnable(){
                      public void run(){
                         Action action = table.getActionMap().get("startEditing"); // start editing the next cell
                         e.setSource(table);
                         action.actionPerformed(e);
         }it works but what i am not able to resolve is that each time the focus moves to the next component in the frame and then returns to the JTable before the desired action takes place.
    any help on this is much appreciated.
    thanks

    Thanks JJMack.  I was hoping it wasn't the card I was using.  This is the first time I've used a geforce card on my work PC.  However it's not the first time I've used them with Adobe's apps.  For years my personal PCs had them and usually without issues like this.  We chose to attempt to use this new Geforce GTX980 card because of how much further advanced it is over midrange Quadro cards at the moment, and because of some of the other software I am using that is more viewport and video ram dependent.  Adobe applications are still my mainstay but we couldn't justify the purchase of older technology midrange K4000 cards that were supposedly newer than my older 4000.  As these still had older PCI connections than the HP workstations we built, among other tech such as cuda core amounts that are drastically behind the times.  Jumping up to 6000 level Quadro cards for up to date technology just isn't in the budget as the prices are astronomical. As with the Titan cards cards that are high priced and yet older tech.  So we made the decision to try the GTX card for a while.  Right now this sporadic window focus issue seems to be the only new issue I've run into so far.   I'm sure I will see more in the near future doing something if the card is the issue.  Maybe the new types of hardware being used such as the PCI express hard drive, or very recent photoshop updates can be blamed.  Just not figuring it out just yet.
    I was informed by an IT professional here that has application creation experience that this truly seemed like an application problem more than a graphic card problem.   But until someone can corroborate that thought I guess I'm going to keep blaming the newer GTX card or wait to see if an App update makes this go away quietly.  No one else has chimed in yet.  Thanks for the link.

  • How do I stop Yahoo mail's popup dialog box from changing the tab focus?

    Hi,
    When I have a tab opened to Yahoo mail and I open a Yahoo email on my other computer or Blackberry, there's a time delay and at some point, Yahoo shifts my browser focus to display a pop-up dialog box that says "You have been disconnected from chat because you have signed into Yahoo! Messenger from another computer." I can't even switch back to the tab I was on without dismissing the popup.
    I'd love it if I could turn off the pop-up, - don't care about the disconnection - but in the meantime, is there some way to prevent Yahoo from changing my tab focus?
    Thanks!

    Hi Douglass,
    You will need to navigate to the following folder.
    /Users/yourusername/Library/Mail/V2/MailData
    and backup the following file... MessageRules.plist
    Open the file in BBedit to confirm your rules are infact inside that particular plist file as Mail will also create backups occasionally.
    Once you reinstall, do a compare/replace with the newly created MessageRules.plist and you should be able to bring your "old" rules into your fresh install.
    as for mailboxes, those are contained within this folder
    /Users/yourusername/Library/Mail/V2/Mailboxes
    and it will be up to you to backup those files and File/Import Mailboxes them into the new install.

  • Combobox Autocomplete editor inside Jtable cell

    I have a custom combobox editor which supports the autocomplete feature as follows:
    as soon as the user keys in any character, this editor searches for the item that starts with keyed in character. This item is displayed in the editor text field and the combobox popup is set to visible and the this item is set to selected.
    this editor works fine when standalone. but the popup fails to become visible when this combobox is used as an celleditor inside jtable. infact the focus is lost from the entire table.
    can anyone suggest the possible reason (and solution if possible).
    following are the code snippets for the same: -
         private TableCellEditor addCellEditor() {
              final JComboBox myJComboBox = new PIComboBox();
              myJComboBox.setModel(new DefaultComboBoxModel(// some data model //));
              //change the size of popup window
              BasicComboPopup comboPopup = null;
              for (int i=0, n=getUI().getAccessibleChildrenCount(myJComboBox); i<n; i++) {
                  Object component = getUI().getAccessibleChild(myJComboBox, i);
                  if (component instanceof BasicComboPopup) {
                   comboPopup = (BasicComboPopup) component;
                   break;
              if(null != comboPopup)
                  comboPopup.setLayout(new GridLayout(1,1));
                  comboPopup.setPopupSize(new Dimension(200, 150));
              myJComboBox.setEditable(true);
              myJComboBox.setEditor(new ComboBoxAutoCompleteEditor(myJComboBox, 3));
              myJComboBox.setUI(new ComboBoxAutoCompleteUI());
              TableCellEditor myCellEditor = new DefaultCellEditor(myJComboBox );
              return myCellEditor;
         public class ComboBoxAutoCompleteEditor extends BasicComboBoxEditor {
         public ComboBoxAutoCompleteEditor(PIComboBox comboBox, int maxLength) {
              super();
              this.comboBox = comboBox;
              this.maxLength = maxLength;
         @Override
         public Component getEditorComponent() {
              if(null == editorComponent)
                   editorComponent = new PITextField();
                   editorComponent.setBorder(null);
                   editorComponent.setMaxLength(maxLength);
                   editorComponent.setDocument(getDocument());
              return editorComponent;
         private ComboBoxAutoCompleteDocument getDocument()
              if(null == comboBoxAutoCompleteDocument)
                   comboBoxAutoCompleteDocument = new ComboBoxAutoCompleteDocument(
                             this.comboBox.getModel());
                   comboBoxAutoCompleteDocument.addDocumentListener(new ComboBoxDocumentListener());
              return comboBoxAutoCompleteDocument;
         private class ComboBoxDocumentListener implements DocumentListener {
              public void insertUpdate(DocumentEvent e) {
                   if (updatingSelection) {
                        return;
                   SwingUtilities.invokeLater(new ScrollHandler());
              public void removeUpdate(DocumentEvent e) {
              public void changedUpdate(DocumentEvent e) {
         private class ScrollHandler implements Runnable {
              private String scrollToString;
              private int scrollToRow;
              private ScrollHandler() {
                   try {
                        int length = getDocument().getLength();
                        String text = getDocument().getText(0, length);
                        scrollToRow = -1;
                        scrollToString = (String) comboBox.getSelectedItem();
                        ComboBoxModel model = comboBox.getModel();
                        int size = model.getSize();
                        for (int i = 0;  i < size; i++) {
                             String item = model.getElementAt(i).toString();
                             if (item.startsWith(text)) {
                                  scrollToString = item;
                                  break;
                             scrollToRow++;
                   } catch (BadLocationException ble) {
                        // TODO: handle
                        ble.printStackTrace();
              public void run() {
                   final int matchCount = getDocument()
                             .getCurrentMatchCount();
                   updatingSelection = true;
                   comboBox.setSelectedItem(scrollToString);
                   if (comboBox.isDisplayable())
                        comboBox.showPopup();
                   updatingSelection = false;
                   if (scrollToRow != comboBox.getItemCount() - 1) {
                        ComboBoxAutoCompleteUI ui = (ComboBoxAutoCompleteUI) comboBox
                                  .getUI();
                        JList popupList = ui.getPopupList();
                        int rowsToAdd = Math.min(comboBox.getMaximumRowCount(), comboBox
                                  .getItemCount()
                                  - scrollToRow - 1);
                        popupList.scrollRectToVisible(popupList.getCellBounds(
                                  scrollToRow + rowsToAdd, scrollToRow + rowsToAdd));
                   if (matchCount > 0) {
                        ((PITextField)getEditorComponent()).setSelectionStart(matchCount);
                        ((PITextField)getEditorComponent()).setSelectionEnd(
                                  getDocument().getLength());
         public class ComboBoxAutoCompleteUI extends BasicComboBoxUI {
             JList getPopupList() {
                 return popup.getList();
         public class ComboBoxAutoCompleteDocument extends PlainDocument {
         public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
            currentMatchCount = getLength() + str.length();
            String currentText = getText(0, getLength());
            //search the matching string here
            offs = 0;
            remove(0, getLength());
            super.insertString(offs, str, a);
         **************

    You need to create a custom CellEditor which will prevent these problems from occurring. The explanation behind the problem and source code for the new editor can be found at Thomas Bierhance's site http://www.orbital-computer.de/JComboBox/. The description of the problem and the workaround are at the bottom of the page.

  • Using webutil causes focus issues

    Hello,
    Many of us are familiar with the sporadic focus issue that can occur whereby you can use the keyboard to tab around a form but not the mouse. We have an existing function in our application which uses calls to Webutil functions (WEBUTIL_FILE.FILE_SAVE_DIALOG, WEBUTIL_FILE_TRANSFER.IS_AS_READABLE, EBUTIL_FILE_TRANSFER.AS_TO_CLIENT) to mediate a CSV export of data. We've noticed, since upgrading to 10.1.2.3 and the Sun JVM, that after performing this action, the focus problems occur i.e. mouse navigation no longer works.
    Has anyone else encountered this problem..? Or even better, have a suggested solution?
    Regards,
    James
    Apps Server: Forms and Reports Server 10.1.2.3
    JVM: Sun 1.6.0_14

    I face this problem and finally get the the solution it is:
    1- make keyboard navigable property for the blob item 'no' .
    2- create any item in the block of this blob and make it navigable 'yes' and visible 'yes' and width '0' and height '0'.
    and try and isa mouse navigation will work
    Feel free to contact me to inquire anything .

  • Auto tab focus method is not working in iOS devices please share the ideas why its not working?

    Auto tab focus method is not working in iOS devices. Please share the idear i am facing this issue while developing code for devices.

    Hi there,
    I can confirm this bug.
    Not sure if this info is relevant, but this is my experience:
    I am on the FIDO network, and so are two other people I know.
    We all tried blocking numbers, and calls ring right through. Text messages are blocked successfully. (never tried facetime)
    I also tried a ROGERS device running IOS7, and was successfully able to block my phone call from ringing through. HOWEVER, my call was forwarded to their voicemail, I was able to leave a voicemail for the person, and they did get an alert that they had a new voicemail.
    I have not yet had a chance to test this on Bell, Telus, or any other carriers.
    Spoke to Apple, and they advised me to do a hard reset (hold both buttons to shut off and reboot the phone), and if that fails to do an iOS restore.
    I have yet to try this, but hopefully someone will have a better solution.

  • Adobe Flash Pro CS6 -- cursor and focus issues

    This is OS specific as it works fine in the Snow Leopard.
    I am having issues with nearly everything involved with switching between apps / focusing on text windows / getting the cursor to appear where I click / etc since upgrading to Mountian Lion/Mavericks while using Flash Professional CS6. 
    Example problems:
    I click on the Flash icon in the menu bar (twice because the new Mac OS's have focus problems in the dock with mission control enabled) the OS will sometimes switch to the space containing Flash (sometimes not but let's focus on the Flash focus issues). I hover over the code window, I scroll with the mousewheel down the page to where I want to edit the code, I CLICK exactly where I want to paste it, hit cmd+C -- then it pastes the code NOT THERE but instead where the cursor was before (at the top of the page)... So essentially I have to double or triple click everything in Flash all the time. I just click like crazy anymore on everything all the time, but in Flash it's really unpredictable.
    This happens on both of my work computers (both 10.8.5)
    and my Mac Pro (10.9) but not my MacBook Pro that is still extremely fortunate enough to have 10.6 on it.

    What you need is an inner Graphic symbol. What I mean by Graphic symbol is when you select all your letters and hit "F8", choose "Graphic" instead of "MovieClip." In the properties panel, you'll see that one of the sections is called "Looping." Select"play once" (the default is "Loop"). Inside that graphic should be the animation of the letters moving in from left to right.
    On the outer timeline, put a keyframe at the same frame number where the Graphic's animation ends. Change the Looping to "Single Frame" and then type in the frame number of the last frame. You can then create a motion tween that animates the graphic symbol upward at its final frame.

  • Firefox focus issues

    Hi!
    I have a sometimes very irritating problem with Firefox. I have a Logitech G7 mouse with a tiltable wheel that I've set up to change tabs in forefox, and a sidebutton that I use to close tabs with. I'm just using xbindkeys to bind the mouse buttons to ctrl+page up, ctrl+page down and ctrl+w. The thing is that firefox sometimes seems to loose focus, and ignores keyboard commands. For example when I close my current tab with my mouse or by pressing ctrl+w, and then try to close the next tab too, it doesn't work. I have to click on another window or on the desktop to make firefox loose focus, and then click on firefox again. Then it starts working temporarily again.
    I'm using Firefox 3.0b2 from AUR right now, but I had the same problem with Firefox 2 from extra too. I use gnome with metacity. I also have a couple of plugins installed, but I have tried without any plugins too. I also have the same problem on my laptop, and both my computers use Arch64.
    So, does anyone know a solution to this? It's not such a big deal really, but I gets really annoying sometimes.

    arnuld wrote:
    Aha... and I thought I am the only with Firefox issue
    I use "wmii" and my Firefox always looses focus. In wmii, you can change to different TAGS (like Desktops in GNOME) using "ALT-#" If i have 3 tags opened and Firefox is running on tag-2 and I go to tag-3 to check my messages in pidgin and come back with "ALT-2" I do not see Firefox. I see only border of Firefox and between the border i see my background wallpaper . Clickign with mouse does not bring the focus in anyway..... Quite funny though.. It is happening very frequently , nearly all the time, even if I kill Firefox using <killall firefox-bin> or <kill -9 PID> , the problem remains as it is when I start Firefox again :\
    This also seems to be a different problem from what I'm experiencing, but it seems like there are lots of different firefox focus issues. From your description it almost seems like firefox has crashed for you, since it is no longer drawing itself. Have you tried running firefox from a terminal, to see if you get any error messages?

  • Scale Object with Panel, but what about inside a Tab control?

    The Scale Object with Panel option works very well for simple UI
    objects.  I like to use it for VIs that display tables or
    multicolumn listboxes, etc.  I am finding a limitation when I use
    the Tab control.  If I have a table or listbox in each tab, I
    would like them to scale with the panel.  I would also like the
    tab to scale.  It should look like an Excel workbook where all
    sheets scale with the window even though they are each on their own
    tab.  If I could only Group the various tables / lists with the
    Tab itself....
    This wouldn't be such an issue if the Bounds property of the
    multicolumn listbox was writable.  I can set the number of rows
    and columns, but column size can be variable and not uniform across all
    columns.  Also, that solution looks and behaves much different
    from the Scale Object with Panel approach.... not to mention the extra
    coding required.
    I'm guessing that this amounts to a feature request, but if anyone has a present-version workaround, I'd love to hear about it.
    See you at NI Week!
    Dan Press
    PrimeTest Automation

    Hi Kalin T,
    Thanks for your prompt reply. I am running version 8.01. My problem is that i cannot select "Scale object with pane" for the controls inside a Tab control if the Tab control "Scale object with pane" is turned on. I want both the Tab control and the controls inside to be scaled, for instance an Waveform graph or an textbox  when i resize my main window.
    Best regards,
    Mattis
    Attachments:
    Scale.vi ‏11 KB

  • Document Listener for JTextArea in JTable

    I am trying to implement a DocumentListener for JTextArea in JTable, but its not happening.
    Can someone tell me what's wrong. SSCCE below.
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import javax.swing.Icon;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JTextArea;
    import javax.swing.UIManager;
    import javax.swing.event.DocumentEvent;
    import javax.swing.event.DocumentListener;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumn;
    import javax.swing.text.Document;
    public class MyTable_TextArea extends JTable {
         private DefaultTableModel defaultTableModel;
         private Object[][] dataArray;
         private Object[] columnNameArray;
         public final int TEXT_COLUMN = 0;     
         // column headers
         public static final String TEXT_COLUMN_HEADER = "Text";
         // text area
         TextFieldRenderer3 textFieldRenderer3;
          * constructor
          * @param variableNameArray
          * @param columnNameArray
         public MyTable_TextArea(Object[][] variableNameArray, Object[] columnNameArray) {
              this.dataArray = variableNameArray;
              this.columnNameArray = columnNameArray;
              defaultTableModel = new DefaultTableModel(variableNameArray, columnNameArray);
              this.setModel(defaultTableModel)     ;
              // text field
            textFieldRenderer3 = new TextFieldRenderer3();
              MyDocumentListener myListener = new MyDocumentListener();
              textFieldRenderer3.getDocument().addDocumentListener(myListener);
            TableColumn modelColumn = this.getColumnModel().getColumn(TEXT_COLUMN);
              modelColumn.setCellRenderer(textFieldRenderer3);
          * nested class
         class MyDocumentListener implements DocumentListener {
             String newline = "\n";
             public void insertUpdate(DocumentEvent e) {
                  System.out.println ("insert update");
                 updateLog(e, "inserted into");
             public void removeUpdate(DocumentEvent e) {
                  System.out.println ("remove update");
                 updateLog(e, "removed from");
             public void changedUpdate(DocumentEvent e) {
                 //Plain text components do not fire these events
             public void updateLog(DocumentEvent e, String action) {
                 Document doc = (Document)e.getDocument();
                 int changeLength = e.getLength();
                 textFieldRenderer3.append(
                     changeLength + " character" +
                     ((changeLength == 1) ? " " : "s ") +
                     action + doc.getProperty("name") + "." + newline +
                     "  Text length = " + doc.getLength() + newline);
          * @param args
         public static void main(String[] args) {
              try{
                   UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
              catch (Exception e){
                   e.printStackTrace();
             String[] columnNameArray = {
                       TEXT_COLUMN_HEADER,
                       "1",
                       "2",
              Object[][]  dataArray = {      {"", "", ""},      };
              final MyTable_TextArea panel = new MyTable_TextArea(dataArray, columnNameArray);
              final JFrame frame = new JFrame();
              frame.getContentPane().add(new JScrollPane(panel));
              frame.setTitle("My Table");
              frame.setPreferredSize(new Dimension(500, 200));
              frame.addWindowListener(new WindowAdapter(){
                   @Override
                   public void windowClosing(WindowEvent e) {
              frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              frame.setLocation(300, 200);
              frame.pack();
              frame.setVisible(true);
    class TextFieldRenderer3 extends JTextArea implements TableCellRenderer {
         Icon defaultIcon;
         boolean isChecked = false;
         public TextFieldRenderer3() {
              System.out.println ("TextFieldRenderer()");
              setToolTipText("Double click to type");
         @Override
         public Component getTableCellRendererComponent(JTable table,
                   Object value,
                   boolean isSelected,
                   boolean hasFocus,
                   int row,
                   int column) {
              System.out.println ("TextFieldRenderer.getTableCellRendererComponent() row/column: " + row + "\t"+ column);
              return this;
    }

    I've implemented in the cell editor. I don't see how to get the value being typed (and nothing appears in the text area)
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.util.EventObject;
    import javax.swing.Icon;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JTextArea;
    import javax.swing.UIManager;
    import javax.swing.event.CellEditorListener;
    import javax.swing.event.DocumentEvent;
    import javax.swing.event.DocumentListener;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableCellEditor;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumn;
    import javax.swing.text.Document;
    public class MyTable_TextArea extends JTable {
         private DefaultTableModel defaultTableModel;
         private Object[][] dataArray;
         private Object[] columnNameArray;
         public final int TEXT_COLUMN = 0;     
         // column headers
         public static final String TEXT_COLUMN_HEADER = "Text";
         // text area
         TextAreaEditor textAreaEditor;
          * constructor
          * @param variableNameArray
          * @param columnNameArray
         public MyTable_TextArea(Object[][] variableNameArray, Object[] columnNameArray) {
              this.dataArray = variableNameArray;
              this.columnNameArray = columnNameArray;
              defaultTableModel = new DefaultTableModel(variableNameArray, columnNameArray);
              this.setModel(defaultTableModel)     ;
              // text field
            textAreaEditor = new TextAreaEditor();
              MyDocumentListener myListener = new MyDocumentListener();
              textAreaEditor.getDocument().addDocumentListener(myListener);
            TableColumn modelColumn = this.getColumnModel().getColumn(TEXT_COLUMN);
              modelColumn.setCellEditor(textAreaEditor);
          * nested class
         class MyDocumentListener implements DocumentListener {
             String newline = "\n";
             public void insertUpdate(DocumentEvent e) {
                  System.out.println ("insert update");
                 updateLog(e, "inserted into");
             public void removeUpdate(DocumentEvent e) {
                  System.out.println ("remove update");
                 updateLog(e, "removed from");
             public void changedUpdate(DocumentEvent e) {
                 //Plain text components do not fire these events
             public void updateLog(DocumentEvent e, String action) {
                 Document doc = (Document)e.getDocument();
                 int changeLength = e.getLength();
                 textAreaEditor.append(
                     changeLength + " character" +
                     ((changeLength == 1) ? " " : "s ") +
                     action + doc.getProperty("name") + "." + newline +
                     "  Text length = " + doc.getLength() + newline);
          * @param args
         public static void main(String[] args) {
              try{
                   UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
              catch (Exception e){
                   e.printStackTrace();
             String[] columnNameArray = {
                       TEXT_COLUMN_HEADER,
                       "1",
                       "2",
              Object[][]  dataArray = {      {"", "", ""},      };
              final MyTable_TextArea panel = new MyTable_TextArea(dataArray, columnNameArray);
              final JFrame frame = new JFrame();
              frame.getContentPane().add(new JScrollPane(panel));
              frame.setTitle("My Table");
              frame.setPreferredSize(new Dimension(500, 200));
              frame.addWindowListener(new WindowAdapter(){
                   @Override
                   public void windowClosing(WindowEvent e) {
              frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              frame.setLocation(300, 200);
              frame.pack();
              frame.setVisible(true);
    class TextAreaEditor extends JTextArea implements TableCellEditor {
         Icon defaultIcon;
         boolean isChecked = false;
         public TextAreaEditor() {
              System.out.println ("TextAreaEditor()");
              setToolTipText("Double click to type");
         @Override
         public Component getTableCellEditorComponent(JTable arg0,
                   Object arg1,
                   boolean arg2,
                   int arg3,
                   int arg4) {
              System.out.println ("TextAreaEditor() arg1: " + arg1 + "arg2: " + arg2  + " arg3: " + arg3  + " arg4: " + arg4  );
              return null;
         @Override
         public void addCellEditorListener(CellEditorListener arg0) {
              System.out.println ("TextAreaEditor().addCellEditorListener");
         @Override
         public void cancelCellEditing() {
              System.out.println ("TextAreaEditor().cancelCellEditing");
         @Override
         public Object getCellEditorValue() {
              System.out.println ("TextAreaEditor().getCellEditorValue");
              return null;
         @Override
         public boolean isCellEditable(EventObject arg0) {
              System.out.println ("TextAreaEditor().isCellEditable");
              return true;
         @Override
         public void removeCellEditorListener(CellEditorListener arg0) {
              System.out.println ("TextAreaEditor().removeCellEditorListener");          
         @Override
         public boolean shouldSelectCell(EventObject arg0) {
              System.out.println ("TextAreaEditor().shouldSelectCell");
              return false;
         @Override
         public boolean stopCellEditing() {
              System.out.println ("TextAreaEditor().stopCellEditing");
              return false;
    }

  • "Tab" control and Tab order of controls inside the tab

    Hello everybody,
    I have created the tab control with 6 'tabs', inside every tab I have some controls, like edit fields etc. I wanted to make an order of controls for every tab, so I have selected the option "Tab-order settings" from menu "Edit" (sorry for translation, I use non-English version of LabView), and tried to set the order. After saving it with "OK" button it turned out that the order is not changed. Simple it seems that the option doesn't work for controls in tabs. Is this a bug or do you have a solution for this?
    TIA,
    Yazilim.

    Sorry LabviewGuru, but I haven't found anything concerning Tab control and tab order inside it. Of course, I have found the topic "tabbing through front panel objects", but it simply describes how to change order for standard controls, not for controls which are inside the Tab control. But maybe you have another, extended help? So can you please copy and paste to discussion forum message this part of your help which concerns the Tab control and tab order, and then send the message?
    TIA,
    Yazilim.

  • Lightroom and Windows mouse focus issues.

    In one aspect Lightroom have been always behaving different from other Windows application: Its speed of grabbing mouse focus and moving window to the foreground is exaggerated. This problem will be observed only by people using their WinXP computers in "X11 mode", like with Unix, what allows to perform interaction with processes associated with windows without ever clicking on, or raising such window. Should you be working on large computer clusters as I do, this focusing feature its a blessing.
    This how you can reproduce: Use Tweak UI to adjust the mouse behavior. Select "Mouse," step down to "X=Mouse" and check "Activation follows mouse." Do not select "autoraise."
    Now your WinXP will behave similar to the real X11 xterm with mouse having the "no raise selection" policy. Its not quite identical to xterm, but it really works perfectly in most cases.
    Except... well, except with Lightroom. Lightroom grabs the pointer and pushes the window to the foreground in splits of a second. For example, go to
    "Help|About Adobe Lightroom" to see the credit window. It appears than as usual, but since the help menu will be dismisses, the pointer stands on the main Lightroom window, what makes the credits window vanish in split of a second. No chance to see it!
    Another case: Assume that Lightroom uses almost the entire desktop down to the task bar, and your browser window is smaller. Select the browser on the taskbar and try to move mouse to it. No chance! Lightroom will take over and pop itself to the foreground again. The only solution is to minimize Lightroom. And than sometimes something happens that Lightroom will not restore itself anymore! The "Restore" operation is grayed out, one can only Maximize it. We have reported this numerous times before.
    I am aware that this problem relates only to WinXP users with X11 mouse mode, but with Lightroom reaching now a high degree of maturity, maybe we could take a look at this problem as well?

    In order to overcome most of the known navigation and/or focus issues you need to be using the following:
    <li>Forms 10.1.2.3 or newer (latest is 11.1.2). If/when you are using 10.1.2.3 you would also need to install patch ID 9593176 as this contains additional fixes for focus issues.
    <li>JRE 1.6.0_26 or newer (latest is 1.6.0_30). The latest is always recommended as it contains the most up to date fixes for both technical issues and security issues.
    Patches are only available on MyOracleSupport: http://support.oracle.com

Maybe you are looking for

  • Essbase configuration in Shared Services

    We have a distributed Hyperion Planning Architecture. The Shared Serives is hosted on Windows Platform. While Essbase is hosted on Linux. I am trying to configure Essbase in the shared services but repeatedly the process in failing. I am really in si

  • I'm unable to download raw images from my canon 70D to elements 12.?

    I'm unable to download raw images from my canon 70D to PH elements 12, downloaded camera raw 8.2 as I saw in a discussion but still unable to convert images.  In the "select images" window the images are soft and cannot be selected.  What am I doing

  • How to get same effects as I get in Photoshop?

    Hi! I am trying to code a psd to html. My psd has vectors masks, Drop shadow and outer glow effect with few of the text and colured layers. How can I produce same effect in dreamivewer? Also I was unable to set opacity for my div in dreamviewer? If a

  • File Menu Missing (File, Edit, View, Document..."

    This is my first time using this forum - let me know if I should ask this elsewhere.  I am a seasoned user of Adobe Acrobat, but I am now using Windows 8 and am having some challenges.  For some reason, the top "Menu" bar has disappeared when I open

  • Where to download old HP CoolSense (1) ?

    Hello,  I have been using old HP Coolsense 1 to some degree of satisfaction. I have a Pavilion dv7 6110ec laptop with i7, which tends to run hot. But CoolSense with "Quietest" mode not only solved my overheating problems, but my laptop also ran quiet