Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
I am trying to access the contents of a JFrame on a GUI interface but I keep getting to the contents of the overall frame (which I believe is a JInternalFrame). I don't have access to the software that creates these components. How can I access these components sitting on the JFrame? The text is there plain to see on the screen and the frame is in focus because pressing 'ESC' removes it. I have been using all sorts of combinations of getting ContentPanes, DesktopPane etc. but I still end up with the overall JInternalFrame. I'm writing a tool using IBM's Self-Voicing Kit to read the contents of different components on a GUI. I need to 'see' the contents of every component on the screen but I cannot alter the code that compiles the GUI. So far I've had good success on getting all the contents of JDialogs and JInternalFrames. But these JFrames seem to be invisible. I'm sure there must be some simple formula to get to the contents but I'm missing it. Any help much appreciated. Paul
Thanks Nate. This looks very promising. I've placed this method into my code and it gets triggered 476 times for one of these particular JFrames that I'm looking at. Some of these have to represent the components that I see on the screen - even though the window looks quite simple and uncluttered. I'm hopeful. Paul
As mentioned in my last email I get a huge number of components when I run this method. However, none of them seem to coincide with the in-focus window I see on my screen. I know it's an instance of JFrame because that check is what triggers my method in the first place. But the JFrame that I get is the overall window for the entire screen. Amongst the 400+ components I search for words that are displayed on my window to see if I'm getting to them with this method. For example, the word 'Flight' is displayed so I'm hoping to see a component which has a text field equal to 'Flight'. Perhaps I should be searching some other way? Paul
What sort of component has the word "flight" on it? A textfield? Label? Combobox? If it is a custom component, you may not be able to get the text because it may be hardcoded in the paint method... you can't get at text "paint"ed on the component...
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Yes, I thought of that problem and I'm hoping that's not the case. I cannot determine what type of component the word 'flight' is on but it's there sitting on my screen while 476 components are there. I'm checking further into some of them because it would at least be a start if I knew which components hold the information, even if it's not accessible. I'm trying to alter certain field values and see if anything changes on the screen. So far I've only discovered which components are not the component I want. Thanks for your help so far. Paul
The component I'm looking for has focus because when you press 'ESC' it goes away. Is there a way to find out what's in focus or what happens after the 'ESC' is pressed? I've executed the hasFocus() method on all 477 components and they are all false, yet there's a little window sitting on my screen waiting for me to press something? I still cannot see this component with any background code and I don't have access to the code that builds it. Paul