SWT表格標題中的&符號不會顯示,是否有已知的解決方法?SWT表格標題中的&符號解決方法
我在我的應用程序中顯示的符號,我正在尋找一個解決辦法...
https://bugs.eclipse.org/bugs/show_bug.cgi?id=154904
如果你不想閱讀完整的atricle只要按照這個例子
public class TableWidget {
Display d;
Shell s;
TableWidget() {
d = new Display();
s = new Shell(d);
s.setSize(250, 200);
s.setText("A Table Shell Example");
s.setLayout(new FillLayout());
Table t = new Table(s, SWT.BORDER);
TableColumn tc1 = new TableColumn(t, SWT.CENTER);
TableColumn tc2 = new TableColumn(t, SWT.CENTER);
TableColumn tc3 = new TableColumn(t, SWT.CENTER);
tc1.setText("First&&Name"); //THESE ampersands won't be shown
tc2.setText("Last & Name"); //and HERE
tc3.setText("Address");
tc1.setWidth(70);
tc2.setWidth(70);
tc3.setWidth(80);
t.setHeaderVisible(true);
TableItem item1 = new TableItem(t, SWT.NONE);
item1.setText(new String[] { "Tim", "Hatton", "Kentucky" });
TableItem item2 = new TableItem(t, SWT.NONE);
item2.setText(new String[] { "Caitlyn", "Warner", "Ohio" });
TableItem item3 = new TableItem(t, SWT.NONE);
item3.setText(new String[] { "Reese", "Miller", "Ohio" });
s.open();
while (!s.isDisposed()) {
if (!d.readAndDispatch())
d.sleep();
}
d.dispose();
}
public static void main(String[] argv) {
new TableWidget();
}
}
是的,當然,「\ u0026」將無法工作,以及 - 我真的不期待一個解決方案,但也許有人比我更聰明...
那麼,使用'&&'而不是'&'然後是什麼問題?對我來說工作得很好。或者這是特定於某個版本的Windows/SWT? – Baz
您只需使用SWT版本> = 3.7.2即可擺脫此錯誤! – bobbel