How can I setup LookAndFeel Files in Java?
Asked Answered
M

3

4

I need to setup LookAndFeel Files in JDK 1.6. I have two files:

  1. napkinlaf-swingset2.jar

  2. napkinlaf.jar

How can I set this up and use it?

I would like a GTK look and feel OR Qt look and feel, Are they available?

Malayopolynesian answered 28/9, 2008 at 14:43 Comment(1)
Can you please be more clear? These 2 files, do you have the source or are they just binaries you have?Greeting
D
4

The class name for Naplin is net.sourceforge.napkinlaf.NapkinLookAndFeel. So to set it as default on the command line, use:

java -Dswing.defaultlaf=net.sourceforge.napkinlaf.NapkinLookAndFeel

To install it add napkinlaf.jar to the lib/ext direction and the lines:

swing.installedlafs=napkin
swing.installedlaf.napkin.name=Napkin
swing.installedlaf.napkin.class=net.sourceforge.napkinlaf.NapkinLookAndFeel

to lib/swing.properties within your Java installation (you'll probably have to create the file).

See the Napkin wiki page

Decorum answered 28/9, 2008 at 16:36 Comment(0)
H
9

This page explains how the work with Look&Feels: http://java.sun.com/docs/books/tutorial/uiswing/lookandfeel/plaf.html

You can do it commandline:

java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel MyApp

Or in code:

UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");

You need to make sure the jars containing the look&feel are on the application classpath. How this works depends on the application. A typical way would be to put it in a lib folder.

Look&Feels that are available by default in the JDK are:

com.sun.java.swing.plaf.gtk.GTKLookAndFeel
com.sun.java.swing.plaf.motif.MotifLookAndFeel
com.sun.java.swing.plaf.windows.WindowsLookAndFeel

Quioting the link above:

The GTK+ L&F will only run on UNIX or Linux systems with GTK+ 2.2 or later installed, while the Windows L&F runs only on Windows systems. Like the Java (Metal) L&F, the Motif L&F will run on any platform.

Holds answered 28/9, 2008 at 14:44 Comment(2)
i know how to use LAF , but i want install LAF files . and the GTK LAF not installed by default .Malayopolynesian
@Malayopolynesian -- Then I suggest you elaborate in your question.Nestling
D
4

The class name for Naplin is net.sourceforge.napkinlaf.NapkinLookAndFeel. So to set it as default on the command line, use:

java -Dswing.defaultlaf=net.sourceforge.napkinlaf.NapkinLookAndFeel

To install it add napkinlaf.jar to the lib/ext direction and the lines:

swing.installedlafs=napkin
swing.installedlaf.napkin.name=Napkin
swing.installedlaf.napkin.class=net.sourceforge.napkinlaf.NapkinLookAndFeel

to lib/swing.properties within your Java installation (you'll probably have to create the file).

See the Napkin wiki page

Decorum answered 28/9, 2008 at 16:36 Comment(0)
C
-2

The Qt look and feel is available from Trolltech as the product Jambi, which IS Qt for Java.

Caius answered 1/10, 2008 at 4:53 Comment(1)
this is no look and feel. it is the whole toolkit.Saprophagous

© 2022 - 2024 — McMap. All rights reserved.