Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How does SWT select its style?
How does SWT select its style? [message #454490] Fri, 22 April 2005 14:10 Go to next message
Eclipse UserFriend
Originally posted by: martin.j.nilsson.sverige.nu

Hi,

I have a small SWT-application which resides on a server here at my
company. It can be invoked in two ways:

1. By double-clicking on the jar-file itself (or having a short-cut to the
jar-file on one's own desktop and double-clicking on that).

2. By clicking on a file with a suffix that is associated with the program.

The jar-file contains the swt-dll [swt-win32-3128.dll] and the necessary
swt-classes and the DLL is copied to the user's java/bin-directory the
first time the user invokes the program. Everything works fine.

My only problem is that when the program is started in the first way I get
the new XP-look with rounded buttons and if it is started in the second
way I get the old XP-look (or is it win2000?) with square buttons. Buttons
are just an example, all of the other widgets also differ in style.

This is not a huge problem, the application looks fine both ways, but I
find it really strange that it doesn't look the same independant on how I
start it. My guess is that in the second scenario the application somehow
finds out the operating system by querying the server and in the first
scenario from my own machine. Can I fix this somehow?

regards,
martin
Re: How does SWT select its style? [message #454497 is a reply to message #454490] Fri, 22 April 2005 21:58 Go to previous messageGo to next message
Daniel Spiewak is currently offline Daniel SpiewakFriend
Messages: 263
Registered: July 2009
Senior Member
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="serif">That is indeed odd.  The only thing I can think of
is the assignment of the associated application for the file type being
slightly wrong.  Specifically, using the wrong JRE.  The
javaw.exe.manifest file <i>must</i> be in the same directory as the
javaw.exe executable that is being used to run the program.  It doesn't
matter if you have one JRE on the system using this manifest.  The one
that you're using must use the manifest.  On Windows, the SDK
installation installs two copies of the JRE.  I would make sure that
both of them are being covered by the manifest extraction.  Or, I would
make sure that the one which invoked the JAR is being covered by the
extraction.<br>
<br>
Daniel<br>
</font><br>
Martin J Nilsson wrote:
<blockquote cite="midab13a8ac620b90ba0a94e19ce44e9093$1@www.eclipse.org"
type="cite">Hi,
<br>
<br>
I have a small SWT-application which resides on a server here at my
company. It can be invoked in two ways:
<br>
<br>
1. By double-clicking on the jar-file itself (or having a short-cut to
the jar-file on one's own desktop and double-clicking on that).
<br>
<br>
2. By clicking on a file with a suffix that is associated with the
program.
<br>
<br>
The jar-file contains the swt-dll [swt-win32-3128.dll] and the
necessary swt-classes and the DLL is copied to the user's
java/bin-directory the first time the user invokes the program.
Everything works fine.
<br>
<br>
My only problem is that when the program is started in the first way I
get the new XP-look with rounded buttons and if it is started in the
second way I get the old XP-look (or is it win2000?) with square
buttons. Buttons are just an example, all of the other widgets also
differ in style.
<br>
<br>
This is not a huge problem, the application looks fine both ways, but I
find it really strange that it doesn't look the same independant on how
I start it. My guess is that in the second scenario the application
somehow finds out the operating system by querying the server and in
the first scenario from my own machine. Can I fix this somehow?
<br>
<br>
regards,
<br>
  martin
<br>
<br>
<br>
<br>
<br>
<br>
</blockquote>
</body>
</html>
Re: How does SWT select its style? [message #454504 is a reply to message #454490] Sat, 23 April 2005 19:21 Go to previous messageGo to next message
Emil Crumhorn is currently offline Emil CrumhornFriend
Messages: 169
Registered: July 2009
Senior Member
I'm not entirely sure I uderstand what the non-working one is, but here's
maybe some manifest info.

If your application is launched from a non javaw.exe start, meaning, you
have your own executable or such (that launches the VM in any way), you need
to name the manifest file the same as the exectuable and add on ".manifest"
and put it where the executable is.

So, if your java app is launched by "launch.exe" you would make a copy of
the manifest and name it "launch.exe.manifest" (case sensetive too) and put
it in the same directory as "launch.exe", that way Windows would apply the
Win XP look and feel to your application.

Hope that helps solving your problem,

Emil


"Martin J Nilsson" <martin.j.nilsson@sverige.nu> wrote in message
news:ab13a8ac620b90ba0a94e19ce44e9093$1@www.eclipse.org...
> Hi,
>
> I have a small SWT-application which resides on a server here at my
> company. It can be invoked in two ways:
>
> 1. By double-clicking on the jar-file itself (or having a short-cut to the
> jar-file on one's own desktop and double-clicking on that).
>
> 2. By clicking on a file with a suffix that is associated with the
> program.
>
> The jar-file contains the swt-dll [swt-win32-3128.dll] and the necessary
> swt-classes and the DLL is copied to the user's java/bin-directory the
> first time the user invokes the program. Everything works fine.
>
> My only problem is that when the program is started in the first way I get
> the new XP-look with rounded buttons and if it is started in the second
> way I get the old XP-look (or is it win2000?) with square buttons. Buttons
> are just an example, all of the other widgets also differ in style.
>
> This is not a huge problem, the application looks fine both ways, but I
> find it really strange that it doesn't look the same independant on how I
> start it. My guess is that in the second scenario the application somehow
> finds out the operating system by querying the server and in the first
> scenario from my own machine. Can I fix this somehow?
>
> regards,
> martin
>
>
>
>
>
Re: How does SWT select its style? [message #454591 is a reply to message #454497] Mon, 25 April 2005 11:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: martin.j.nilsson.sverige.nu

Thank you for you answers Daniel and Emil,

I noticed that java.exe seems to have been copied to C:\WINDOWS\system32
as well as some other locations. The manifest-file was not present in that
directory, when I copied it there everything works fine.

Should I distribute this manifest-file with my application and copy it to
the user's directory?


regards,
martin
Re: How does SWT select its style? [message #454611 is a reply to message #454591] Mon, 25 April 2005 20:44 Go to previous messageGo to next message
Daniel Spiewak is currently offline Daniel SpiewakFriend
Messages: 263
Registered: July 2009
Senior Member
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="serif">That's probably what you'll have to do.  You can
detect the location at runtime with System.getProperty("jre.dir");
(either that or jre.location, can't remember which one ;-)  This will
give you the jre the application was invoked with, every time.  Java
won't load the manifest on the first run (when you copy it in). 
However, every run after that will be fully Luna-y.<br>
<br>
Daniel<br>
</font><br>
Martin J Nilsson wrote:
<blockquote cite="mid48564fc394187febd2c407d24f06cbc2$1@www.eclipse.org"
type="cite">Thank you for you answers Daniel and Emil,
<br>
<br>
I noticed that java.exe seems to have been copied to
C:\WINDOWS\system32 as well as some other locations. The manifest-file
was not present in that directory, when I copied it there everything
works fine.
<br>
<br>
Should I distribute this manifest-file with my application and copy it
to the user's directory?
<br>
<br>
<br>
regards,
<br>
  martin
<br>
<br>
</blockquote>
</body>
</html>
Re: How does SWT select its style? [message #454653 is a reply to message #454611] Tue, 26 April 2005 11:59 Go to previous message
Eclipse UserFriend
Originally posted by: martin.j.nilsson.sverige.nu

Hi Daniel,

Thank you again for your help.

> You can detect the location at runtime with System.getProperty("jre.dir");
> (either that or jre.location, can't remember which one ;-)

Actually on my system neither of those two properties exist at runtime. I
first thought that I could use the java.home property instead, but since
it points to the installation location of java this will not work when the
java.exe located in my c:\windows\system32\ is invoked (which it is since
that directory is the first one in every user's path).

I printed all the properties present at runtime, but none of them points
to c:\windows\system32 (except the path). Currently I'm very confused on
how to get the path the currently executing VM. Tried Googling of course,
but to no awail, guess I'm phrasing the search-words wrongly.

This is of course not strictly SWT-related any longer, if you have any
more suggestions for help I'll gladly accept them, otherwise I will try my
luck with further Googling.

regards,
martin
Previous Topic:SWT for Symbian (S80)
Next Topic:Easy way to dump Tree
Goto Forum:
  


Current Time: Thu Mar 28 21:57:38 GMT 2024

Powered by FUDForum. Page generated in 0.03449 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top