SkinLF

Pessoal, baixei o SkinLF (http://www.l2fprod.com) mas, nao consegui rodar um exemplo q eu fiz.

O Q esta errado? pq um exemplo .JAR tenho a interdace grafica e tudo…
quem souber e poder me ajudar, agradeço!

import javax.swing.*;
import com.l2fprod.gui.plaf.skin.Skin;
import com.l2fprod.gui.plaf.skin.SkinLookAndFeel;

public class MainFrame extends JFrame {

   public MainFrame() {

   	try {
        setSize(450, 250);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setVisible(true);
        Skin theSkinToUse = SkinLookAndFeel.loadThemePack("themepack.zip");
        SkinLookAndFeel.setSkin(theSkinToUse);

        UIManager.setLookAndFeel(new SkinLookAndFeel());

	} catch (Exception ex) {

		ex.printStackTrace();
	}

   }
public static void main(String args[]) {

   	   new MainFrame();

}

}

Antes de compilar, verifica se o skinlf.jar está no seu classpath, senão os pacotes que você importou não serão encontrados.

Pra funcionar, lembra também que o themepack.zip tem que estar na pasta do seu programa, ok?

[]'s

Hmmm…

[code] public static void main(String args[]) {

MainFrame f = new MainFrame();
f.show();

}[/code]

estranho…esta no CLASSPATH, consigo abrir o Frame mas o LookAndFeel não funcionou…

Tu chegou a rodar algum dos exemplos que vem junto? Se não fez isso tente primeiro ai se funcionar coloque no teu código.

:smiley:

Rodou! t q enfim…ta faltando os zips no classpath

Galera, galera…alguem pode me explicar (EM VERMELHO) o codigo q rodei…vejam:

import java.awt.;
import java.awt.event.
;
import java.awt.image.;
import java.io.File;
import java.net.URL;
import javax.swing.
;
import javax.swing.plaf.metal.;
import com.l2fprod.gui.
;
import com.l2fprod.gui.plaf.skin.;
import com.l2fprod.util.
;

public class SkinTest extends JFrame {

public static void main(String[] args) throws Exception {

  String themepack = "themepack.zip";
  if (themepack.endsWith(".xml")) {
    SkinLookAndFeel.setSkin(SkinLookAndFeel.loadThemePackDefinition(SkinUtils.toURL(new File(themepack))));
    SkinLookAndFeel.enable();
  } else if (themepack.startsWith("class:")) {
    String classname = themepack.substring("class:".length());
    SkinLookAndFeel.setSkin((Skin)Class.forName(classname).newInstance());
    SkinLookAndFeel.enable();
  } else if (themepack.startsWith("theme:")) {
    String classname = themepack.substring("theme:".length());
    MetalTheme theme = (MetalTheme)Class.forName(classname).newInstance();
    MetalLookAndFeel metal = new MetalLookAndFeel();
    metal.setCurrentTheme(theme);
    UIManager.setLookAndFeel(metal);
  } else {
    SkinLookAndFeel.setSkin(SkinLookAndFeel.loadThemePack(themepack));
    SkinLookAndFeel.enable();
  }

[color=“red”][b] if (OS.isOneDotFour()) {
java.lang.reflect.Method method = JFrame.class.
getMethod(“setDefaultLookAndFeelDecorated”,
new Class[]{boolean.class});
method.invoke(null, new Object[]{Boolean.TRUE});

  method = JDialog.class.
    getMethod("setDefaultLookAndFeelDecorated",
              new Class[]{boolean.class});
  method.invoke(null, new Object[]{Boolean.TRUE});
}[/b][/color]
JFrame f = new JFrame("Skin Look And Feel " + SkinLookAndFeel.version());
f.pack();
WindowUtils.centerOnScreen(f);
f.setVisible(true);
}

}

nao entendi o pq disso…pois se tenho um LookAndFeel, o normal é eu passar o objeto referente ao LookAndFeel e seta-lo não ?