Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #2412 > unrolled thread
| Started by | "Chameleon" <chameleon@THRWHITE.remove-dii-this> |
|---|---|
| First post | 2011-04-27 15:38 +0000 |
| Last post | 2011-04-27 15:39 +0000 |
| Articles | 5 — 2 participants |
Back to article view | Back to comp.lang.java.gui
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: TableCellEditor -> JT "Chameleon" <chameleon@THRWHITE.remove-dii-this> - 2011-04-27 15:38 +0000
Re: TableCellEditor -> JT "=?iso-8859-1?B?SfFha2kgWi" <=?iso-8859-1?b?sffha2kgwi@THRWHITE.remove-dii-this> - 2011-04-27 15:39 +0000
Re: TableCellEditor -> JT "=?iso-8859-1?B?SfFha2kgWi" <=?iso-8859-1?b?sffha2kgwi@THRWHITE.remove-dii-this> - 2011-04-27 15:39 +0000
Re: TableCellEditor -> JT "=?iso-8859-1?B?SfFha2kgWi" <=?iso-8859-1?b?sffha2kgwi@THRWHITE.remove-dii-this> - 2011-04-27 15:39 +0000
Re: TableCellEditor -> JT "Chameleon" <chameleon@THRWHITE.remove-dii-this> - 2011-04-27 15:39 +0000
| From | "Chameleon" <chameleon@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:38 +0000 |
| Subject | Re: TableCellEditor -> JT |
| Message-ID | <fc3r0h$l9n$1@volcano1.grnet.gr> |
To: comp.lang.java.gui >> I have a JTextField in a TableCellEditor. >> With a KeyListener I catch JTextField's Shift+Enter compination to add >> in text a special character. > > The #1 source of confusion is that JTable uses the same single > JTextField component to render every cell. This recycling has all > kinds of strange side effects, possibly including yours. I see this too: When I press a printable char (e.g. "a") then there is no cursor in JTextField (and KeyListener doesn't work). When I press F2 or double click then there is cursor in JTextField (and KeyListener works). About confusion above, there is at most one cell under edit. So there is no problem. --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [next] | [standalone]
| From | "=?iso-8859-1?B?SfFha2kgWi" <=?iso-8859-1?b?sffha2kgwi@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:39 +0000 |
| Message-ID | <1189812917.628962.33930@50g2000hsm.googlegroups.com> |
| In reply to | #2412 |
To: comp.lang.java.gui I'm seeing exactly the same problem in my application, and is weird because I'm sure the key listenr is in there, because I made some prints and I get this: sCellEditable Called getTableCellEditorComponent Called com.psft.driverconfig.mcms.rtu.McmSRTUConfigScreen $HoldingRegFormattedTextField$1@10e790c isCellEditable Called getTableCellEditorComponent Called com.psft.driverconfig.mcms.rtu.McmSRTUConfigScreen $HoldingRegFormattedTextField$1@10e790c The first three lines is after double click and the next three lines is after pressing a character. In the getTableCellEditorComponent I'm printing the value of the registered Key Listeners and in both cases is the same. What I'm guessing is that the JTable KeyListener is probably getting the keypresses and sending those to the JTextField using another function. --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "=?iso-8859-1?B?SfFha2kgWi" <=?iso-8859-1?b?sffha2kgwi@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:39 +0000 |
| Message-ID | <1189814950.319548.112590@22g2000hsm.googlegroups.com> |
| In reply to | #2454 |
To: comp.lang.java.gui OK now I know why this is happening but I still don't know how to solve it. When a cell is double clicked the JTextField gets the focus. If a key is pressed in the table the table gets the focus. I learn this by overriding the requestFocus in the JTextField to print something everytime is called and I get this: isCellEditable Called getTableCellEditorComponent Called com.psft.driverconfig.mcms.rtu.McmSRTUConfigScreen $HoldingRegFormattedTextField$1@1968e23 Focus Requested! isCellEditable Called getTableCellEditorComponent Called com.psft.driverconfig.mcms.rtu.McmSRTUConfigScreen $HoldingRegFormattedTextField$1@1968e23 The first case is by double clicking the cell and the second one is pressing a key in the cell. Another way of showing this is that if you double click over the cell, using the arrows moves you between characters in the JTextField. If you enter with a keypress when you press a cursor key the focus goes to another cell table, so the table keeps the focus and feeds the underlying JTextField. I tried solving it everriding the prepareEdiotr in the JTable and asigning there the focus to the JTextField, but the focus is changed after that. --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "=?iso-8859-1?B?SfFha2kgWi" <=?iso-8859-1?b?sffha2kgwi@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:39 +0000 |
| Message-ID | <1189817178.079819.231220@y42g2000hsy.googlegroups.com> |
| In reply to | #2456 |
To: comp.lang.java.gui I found a solution that might work for you Chamaleon. Just do setSurrendersFocusOnKeystroke in your table. That will force your table to give the focus to the JTextField. This doesn't work well for me because at least the first typed character is transferred to the JTextField, and I'm trying to filter characters so only numeric values can be introduced. I'll keep the research, but if somebody knows how to solve this problem I would appreciate it. --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "Chameleon" <chameleon@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:39 +0000 |
| Message-ID | <fcfk2n$9jg$1@volcano1.grnet.gr> |
| In reply to | #2459 |
To: comp.lang.java.gui > I found a solution that might work for you Chamaleon. Just do > setSurrendersFocusOnKeystroke in your table. That will force your > table to give the focus to the JTextField. This doesn't work well for > me because at least the first typed character is transferred to the > JTextField, and I'm trying to filter characters so only numeric values > can be introduced. > > I'll keep the research, but if somebody knows how to solve this > problem I would appreciate it. > it works! THANKS --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.gui
csiph-web