Hello all,
I've got a prob with an app I'm building. I've got a JToolbar that has a JButton on it that when pressed calls a extension of PAction. This action creates a new JInternalFrame and gives the user some additional info on the item selected allowing for editing of that info, ect.
All this sofar works, except for a minor inconvience. The focus should be on the first component (usually an instance of some JTextComponent), but the toolbar seems determined to keep it.
I first tried going to the new internalframe and using requestfocus() on the first component as the last line in the constuctor, that didn't work. I then tried putting a listener on the internalframe and requesting focus for first component on the internalFrameActivated event(), still no luck. I've also tried setting the component as the next focusable from the toolbar button and transfering to it, but the focus always remains on that button.
I also have a hotkey (keypressed listner) that calls the same action, when it is used (instead of the toolbar button) the focus is gained by the component just as I want it... so it has to be something to do with the toolbar but I can't think of what. (btw. i checked where I create the toolbar and didn't see anything that I wrote that would redirect forcus)
Any help would be appreciated.
Kris McCuller
kmcculler@yahoo.com
I've got a prob with an app I'm building. I've got a JToolbar that has a JButton on it that when pressed calls a extension of PAction. This action creates a new JInternalFrame and gives the user some additional info on the item selected allowing for editing of that info, ect.
All this sofar works, except for a minor inconvience. The focus should be on the first component (usually an instance of some JTextComponent), but the toolbar seems determined to keep it.
I first tried going to the new internalframe and using requestfocus() on the first component as the last line in the constuctor, that didn't work. I then tried putting a listener on the internalframe and requesting focus for first component on the internalFrameActivated event(), still no luck. I've also tried setting the component as the next focusable from the toolbar button and transfering to it, but the focus always remains on that button.
I also have a hotkey (keypressed listner) that calls the same action, when it is used (instead of the toolbar button) the focus is gained by the component just as I want it... so it has to be something to do with the toolbar but I can't think of what. (btw. i checked where I create the toolbar and didn't see anything that I wrote that would redirect forcus)
Any help would be appreciated.
Kris McCuller
kmcculler@yahoo.com