• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

focusable

 
Justin Fox
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
alright, i have ship objects, and the ship class extends JPanel..

now when i first enter my GUI, I can move the ships around on the

board, but as soon as i click in the chatTextField, the ships go un-focusable, and i cant move them any more..

why is this?

also, is there any method like JPanel.contains(point(x,y)); ?

Justin
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's a Swing forum here at the JavaRanch where this topic would be more at home. Regardless, there's a few things that are odd. First of all, a JPanel is a container and isn't generally a focus owner to begin with. The decision to have "Ship" extend JPanel seems dubious at best. You're also going to need to post some code to show us what you're doing and what the problem is before we can help further. I can't divine why you can't move your ship after clicking on a text field but I can tell it almost certainly has little to do with it being "unfocusable".

Look up Component.contains(int,int) for the answer to your other question. I'd link it but the forum software won't let me.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ken Blair:
There's a Swing forum here at the JavaRanch where this topic would be more at home...

Indeed. Please continue this discussion there.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic