• Post Reply Bookmark Topic Watch Topic
  • New Topic

Really weird problem with JLabel (Self-Fixed, had nothing to do with JLabel)

 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JLabel in a chat client. The client is part of an instant message program. There is a major bug that is really weird. I have a JTextField, nameField, which holds the users name. It has a filter on it for certain words and characters. I have another JTextField, outgoing, which holds the outgoing text that will be sent to the server. It also has a filter on it for certain words. There is a JLabel, "online",which displays how many users are connected to the server. In my code, I do not mess with "online", except when reading incoming code. There is one little (and irrelevant) problem with the server "online" count, but that does not matter. Anyway, the problem being is when someone pushes "tab" on the keyboard all the way to "online". When they type in characters when focused on "online", it appends it to the name. When someone goes to send text to the server, it appears to the right of the name taken from nameField. The weird thing is that it is not displayed on the nameField. It is not filtered and should not even be able to have the focus, as I have added this line to my code:

Furthermore, I do not use "online" when I send text to the server. It should not even show up. The text beside the name (where you have "tabbed to", the seemingly random code does not show up anywhere on the users program. It is just sent to the server. What is going on with my program?
NOTE: My programs (one for mods and one for users) are 688 and 840 lines, respectively. If you really want me to post my code, I will. Just know why I didn't here. I have looked though my code multiple times to make sure the above information is correct.
Thanks,
John Price aka cc11rocks
 
Darryl Burke
Bartender
Posts: 5152
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If online isn't focusable, the user can't tab to it.

Looks likely to be a wrong use of KeyListener(s) and/or usig the wrong Map in key bindings.
 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dang it! I just figured out the problem. It had nothing to do with the JLabel.
Sorry,
John Price aka cc11rocks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!