gpt4 book ai didi

java - 如何使用 Synthetica 插件

转载 作者:行者123 更新时间:2023-11-30 11:12:16 29 4
gpt4 key购买 nike

我下载 SyntheticaAddons和官方网站的主题;但是一旦我在我的 NetBeans 项目中使用它,它就会出现异常。

我需要专门使用JYTable,但是我失败了好几次。谁能帮我解决这个问题?

package controller;

import de.javasoft.plaf.synthetica.SyntheticaBlueLightLookAndFeel;
import java.awt.Container;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.table.DefaultTableModel;

import de.javasoft.swing.JYTable;
import de.javasoft.swing.JYTableHeader;
import de.javasoft.swing.JYTableScrollPane;
import de.javasoft.swing.jytable.renderer.CellLayoutHint;

/**
* Demonstrates how to use a JYTable.
*/
@SuppressWarnings("serial")
public class SimpleJYTable extends JFrame
{
public SimpleJYTable()
{
super("Simple JYTable");
createAndAddComponents(getContentPane());

//setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setSize(700,300);
setLocationRelativeTo(null);
setVisible(true);
}

/**
* Create components and add them to the container.
*/
private void createAndAddComponents(Container container)
{
String[] columnNames = {"First Name", "Last Name", "Sport", "# of Years", "Vegetarian"};
Object[][] data = {
{"Kathy", "Smith", "Snowboarding", 5, false},
{"John", "Doe", "Rowing", 3, true},
{"Sue", "Black", "Knitting", 2, false},
{"Jane", "White", "Speed reading", 20, true},
{"Joe", "Brown", "Pool", 10, false}
};
final Class<?>[] columnClasses = {String.class, String.class, String.class,
Integer.class,Boolean.class};

DefaultTableModel model = new DefaultTableModel(data, columnNames)
{
@Override
public Class<?> getColumnClass(int columnIndex)
{
return columnClasses[columnIndex];
}
};
JYTable table = new JYTable(model);
JYTableHeader header = (JYTableHeader)table.getTableHeader();
CellLayoutHint hint = header.getCellLayoutHint();
//center header text
header.setCellLayoutHint(new CellLayoutHint(hint.sortMarkerPosition, SwingConstants.CENTER,
hint.verticalAlignment));
//use a JYTableScrollPane for the filter row
JYTableScrollPane scrollPane = new JYTableScrollPane(table);
container.add(scrollPane);
}


/**
* Static main method for application startup.
*/
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable()
{
public void run()
{
try
{
UIManager.setLookAndFeel(new SyntheticaBlueLightLookAndFeel());
new SimpleJYTable();
}
catch (Exception e)
{
e.printStackTrace();
}
}
});
}

}

这将以以下异常结束:

Exception in thread "AWT-EventQueue-0" java.lang.NoSuchFieldError: TO_STRING_UI
at de.javasoft.swing.jytable.renderer.TableHeaderCellProvider.setStringValue
(TableHeaderCellProvider.java:58)
at org.jdesktop.swingx.renderer.ComponentProvider.<init>(ComponentProvider.java:158)
at org.jdesktop.swingx.renderer.ComponentProvider.<init>(ComponentProvider.java:133)
at de.javasoft.swing.jytable.renderer.TableHeaderCellProvider.<init>
(TableHeaderCellProvider.java:27)
at de.javasoft.swing.jytable.renderer.DefaultTableHeaderRenderer.createDefaultComponentProvider
(DefaultTableHeaderRenderer.java:136)
at org.jdesktop.swingx.renderer.AbstractRenderer.<init>(AbstractRenderer.java:40)
at de.javasoft.swing.jytable.renderer.DefaultTableHeaderRenderer.<init>
(DefaultTableHeaderRenderer.java:71)
at de.javasoft.swing.jytable.renderer.DefaultTableHeaderRenderer.<init>
(DefaultTableHeaderRenderer.java:59)
at de.javasoft.swing.jytable.renderer.DefaultTableHeaderRenderer$DefaultTableHeaderRendererUI.
<init>(DefaultTableHeaderRenderer.java:147)
at de.javasoft.swing.JYTableHeader.createDefaultRenderer(JYTableHeader.java:139)

那么请帮帮我好吗?

最佳答案

我也遇到了同样的问题,添加swingx-1.6.5后可以正常使用了

关于java - 如何使用 Synthetica 插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26975195/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com