Howto can i work with Look And Feel Classes?

View: New views
3 Messages — Rating Filter:   Alert me  

Howto can i work with Look And Feel Classes?

by Niko_K :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

i created a bundle which shows a Swing Gui.
And that's where my problem starts. I want to show the user a selection of different look and feels, he can choose from.
In doing so, i need to import classes for the LAFs. For example:
<code>
import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel;
</code>

However, as soon as i use the code above, i get the following error:
"Access restriction: The type NimbusLookAndFeel is not accessible due to restriction on required library /usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/rt.jar"

I could not solve this problem, even with trying to add the package to the Import-Package property in the MANIFEST:MF file.

Is there another way to import these classes? Can i even import the LAF classes in an OSGI bundle?

Regards,
Niko

Re: Howto can i work with Look And Feel Classes?

by Marcel Offermans :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Oct 14, 2009, at 22:18 , Niko_K wrote:

> I could not solve this problem, even with trying to add the package  
> to the
> Import-Package property in the MANIFEST:MF file.

That's one half of the solution!

> Is there another way to import these classes? Can i even import the  
> LAF
> classes in an OSGI bundle?


Something needs to export those classes too. In this case, since  
they're part of the JDK, this should be the system bundle. Check out  
the documentation on the Felix on how to do that:

http://felix.apache.org/site/apache-felix-framework-usage-documentation.html#ApacheFelixFrameworkUsageDocumentation-configuringframework

Look for: org.osgi.framework.system.packages.extra

Greetings, Marcel

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Howto can i work with Look And Feel Classes?

by Niko_K :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks! This works.

However, eclipse gives me an error in the exporting bundle:
"Package 'com.sun.java.swing.plaf.windows' does not exist in this plug-in"

I get this warning for all my LaF classes:
"com.sun.java.swing.plaf.gtk,
 com.sun.java.swing.plaf.motif,
 com.sun.java.swing.plaf.nimbus,
 com.sun.java.swing.plaf.windows,
 javax.swing.plaf,
 javax.swing.plaf.metal"

Greetings,
Niko

Marcel Offermans wrote:
Something needs to export those classes too. In this case, since  
they're part of the JDK, this should be the system bundle. Check out  
the documentation on the Felix on how to do that:

http://felix.apache.org/site/apache-felix-framework-usage-documentation.html#ApacheFelixFrameworkUsageDocumentation-configuringframework

Look for: org.osgi.framework.system.packages.extra

Greetings, Marcel