escordeiro 9 de fev. de 2004
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
ozorro 10 de fev. de 2004
estranho…esta no CLASSPATH, consigo abrir o Frame mas o LookAndFeel não funcionou…
fabio.patricio 10 de fev. de 2004
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.
ozorro 10 de fev. de 2004
Rodou! t q enfim…ta faltando os zips no classpath
ozorro 11 de fev. de 2004
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 ?