• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

JInternalFrames and focus

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Chris Robertson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
The government thinks you are too stupid to make your own lightbulb choices. But this tiny ad thinks you are smart:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic