1 Reply Latest reply: Oct 8, 2004 4:38 PM by 807587 RSS

    problem gaining focus

      Hi all, Im writing an applicaiton and I'm having some trouble getting the focus where I want it and was wondering if anyone could give me a suggestion.
      Here's the setup: I have a JFrame with a JToolBar on it. One of the buttons on the toolbar fires an extention of PAction that I setup. This PAction brings up a JInternalFrame with an optionpane on it that allows the user to enter/edit several pieces of info (several JTextComponents). On this InternalFrame is an InternalFrameListener, on its internalFrameActivated event I do a requestFocus() on the first JTextComponent on the InternalFrame.
      Whats currently happening is that the internalframe is activating and being selected, but the focus seems to be remaining on the toolbar's button. If I fire the same action using a method other than the toolbar (like the menu), the focus goes exactly where I want it.
      Here's what I know so far from debugging:
      1) The listener is definetly firing.
      2) The component never gains focus (in otherwords, im not loosing it after the request)
      3) There is a thread running but it's sleeping until the ok or cancel button is pressed.
      Here's what I've tried so far:
      1) Removing the thread
      2) Requesting focus on the first component: after the frame is opened, after the frame is activated, at the end of the PAction, and having the action reselect the internalframe then give the component focus
      3) I verified there are no other action listeners on the button.
      4) Stared blankly at my screen for a long time lost in thought.
      Any help will be very appreciated,