nirvan bud

Greenhorn
+ Follow
since Dec 27, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by nirvan bud

I implemented focus listener on the Custom cell editor class to find where exactly the focus is going when using keyboard. When scrollPane is used instead of directly adding JTextarea, the focus goes to scrollPane and not the JTextArea and hence I am not able to edit the cell. Surprisingly, when mouse is directly used over the cell to gain focus, the Jtextarea gets the focus !.

I tried to use table.setSurrendersFocusOnKeystroke(true) but that doesn't solve the problem.

If anyone knows how to set focus to the child component of jscrollpane preferrably without using Focus Traversal Policy, please let me know.


regards,
nirvan.
14 years ago
I have resolved the problem no 1 presented in the last SSCCE post. Now the only problem is (problem no 2) that when I add scrollPane (with JTextArea in it), instead of directly adding JTextArea to the JTable, the column cannot be edited by keyboard i.e. it requires a mouse click.

regards,
nirvan.
14 years ago
Sorry once again Rob. This time I am sure it is an SSCCE.

Issue Once again:

1. If the column editor is JTextArea, then after editing the column, it requires two "Tab" key presses to come out of it.

2. If the column editor is JScrollPane with JTextArea inside, then it is not possible to start it editing using the keyboard. It requires use of mouse to start editing.

Here is the code.



regards,
nirvan.
14 years ago
Rob,
Sorry about cross-posting. Here is the SSCCE that shows the problem. Please note following.

1. In the SSCCE, I have used JTextArea inside the JTable column without JScrollPane holding it. This will show that you will have to press "Tab" key twice in order to get out of JTable column.

2. If you change the SSCCE to use JScrollPane as container for JTextArea, you will see that pressing the "Tab" key takes the cursor out of the JTable instead of to the next column.


The main JFrame that contains JTable




The Data Oboject that ArrayList needs to back the JTable




The WrappedAction class for setting new action to TAB key (Written by you).




regards,
nirvan
14 years ago
I am trying to use JTextArea as a cellEditor for a JTextArea column. I created a custom CellEditor for the purpose. But when I use the JTextArea component I get a few issues.

1. The JTextArea default "Tab" key operation does not take the cursor out of the textarea. To avoid this I used
textArea.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,new Tab Key). This solved my problem.

2. To come out of the textArea column into the next column, I have to press the "Tab" key twice. I have not been able to solve this problem.

3. Since I am using JTextArea, I want to use JScrollPane with JTextArea in it instead. But when I use JScrollPane with JTextArea in it pressing the "Tab" key takes focus out of the JTable, instead of traversing to the next column. I haven't been able to solve this problem too.

Here is the custom CellEditor code.




regards,
nirvan
14 years ago