1

私はダウンロードマネージャーを作成しており、JTable. JTableテーブルセルレンダラーが原因でニンバスルックアンドフィールを適用するときにテーブルセルレンダラーを使用していることを示すためにJProgressbar、私のプログラムは例外を与えますが、セルレンダラーのテーブルアンドルックアンドフィールはうまく機能しません。

テーブルセルレンダラーの私のコードは次のとおりです。

public class TableRender implements TableCellRenderer {    
    @Override
    public Component getTableCellRendererComponent(JTable table, 
        Object value, boolean isSelected, boolean hasFocus, 
        int row, int column) {

        return (JProgressBar) value;
    }        
}

Nimbus のルック アンド フィールは次のとおりです。

try {
    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
            UIManager.setLookAndFeel(info.getClassName());
            break;
        }
    }
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException
    | UnsupportedLookAndFeelException e) {
    // If Nimbus is not available, you can set the GUI to another look and feel.
}
4

0 に答える 0