Java 将Jtable添加到SWT组
我已经在JavaRCP中创建了一个Jtable。我需要将表添加到组中Java 将Jtable添加到SWT组,java,swing,jtable,swt,Java,Swing,Jtable,Swt,我已经在JavaRCP中创建了一个Jtable。我需要将表添加到组中 private createview(Composite parent) { Group group = createGroup(parent, "Details"); Button button3 = new Button(group, SWT.PUSH); button3.setText("demo"); String[] columnNames = {"num
private createview(Composite parent) {
Group group = createGroup(parent, "Details");
Button button3 = new Button(group, SWT.PUSH);
button3.setText("demo");
String[] columnNames = {"num","Address","name","Version"};
DefaultTableModel tableModel = new DefaultTableModel(columnNames,0);
Object[] objs = {"1","ff","aa","22" },
{"2","gg","cc","33"};
tableModel.addRow(objs);
JTable table = new JTable(tableModel);
group.pack();
}
如何将Jtable(表)添加到组中。添加的按钮在UI中可见。任何帮助都将不胜感激。先谢谢你
Adrin您不能像这样混用SWT和Swing代码 可以使用
SWT\u AWT
bridge类将Swing代码放入SWT应用程序中,但如果可能,应该避免使用它
SWT有用于表格的
Table
类,或者JFace有TableViewer
,您不能像这样混用SWT和Swing代码
可以使用SWT\u AWT
bridge类将Swing代码放入SWT应用程序中,但如果可能,应该避免使用它
SWT拥有用于表格的
Table
类,或者JFace拥有TableViewer
谢谢@greg-449的回复。然后我将尝试使用TableViewer@greg-449感谢您的回复。然后我将尝试使用tableViewer