XP look&feel

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

XP look&feel

Philippe Grosjean
Hello,

First, congratulations for this wonderful program to all who contributed
to it!

I start using and programming it (although I am *not* a Java programmer,
I learn much with the macro recorder). I would like to run ImageJ under
Windows XP with an XP look&feel. I read here
(http://java.sun.com/docs/books/tutorial/uiswing/misc/plaf.html) that
this is possible, starting from Java 1.4.2. However, I cannot manage to
get this Win XP look&feel with ImageJ. I have tried:
+ the command line option:
-Dswing.defaultlaf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel
added to ImageJ.cfg

+ the 'swing.properties' file added to the /jre/lib subdir.

+ changing line 50 of Java2.java from
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
to
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
and recompiling ImageJ.

But I still got the old looking widgets. I tried ImageJ 1.35B with Java
1.5.0_04. I think these are the latest versions. I can manage to get a
*partial* XP look&feel by adding a java.exe.manifest in the same dir as
javaw.exe. However, buttons and checkboxes still keep the old look&feel,
while other controls are OK.

May be I don't understand when the Java2 class is called. Is JRE
1.5.0_04 considered as Java 2 or not?

Thanks for the help,

Philippe Grosjean

..............................................<°}))><........
  ) ) ) ) )
( ( ( ( (    Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (    Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Pentagone (3D08)
( ( ( ( (    Academie Universitaire Wallonie-Bruxelles
  ) ) ) ) )   8, av du Champ de Mars, 7000 Mons, Belgium
( ( ( ( (
  ) ) ) ) )   phone: + 32.65.37.34.97, fax: + 32.65.37.30.54
( ( ( ( (    email: [hidden email]
  ) ) ) ) )
( ( ( ( (    web:   http://www.umh.ac.be/~econum
  ) ) ) ) )          http://www.sciviews.org
( ( ( ( (
..............................................................
Reply | Threaded
Open this post in threaded view
|

Re: XP look&feel

ctrueden
Hi Philippe,

ImageJ uses the AWT widgets available since Java 1.0. In Java 1.2, they
began packaging Swing (JFC), the next-generation toolkit, with a much
richer feature set. Unfortunately, the Look & Feel features are specific
to Swing. The old-style AWT widgets are unaffected by that setting.

To get ImageJ to appear with a different L&F, it would need to be
reworked to use Swing instead of AWT, a significant endeavor. I know
that people have modified ImageJ to use Swing instead of AWT in the
past. E.g.:
    http://lists.mindswap.org/pipermail/photostuff/2003-October/000041.html

However, I am not sure if any such version has been made publically
available online, nor whether they have been kept up-to-date with the
latest ImageJ releases.

Lastly, note that there was a brief discussion about the merits of AWT
vs Swing and related topics on the list back in April:
    http://list.nih.gov/cgi-bin/wa?A2=ind0504&L=IMAGEJ&D=0&I=-3&P=17874

-Curtis

Philippe Grosjean wrote:

> Hello,
>
> First, congratulations for this wonderful program to all who
> contributed to it!
>
> I start using and programming it (although I am *not* a Java
> programmer, I learn much with the macro recorder). I would like to run
> ImageJ under Windows XP with an XP look&feel. I read here
> (http://java.sun.com/docs/books/tutorial/uiswing/misc/plaf.html) that
> this is possible, starting from Java 1.4.2. However, I cannot manage
> to get this Win XP look&feel with ImageJ. I have tried:
> + the command line option:
> -Dswing.defaultlaf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel
> added to ImageJ.cfg
>
> + the 'swing.properties' file added to the /jre/lib subdir.
>
> + changing line 50 of Java2.java from
> UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
> to
> UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
>
> and recompiling ImageJ.
>
> But I still got the old looking widgets. I tried ImageJ 1.35B with
> Java 1.5.0_04. I think these are the latest versions. I can manage to
> get a *partial* XP look&feel by adding a java.exe.manifest in the same
> dir as javaw.exe. However, buttons and checkboxes still keep the old
> look&feel, while other controls are OK.
>
> May be I don't understand when the Java2 class is called. Is JRE
> 1.5.0_04 considered as Java 2 or not?
>
> Thanks for the help,
>
> Philippe Grosjean
>
> ..............................................<°}))><........
>  ) ) ) ) )
> ( ( ( ( (    Prof. Philippe Grosjean
>  ) ) ) ) )
> ( ( ( ( (    Numerical Ecology of Aquatic Systems
>  ) ) ) ) )   Mons-Hainaut University, Pentagone (3D08)
> ( ( ( ( (    Academie Universitaire Wallonie-Bruxelles
>  ) ) ) ) )   8, av du Champ de Mars, 7000 Mons, Belgium
> ( ( ( ( (
>  ) ) ) ) )   phone: + 32.65.37.34.97, fax: + 32.65.37.30.54
> ( ( ( ( (    email: [hidden email]
>  ) ) ) ) )
> ( ( ( ( (    web:   http://www.umh.ac.be/~econum
>  ) ) ) ) )          http://www.sciviews.org
> ( ( ( ( (
> ..............................................................
>
Reply | Threaded
Open this post in threaded view
|

Re: XP look&feel

Philippe Grosjean
Hi Curtis and other ImageJ users,

OK, now I understand the difference between AWT and Swing. As I said, I
don't know much about Java...

I tried to change buttons and checkboxes for their Swing equivalent and
made other changes so that ImageJ's dialog boxes look like XP widgets
under Windows XP. It is quite easy to do. Look at
http://www.sciviews.org/ImageJ/ for the result.

The only drawback seems to be that the application uses about 1200kb
more than the plain AWT one (regular ImageJ), and there is a little
(barely noticeable) delay on loading the first dialog box.

I had to change only about twenty lines of code of ImageJ, or so. I
think drawing of buttons and checkboxes could be embedded in separate
functions. Then, a check if ImageJ is running under Win XP (or a command
line switch) would trigger the use of Swing instead of AWT. Again, this
seems fairly simple to do. Perhaps is it not so simple for other
widgets, but with JButton and JCheckBox, I am happy, because the other
AWT widgets are correctly displayed under Win XP (using a manifest for
javaw.exe)!

Would ImageJ developers consider this kind of little change... after
complete tests, of course?

Best,

Philippe Grosjean

..............................................<°}))><........
  ) ) ) ) )
( ( ( ( (    Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (    Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Pentagone (3D08)
( ( ( ( (    Academie Universitaire Wallonie-Bruxelles
  ) ) ) ) )   8, av du Champ de Mars, 7000 Mons, Belgium
( ( ( ( (
  ) ) ) ) )   phone: + 32.65.37.34.97, fax: + 32.65.37.30.54
( ( ( ( (    email: [hidden email]
  ) ) ) ) )
( ( ( ( (    web:   http://www.umh.ac.be/~econum
  ) ) ) ) )          http://www.sciviews.org
( ( ( ( (
..............................................................

Curtis Rueden wrote:

> Hi Philippe,
>
> ImageJ uses the AWT widgets available since Java 1.0. In Java 1.2, they
> began packaging Swing (JFC), the next-generation toolkit, with a much
> richer feature set. Unfortunately, the Look & Feel features are specific
> to Swing. The old-style AWT widgets are unaffected by that setting.
>
> To get ImageJ to appear with a different L&F, it would need to be
> reworked to use Swing instead of AWT, a significant endeavor. I know
> that people have modified ImageJ to use Swing instead of AWT in the
> past. E.g.:
>    http://lists.mindswap.org/pipermail/photostuff/2003-October/000041.html
>
> However, I am not sure if any such version has been made publically
> available online, nor whether they have been kept up-to-date with the
> latest ImageJ releases.
>
> Lastly, note that there was a brief discussion about the merits of AWT
> vs Swing and related topics on the list back in April:
>    http://list.nih.gov/cgi-bin/wa?A2=ind0504&L=IMAGEJ&D=0&I=-3&P=17874
>
> -Curtis
>
> Philippe Grosjean wrote:
>
>> Hello,
>>
>> First, congratulations for this wonderful program to all who
>> contributed to it!
>>
>> I start using and programming it (although I am *not* a Java
>> programmer, I learn much with the macro recorder). I would like to run
>> ImageJ under Windows XP with an XP look&feel. I read here
>> (http://java.sun.com/docs/books/tutorial/uiswing/misc/plaf.html) that
>> this is possible, starting from Java 1.4.2. However, I cannot manage
>> to get this Win XP look&feel with ImageJ. I have tried:
>> + the command line option:
>> -Dswing.defaultlaf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel
>> added to ImageJ.cfg
>>
>> + the 'swing.properties' file added to the /jre/lib subdir.
>>
>> + changing line 50 of Java2.java from
>> UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
>> to
>> UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
>>
>> and recompiling ImageJ.
>>
>> But I still got the old looking widgets. I tried ImageJ 1.35B with
>> Java 1.5.0_04. I think these are the latest versions. I can manage to
>> get a *partial* XP look&feel by adding a java.exe.manifest in the same
>> dir as javaw.exe. However, buttons and checkboxes still keep the old
>> look&feel, while other controls are OK.
>>
>> May be I don't understand when the Java2 class is called. Is JRE
>> 1.5.0_04 considered as Java 2 or not?
>>
>> Thanks for the help,
>>
>> Philippe Grosjean
>>
>> ..............................................<°}))><........
>>  ) ) ) ) )
>> ( ( ( ( (    Prof. Philippe Grosjean
>>  ) ) ) ) )
>> ( ( ( ( (    Numerical Ecology of Aquatic Systems
>>  ) ) ) ) )   Mons-Hainaut University, Pentagone (3D08)
>> ( ( ( ( (    Academie Universitaire Wallonie-Bruxelles
>>  ) ) ) ) )   8, av du Champ de Mars, 7000 Mons, Belgium
>> ( ( ( ( (
>>  ) ) ) ) )   phone: + 32.65.37.34.97, fax: + 32.65.37.30.54
>> ( ( ( ( (    email: [hidden email]
>>  ) ) ) ) )
>> ( ( ( ( (    web:   http://www.umh.ac.be/~econum
>>  ) ) ) ) )          http://www.sciviews.org
>> ( ( ( ( (
>> ..............................................................
>>
>
>