Erro LAF Substance com SwingX (UIDefaults.getUI() failed)

1 resposta
J

Tentei resolver de várias formas, mas não consegui.

Situação:
Estou tentando usar alguns componentes do SwingX com o Substance look-and-feel.

Existe um plugin específico pra isso:
https://substance-swingx.dev.java.net/

Problema:
Compila mas não executa. Vejam o erro:
UIDefaults.getUI() failed: no ComponentUI class for: org.jdesktop.swingx.JXTaskPaneContainer

Todos os .jar necessários estão no classpath da aplicação.
Já fiz alguns testes com diferentes versões mas o problema ainda persiste.

Vi um problema parecido nessa url:
http://www.nabble.com/Tooltip-classloader-problems-td13237126.html

Pelo que entendi (meu inglês não é bom), no runtime ocorre uma falha e ele não encontra uma classe UI para o componente (...the runtime fails to find a UI class for JToolTip component...)

Segue o código:

import java.awt.event.ActionEvent;
import javax.swing.*;

import org.jdesktop.swingx.JXTaskPane;
import org.jdesktop.swingx.JXTaskPaneContainer;
import org.jdesktop.swingx.action.AbstractActionExt;
import org.jvnet.substance.skin.SubstanceBusinessBlackSteelLookAndFeel;

public class Produtos extends JPanel {

    public Produtos() {
        
        JPanel painelProdutos = new JPanel();
        
        JXTaskPaneContainer container = new JXTaskPaneContainer();
        JXTaskPane taskPane = new JXTaskPane();
        taskPane.setTitle("Dados Gerais");
        taskPane.add(new TODOAction("Link 1"));
        taskPane.add(new TODOAction("Link 2"));
        taskPane.add(new TODOAction("Link 3"));
        container.add(taskPane);
        
        taskPane = new JXTaskPane();
        taskPane.setTitle("Impostos");
        taskPane.add(new TODOAction("Link 1"));
        taskPane.add(new TODOAction("Link 2"));
        taskPane.add(new TODOAction("Link 3"));
        taskPane.add(new TODOAction("LInk 4"));
        container.add(taskPane);
        
        taskPane = new JXTaskPane();
        taskPane.setTitle("Outras Informações");
        taskPane.add(new JLabel("Local de estoque:"));
        taskPane.add(new JTextField(35));
        container.add(taskPane);
        
        painelProdutos.add(new JScrollPane(container));
        
        add(painelProdutos);
    }
    
    private static final class TODOAction extends AbstractActionExt {
        public TODOAction(String name) {
            setName(name);
        }
        public void actionPerformed(ActionEvent actionEvent) {}
    }
    

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



            /* primeira tentativa de setar o laf substance
            JFrame.setDefaultLookAndFeelDecorated(true);
            try {
            UIManager.setLookAndFeel(new SubstanceRavenGraphiteLookAndFeel());
            } catch (Exception e) {
            System.out.println("Substance Raven Graphite failed to initialize");
            }
             */

            //tentativa atual
            JFrame.setDefaultLookAndFeelDecorated(true);
            UIManager.setLookAndFeel(new SubstanceBusinessBlackSteelLookAndFeel());
            // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            
            SwingUtilities.invokeLater(new Runnable() {

                public void run() {
                    JFrame frame = new JFrame();
                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    frame.setLocationRelativeTo(null);
                    frame.setSize(400, 400);
                    frame.add(new Produtos());
                    frame.setVisible(true);
                }
            });

    }
    
}

Não entendo o que isso significa exatamente, na prática.
Se alguém puder ajudar desde já agradeço!!!

1 Resposta

J

pessoal… alguém ai já passou por esse problema?

Criado 24 de maio de 2009
Ultima resposta 25 de mai. de 2009
Respostas 1
Participantes 1