Re: grabbing text from non-edit java window

From: David Thomas (dthomas_at_cogitoinc.com)
Date: 11/04/03


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.



Relevant Pages

  • Re: Threading in VB
    ... It has never caught on with win32 applications programmers, ... I've never downloaded a single java ... of our enterprise apps. ... other runtime based langauges are more popular in that world then in Windows - ...
    (microsoft.public.vb.general.discussion)
  • Re: VB 8 Standard and Professional
    ... JIT-compiled like Java, ... C++ programmers. ... away from the Windows API and toward their fantasy ... on the latest platforms, including the Web, Windows Vista, the 2007 ...
    (microsoft.public.vb.general.discussion)
  • Re: Static vs Dynamic
    ... Are you saying that the Java designers have been ... Not a very good advertisement for that language. ... it's easy to miss the bug because the code looks quite correct ... from programmers is a waste of time. ...
    (comp.lang.lisp)
  • OO BASIC or "B++"?
    ... behave functionally like pick basic even if the syntax ... Because Java doesn't allow operator overriding and I ... to have both system programmers *and* application programmers working ... You might say that this looks like any number of "MV functionality in ...
    (comp.databases.pick)
  • JAVA PROGRAMMER OPPORTUNTIES FOR JAVA PROFESSIONALS WITH TRINITY
    ... JAVA PROGRAMMER OPPORTUNTIES FOR JAVA PROFESSIONALS WITH TRINITY ... Title: JAVA Programmers/Senior JAVA Programmers ... and experienced software engineers with above skills for various ... Trinity Consultancy Services is a leading source of Information ...
    (comp.lang.java.programmer)