SkinLF

6 respostas
O

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();

}

}

6 Respostas

E

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

cv1

Hmmm...

public static void main(String args[]) {

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

}
O

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

F

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:

O

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

O

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

import java.awt.<em>;

import java.awt.event.</em>;

import java.awt.image.<em>;

import java.io.File;

import java.net.URL;

import javax.swing.</em>;

import javax.swing.plaf.metal.<em>;

import com.l2fprod.gui.</em>;

import com.l2fprod.gui.plaf.skin.<em>;

import com.l2fprod.util.</em>;

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 ?

Criado 9 de fevereiro de 2004
Ultima resposta 11 de fev. de 2004
Respostas 6
Participantes 4