List Info

Thread: Java Windows Programming Primer




Java Windows Programming Primer
user name
2006-11-09 19:20:24
Hi Michael and Matt,

Sorry so slow on the reply. I am responding on the digest. I will reply quicker if you cc me on the reply (mikejbradyyahoo.com).

JNI Wrapper looks like a good product, and just might do the trick. At first glance, it looks like it enables COM interactions from inside a Java program (your chore #1), but not necessarily Java interactions inside a Windows application (your chores #2, 3, & 4). Dig deeper, it just might solve those too.

Another option I am aware of, though I have not used it personally, is the Sun ActiveX Bridge. It should solve chores #2, 3, & 4. Links:

http://java.sun.com/products/javabeans/ActiveXtools.html
http://java.sun.com/j2se/1.4.2/docs/guide/beans/axbridge/developerguide/index.html
http://java.sun.com/products/plugin/1.3/activex.faq.html

- You would probably implement the bridge on a facade class that does everything you need to do since every exported bean requires a separate jar and a separate dll.
- You would naturally have to control this from within Excel using VBA, though you can define events on your control that you can handle in VB, and therefore give Java a means for driving functionality (putting data in cells, etc).
- Address chore #2 by having VB script on the button that calls your java component.
- You can have a UI component as the example illustrates (I believe this is what you wanted in your chore #4). Therefore, you should not have trouble displaying the java component inside the ActiveX container. I would expect that to include java message boxes (chore #3).

Hope this helps,
Mike Brady

-----------------------
Date: Thu, 9 Nov 2006 00:14:23 -0600
From: "Matt Tucker" <jivesoftware.com&YY=79609&amp;y5beta=yes&y5beta=yes&order=down&amp;sort=date&pos=0&view=a&head=b">mattjivesoftware.com>
Subject: Re: [PJUG Javamail] Java Windows Programming Primer
To: <Freightliner.com&YY=79609&amp;y5beta=yes&y5beta=yes&order=down&amp;sort=date&pos=0&view=a&head=b">MichaelMcDonaldFreightliner.com>,
<gmail.com&amp;YY=79609&y5beta=yes&y5beta=yes&amp;order=down&sort=date&pos=0&view=a&head=b">michaelandrewphoenixgmail.com>
Cc: pjug.org&amp;YY=79609&y5beta=yes&y5beta=yes&amp;order=down&sort=date&pos=0&view=a&head=b">javamailpjug.org
Message-ID:
<EX-101.mail.navisite.com&YY=79609&y5beta=yes&amp;y5beta=yes&order=down&sort=date&amp;pos=0&amp;view=a&amp;head=b">E1F190DAC247C64FAA46B38316FA151D053CA668EX-101.mail.navisite.com>
Content-Type: text/plain; charset="us-ascii"

Check out JNIWrapper:

http://www.jniwrapper.com/pages/home

In particular, they have a new product called JExcel that may do exactly
what you're looking for.

Regards,
Matt


________________________________

From: pjug.org&amp;YY=79609&y5beta=yes&y5beta=yes&amp;order=down&sort=date&pos=0&view=a&head=b">javamail-bouncespjug.org
[mailto:pjug.org&amp;YY=79609&y5beta=yes&y5beta=yes&amp;order=down&sort=date&pos=0&view=a&head=b">javamail-bouncespjug.org] On Behalf Of
Freightliner.com&YY=79609&amp;y5beta=yes&y5beta=yes&order=down&amp;sort=date&pos=0&view=a&head=b">MichaelMcDonaldFreightliner.com
Sent: Wednesday, November 08, 2006 4:30 PM
To: gmail.com&amp;YY=79609&y5beta=yes&y5beta=yes&amp;order=down&sort=date&pos=0&view=a&head=b">michaelandrewphoenixgmail.com
Cc: pjug.org&amp;YY=79609&y5beta=yes&y5beta=yes&amp;order=down&sort=date&pos=0&view=a&head=b">javamailpjug.org
Subject: Re: [PJUG Javamail] Java Windows Programming Primer


Thanks for the reply Michael. I was kind of wondering too if
java could be made usable in a pull from Excel fashion and I plan on
researching a bit more on that subject. If nothing else I should be
able to build a standard exe file with java and then have have a button
in Excel run a VB sub to use the shell command to run my java created
exe. Making the code "seem" like it's embedded though might be tough.

Thanks also for the Runtime class suggestion. I will look into
it.

________________________________

From: Michael Phoenix [mailto:gmail.com&amp;YY=79609&y5beta=yes&y5beta=yes&amp;order=down&sort=date&pos=0&view=a&head=b">michaelandrewphoenixgmail.com]
Sent: Wednesday, November 08, 2006 4:10 PM
To: Michael McDonald
Cc: pjug.org&amp;YY=79609&y5beta=yes&y5beta=yes&amp;order=down&sort=date&pos=0&view=a&head=b">javamailpjug.org
Subject: Re: [PJUG Javamail] Java Windows Programming Primer


i've got a couple of ideas that I have listed below each of your
queries that I am able to address.


On 11/8/06, freightliner.com&YY=79609&amp;y5beta=yes&y5beta=yes&order=down&amp;sort=date&pos=0&view=a&head=b">MichaelMcDonaldfreightliner.com
<;freightliner.com&YY=79609&amp;y5beta=yes&y5beta=yes&order=down&amp;sort=date&pos=0&view=a&head=b">MichaelMcDonaldfreightliner.com > wrote:

Hello PJUG,

I am hunting for some tutorials on how to declare
and assign windows objects in Java. I am swimming in loosely related
information so any recommendations of literature people have liked on
the subject would be appreciated. Some examples of examples I would
like to find are:

1) Have a Java app launch Microsoft Excel in Windows XP,
create a new workbook, and assign value 3 to cell B2 on sheet1.


You can use the Runtime class's exec method to launch Microsoft
Excel. It is possible that you could perform the other actions by using
command line arguments with the Excel executable to do the other
functions, but I'm not sure as I haven't worked with Excel for awhile.
If none of the gurus on this list have a better idea, also consider
writing a VB app to perform those functions and launch it from java with
the exec method.



2) Assign a user created button in Excel to launch a
Hello World Java program.


I'm not sure this can be done. I think that buttons in Office
applications can only launch VBA macros.



3) Have a Java app draw a standard Windows messagebox.



Look at the AWT or swing packages. They enable you to build the
equivalent of a windows message box pretty easily.



4) Embed a java class inside an Excel workbook


Again, I don't think this is doable.



Hopefully, SOME of these are easily accomplished.
I know these are mickey mouse questions to some of you, but my name is
Mikey, not Mickey! :P


Thanks in Advance,

Michael


Access over 1 million songs - Yahoo! Music Unlimited.
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )