Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Pressed once appears twice  RSS feed

 
Maja Gralewska
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good morning,

I have a table with different columns where the user can edit certain fields. The some of the fields have a look up button which the user can press and choose a code instead of typing it out. In the fields that contain the look-up when ever the user types the first number a second one appears(of exactly the same number). It only happens with the first number, and only when the field is reselected. if the user does not leave the field then he can re-edit the field and no numbers double themselves. Any suggestions would be appreciated.

Thanks.
 
Campbell Ritchie
Sheriff
Posts: 53769
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Morning.

I think we need more details, and I think this topic might sit better on the Swing forum.

Moving.
 
Maja Gralewska
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't really know how to explain it, it's just a normal table with the use of models. The user is allowed to edit certain fields, some of the fields have a little button in them that when pressed the display a new jpanel where the user can just select the code he would like to use instead of typing it out, but whenever the user wants to type in the code himself eg: 1234 what actually appears is 11234. it only happens with the first character and only once when the fields are selected, if the field has been selected then it can be edited and no numbers will appear twice. It also only happens to the field that contain the button. There are also no errors or exceptions and the program runs perfectly besides the the above problem. Unfortunately my employer says that i am not allowed to display any source code, so sorry about that but any idea's will be very appreciated. thanks.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like Campbell said, we really need more details.

Looks like you got a JTable with custom renderers. The custom renderer has a button, clicking on which the user is presented with a panel with a text component with probably auto-complete feature.

Since you cannot post the code, how about a screen shot?

Just a shot in the dark.
If the editor scenario I imagined above is true, you can set and see if it fixes your problem? The default value of this is 2.
[ December 01, 2008: Message edited by: Maneesh Godbole ]
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Unfortunately my employer says that i am not allowed to display any source code

and no-one here wants it.

just write a simple program:
JFrame with a JTable
table with 1 row, 2 columns (data column and lookup button)
include a few hard-coded items in the lookup area

now add enough render/editor/whatever code to reproduce the problem

if you don't find the solution yourself (doing it this way), you'll have
a very short program (meaningless to employer) to post here.
 
Maja Gralewska
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your help guys its working nw
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Maja Gralewska:
Thanks for your help guys its working nw


Care to share the solution for other people, who might have the same problem in future?
 
Maja Gralewska
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It was something really stupid that i did. It was originally a char but i was converting it to a string but the char was still being saved and so appeared twice. I still have no idea though why it was only the first char and not all the others.

Thanks for helping me figure it out tho
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!