Re: grabbing text from non-edit java window
From: David Thomas (dthomas_at_cogitoinc.com)
Date: 11/04/03
- Next message: wex: "Re: JComboBox popup sensing mouse clicks"
- Previous message: Steve W. Jackson: "Re: jfilechooser problems on networked drives"
- In reply to: Antti S. Brax: "Re: grabbing text from non-edit java window"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 04 Nov 2003 15:50:38 GMT
> > "David Thomas" <dthomas@cogitoinc.com> wrote in message
> > news:bZWnb.7493$RQ1.6797@newsread3.news.pas.earthlink.net...
> >> How do I get the text (in a java program) from a java window that is
not
> > an
> >> edit window (ie, cannot hilight the text with a mouse)? ie, is there
> >> something similar to in functionality to Windows API GetWindowText()?
>
> Be specific. There is no such thing as an "edit window" in
> Java. There are some components that can contain editable
> text and some components that can contain uneditable text.
> Some components do not contain any text and others contain
> text in complex data structures.
> Do you want to be able to copy-paste text with the mouse from
> uneditable components or get the text programmatically?
Sorry, I thought that even not knowing Windows, the reference to an API with
a name that gives an obvious description, made it clear that I want to do it
programmatically. I'm not trying to incite a holy war, just providing an
example of what I wish to do.
> What the heck does GetWindowText() do in "Windows API?" We're
> Java programmers. We don't know about Windows APIs.
Some programmers have a little broader experience then a single development
environment. I'm sure they don't appreciate being so narrowly categorized.
> Are using Swing or AWT.
You are assuming I wrote the code for the window I wish to grab text from.
I didn't and I don't know what was used. I am only interested in grabbing
'existing' text from a java window for which I do not have source code for;
and doing it 'programmitically'. Though I can read java, I'm not a java
programmer and don't have the resources to research this. I was hoping that
someone could whip out an answer without much effort. (Kind of like an
experienced Windows programmer would have pointed me to using
GetWindowText(), without concern whether I normally do or don't work in
Windows.)
>
> If you want _all_ text from the components in a window then
> you coult do the following: java.awt.Container has a
> getComponents() method that returns an array of components.
> From those components you can do type checking to see if the
> component is one of the text components or a container. For
> containers do a recursive call and for text components call
> getText(). But that is pretty dumb, ugly and propably quite
> unusable.
>
Now this is useful, thank you for taking time to point me in a useful
direction.
- Next message: wex: "Re: JComboBox popup sensing mouse clicks"
- Previous message: Steve W. Jackson: "Re: jfilechooser problems on networked drives"
- In reply to: Antti S. Brax: "Re: grabbing text from non-edit java window"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|