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 / General / May 2006

Tip: Looking for answers? Try searching our database.

java with native GUI appearance?

Thread view: 
nooneinparticular314159@yahoo.com - 08 May 2006 23:49 GMT
I have a Java program that I would like to make appear to be a Windows
application on Windows, a Mac application on MacOS, and a Linux
application on Linux.  Is there a way to do this?

Also, is there a way to compile the code as Windows/Mac/Linux native?
I am interested in maximizing performance.  I also do not want to
require the user to have Java installed, so running native would be
preferable.

Thanks!
Chris Smith - 08 May 2006 23:59 GMT
nooneinparticular314159@yahoo.com <nooneinparticular314159@yahoo.com>
wrote:
> Also, is there a way to compile the code as Windows/Mac/Linux native?
> I am interested in maximizing performance.  I also do not want to
> require the user to have Java installed, so running native would be
> preferable.

As for the former, search the API doc index for
getSystemLookAndFeelClassName.

As for the second, you could look into Excelsior Jet or gcj, but you
won't be able to avoid having to either distribute some kind of an
implementation of the standard library, or require that the user already
have such an implementation available.  Since you can't legally
distribute only part of the standard library, you're pretty much stuck
with the whole thing.

Signature

www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

Andrew McDonagh - 09 May 2006 00:00 GMT
> I have a Java program that I would like to make appear to be a Windows
> application on Windows, a Mac application on MacOS, and a Linux
> application on Linux.  Is there a way to do this?

Google SetLookAndFeel - first entries.

> Also, is there a way to compile the code as Windows/Mac/Linux native?

No - well not from one tool.

> I am interested in maximizing performance.  

You should be sure that the app running in a JVM is the performance
bottleneck before going this road - often it isn't.

>I also do not want to
> require the user to have Java installed, so running native would be
> preferable.

Then why bother with Java?

Seriously, develop it in C++ and just build against your target platform.

When ever you try and work against a fundamental concept of a language,
you have to give up some of that languages benefits.

> Thanks!
nooneinparticular314159@yahoo.com - 09 May 2006 00:16 GMT
Well, I developed it in Java initially because I was familiar with the
language, and sure that I could build a proof of concept in it.  My
concern is that if I let other people run it, I want it to appear to
them to behave exactly as a program should in their native environment,
including installing the way that native programs install.  I don't
want them to say "what is JRE?" and get confused.

It looks to me that SetLookAndFeel generates a GUI appearance that is
similar to, but not the same as, the native GUI.  For example, you have
a java logo in the corner, and widgets don't look quite right.  Is
there a way around this?

It actually runs fine on an older machine in Java.  It's a user
experience issue more than anything else...
nooneinparticular314159@yahoo.com - 09 May 2006 00:32 GMT
Ok.  I tried it, and it does indeed produce the appearance of being
Windows native (mostly).  But is there any way to make the icon the
correct icon, and not a Java coffee cup?

Thanks!
Simon - 09 May 2006 13:03 GMT
> Ok.  I tried it, and it does indeed produce the appearance of being
> Windows native (mostly).  But is there any way to make the icon the
> correct icon, and not a

Frame.setIconImage(Image)

I think there is no method getDefaultIconImageForPlatform() but I guess your
application will have an icon of its own. Otherwise, that is a good reason to
design one now :-)

Cheers,
Simon
Alun Harford - 09 May 2006 01:09 GMT
> Well, I developed it in Java initially because I was familiar with the
> language, and sure that I could build a proof of concept in it.  My
> concern is that if I let other people run it, I want it to appear to
> them to behave exactly as a program should in their native environment,
> including installing the way that native programs install.  I don't
> want them to say "what is JRE?" and get confused.

Distribute an installer. It deals with that.
If you don't, they're going to say "what is DLL?", "what is the registry?",
etc.

Alun Harford
Chris Smith - 09 May 2006 16:41 GMT
nooneinparticular314159@yahoo.com <nooneinparticular314159@yahoo.com>
wrote:
> Well, I developed it in Java initially because I was familiar with the
> language, and sure that I could build a proof of concept in it.  My
> concern is that if I let other people run it, I want it to appear to
> them to behave exactly as a program should in their native environment,
> including installing the way that native programs install.  I don't
> want them to say "what is JRE?" and get confused.

They don't need to.  You can distribute the JRE with your application.  
The JRE (Sun's, anyway) does not need to be "installed" in any special
way.  You can just extract it to a subdirectory of your application, and
set up a shortcut / shell script / Start menu entry, or whatever else is
appropriate for the platform, that runs it with a full path.  Using
executable JARs for your own application helps here, too, since it makes
the JRE less dependent on environment variables and the like.

I've done that for years, and our customers don't have any clue what a
JRE is.

> It looks to me that SetLookAndFeel generates a GUI appearance that is
> similar to, but not the same as, the native GUI.  For example, you have
> a java logo in the corner, and widgets don't look quite right.  Is
> there a way around this?

Those are not native controls.  If they look subtly different from
native controls, there's nothing to be done about it.  My experience is
that Sun's look and feels are close enough that customers don't tend to
care about the remaining differences... assuming, of course, that your
application actually does unique and interesting things besides just
having a user interface.

For native controls that are usable, see SWT, but you'll pay a price in
working with a relatively impoverished programming model.  The AWT also
has native controls, but they are well-nigh unusable and don't include
things that are considered fundamental these days, like tree and table
controls.

Signature

www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation



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



©2009 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.