Hi all, I've got a doozy, least I think it is hopefully there is an insanely simple fix. Here is the setup. I have an application which contains a JTabbedPane with two tabs. The first tab is a search area with a JTable for results and lots of little fields and buttons for buliding your search. The second tab contains a JDesktopArea which I've extended to do the scroll bar thing. Now, here is where I am confused. In VA which runs 1.2.2 everything works just fine but in JDK 1.3.1 which the company is using I get the following problem. 1. If I highlight text ANYWHERE other than in one of the internal frames and use the copy menu item or copy button the copy occurs just fine. However! If I have text selected in an internal frame and try the menu item it gives an error that the selected component is not a text field. (However the button works for some odd reason.) Through debugging I've found this: When text is seleced in teh JInternalFrame and menu item is then triggered events happen like this: Menu Item gains focus Menu Item action is run Menu Itme looses focus When the text is selected anywhere that ISN'T a JInternalFrame the events go like this: Menu Item gains focus Menu Item looses focus Field with selected text regains focus Menu Item action is run. 2. This one is even stranger. I start the application and open a new JInternalFrame. If I do this I can type in a text field BUT I can not highlight text with the mouse, i can do it using the SHIFT and arrow keys but not the mouse, I also can not use the mouse to scroll the JInterlaFrame's scroll bar. However if I swtich focus to another frame and then back again everything works as its supposed to from then on out until the program is closed. I'm thinking the problem has to be something with how focus is handled with the JInternalFrames and that 1 and 2 may be relate? I've tried just about everything I can think of with now luck, anyone have an ideas?
Originally posted by Chris Robertson: 2. This one is even stranger. I start the application and open a new JInternalFrame. If I do this I can type in a text field BUT I can not highlight text with the mouse, i can do it using the SHIFT and arrow keys but not the mouse, I also can not use the mouse to scroll the JInterlaFrame's scroll bar. However if I swtich focus to another frame and then back again everything works as its supposed to from then on out until the program is closed.
I am not sure about the first problem you are having, but I may have some insight on this one...After you open a new Internal Frame, I have noticed that even though you can click on components in the Internal Frame, the Frame itself doesn't seem to have focus. Try this, when you open a new Internal Frame, click on the Title Bar at the top of the Internal Frame, and then see if it functions properly without having to go from one frame to another.
posted 17 years ago
No, that doesn't fix it. I can even double click on the title bar (which maximizes the frame) but I STILL can't use the mouse to highlight or to drag the scroll bar. For the first problem I just added a popup menu to my InternalFrame class and called it good, the popup menu works with the internal frame just fine. The second problem still has me stumped.
I don't like that guy. The tiny ad agrees with me.
Two software engineers solve most of the world's problems in one K&R sized book