Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / September 2006

Tip: Looking for answers? Try searching our database.

Java and Windows GUI Integration

Thread view: 
Mustafa K. Isik - 04 Sep 2006 11:34 GMT
I'm currently working on a research project, in the course of which
I'll be required to delve deep into the ugly innards of Java & Windows
GUI integration.

One of the preliminary tasks involves writing a prototype, utilizing
JNI, which presents a Swing UI in a Win32 Window.

I'd like to solicit information on prior experience and/or ideas on how
to stuff down Swing components down a native window's throat :).

Thanks,

Mustafa
ricky.clarkson@gmail.com - 04 Sep 2006 12:22 GMT
Swing is already more than capable of using a Win32 window itself:

class Main
{
       public static void main(String[] args)
       {
               JFrame frame=new JFrame();
               frame.add(new JButton("Boo");

frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
               frame.pack();
               frame.setVisible(true);
       }
}

As of Java 6, on Windows components are rendered using the native OS'
renderer (true at least for Windows and GTK, afaik), and Java has
supported native windows (as above) for years and years.

SWT provides access to native components more directly.

Your research sounds like a wheel reinvention.

If you want to paint a component to a custom graphics context, you can
do this by calling paintComponent and passing a Graphics object in, for
example, obtained from an Image.

> I'm currently working on a research project, in the course of which
> I'll be required to delve deep into the ugly innards of Java & Windows
[quoted text clipped - 9 lines]
>
> Mustafa
Mustafa K. Isik - 05 Sep 2006 10:49 GMT
Thanks for your post Ricky.

> Swing is already more than capable of using a Win32 window itself:
>...
> As of Java 6, on Windows components are rendered using the native OS'
> renderer (true at least for Windows and GTK, afaik), and Java has
> supported native windows (as above) for years and years.

I guess the description of my task was not complete enough to convey a
precise idea of where this is supposed to lead:

Eventual combination of Windows native and Java Swing UI elements in
the same Window that a Windows native app started.

My mini-project is not about performance issues with Java UIs.
I'm venturing into this land of UI/JNI madness to evaluate in how far
it is possible to integrate multiple distinct Java and Win C++ UI-bound
programs under one UI hood, without having to rewrite or re-implement
any significant portions of the existing code.

> SWT provides access to native components more directly.

As for SWT, I am  aware of what SWT is and how it goes about rendering,
utilizing native counterparts for its widgets. From what I know though,
it does not combine Swing (well it actually does not touch Swing at
all, right?) and native UI elements in a window.

> Your research sounds like a wheel reinvention.

Well I hope you still think this way after the clarification of what
I'm set out to look into and can provide me with pointers to material
dealing with similar issues.
Andrew Thompson - 05 Sep 2006 11:00 GMT
....
> Well I hope you ..

(do not)

>..still think this way after the clarification of what
> I'm set out to look into and can provide me with pointers to material
> dealing with similar issues.

The only way that sentence made sense was to presume
you forgot to add the words 'do not'..

(BTW - I cannot give any better information than the
group of people who have already decided to contribute
posts to this thread, they seem a lot more knowledgable
about this area than me.)

Andrew T.
Mustafa K. Isik - 05 Sep 2006 11:16 GMT
> ....
> > Well I hope you ..
[quoted text clipped - 7 lines]
> The only way that sentence made sense was to presume
> you forgot to add the words 'do not'..

I did actually mean what I wrote :)

Presuming Ricky is right and I am working on something that has already
been solved, I would be very happy to benefit from prior work and
proceed with other matters. Btw, this "research" project of mine is not
supposed to yield material for a software engineering paper, it is a
very practical problem that I'd like to see solved rather sooner than
later :)
ricky.clarkson@gmail.com - 05 Sep 2006 11:30 GMT
A possibly-interesting use of SWT is as a Swing implementation -
http://swingwt.sf.net

I think that it would be hard to come up with something general that
can mash together a Swing user interface and a native one; for a start
there would be layout issues.

Swing also does not even play very nicely with AWT components.

Maybe a good starting point would be to take one C/C++ app that you
have the source for, and one Java app that you have the source for, and
merge them.  Time yourself, and then evaluate the usefulness.

Of course, you should start with a hello world mash, then move to what
I said above.

A more interesting approach might be to convert Java GUI code to C++,
or vice-versa, or both to another representation, e.g., .NET.

Whatever you decide on, good luck.  You'll need it.  It's ugly in dem
der GUI toolkits.

> > ....
> > > Well I hope you ..
[quoted text clipped - 16 lines]
> very practical problem that I'd like to see solved rather sooner than
> later :)
Thomas Kellerer - 04 Sep 2006 12:35 GMT
> I'm currently working on a research project, in the course of which
> I'll be required to delve deep into the ugly innards of Java & Windows
[quoted text clipped - 5 lines]
> I'd like to solicit information on prior experience and/or ideas on how
> to stuff down Swing components down a native window's throat :).

I'm not sure, but you might want to look at the projects on dev.java.net
that deal with desktop integration. There might be stuff to get you
started or even help in you: https://javadesktop.dev.java.net/

Some years ago there was a JavaBean to ActiveX bridge, which seemed to
work fairly well back then. I have no idea whether it still exists.

Thomas

Signature

It's not a RootKit - it's a Sony

Vitaly - 04 Sep 2006 13:15 GMT
See articles

http://codeproject.com/cpp/OOJNIUse.asp
http://codeproject.com/dotnet/JavaDOTNETIntegrate.asp

and examples in products

http://www.simtel.net/product.php[id]93174[sekid]0[SiteID]simtel.net
http://www.simtel.net/product.php[id]94368[sekid]0[SiteID]simtel.net
http://www.simtel.net/product.php[id]95126[sekid]0[SiteID]simtel.net

Vitaly Shelest

>> I'm currently working on a research project, in the course of which
>> I'll be required to delve deep into the ugly innards of Java & Windows
[quoted text clipped - 14 lines]
>
> Thomas
Mustafa K. Isik - 05 Sep 2006 11:06 GMT
Hi Vitaly,

> See articles
>
> http://codeproject.com/cpp/OOJNIUse.asp
> http://codeproject.com/dotnet/JavaDOTNETIntegrate.asp

The links look very promising. I quickly browsed over them and will
play with the code this afternoon. I'll keep the group posted about my
experiences.

Thank you!
Andrew Thompson - 04 Sep 2006 13:22 GMT
...
(sig.)
> It's not a RootKit - it's a Sony

BTW - love the sig., it even inspired me to Google
RootKit to ascertain its meaning.  Bad, bad Sony.

..you were 'bitten'?

Andrew T.
Thomas Kellerer - 04 Sep 2006 13:28 GMT
> ...
> (sig.)
[quoted text clipped - 4 lines]
>
> ..you were 'bitten'?
No I wasn't. Actually I "borrowed" the sig. I'd love to claim I coined
it, but unfortunately I didn't (don't remember where I saw it though)

Thomas

Signature

It's not a RootKit - it's a Sony



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.