如何插入一個SWT Button控件到JFace TableViewer中?插入一個按鈕到JFace Table
2
A
回答
2
你不能。更一般地說,你不能在SWT中的表和樹中插入任何小部件,因爲並不是所有的平臺都支持它。你可以做的是
在正常和單擊狀態下取得按鈕的兩個屏幕截圖;
將正常截圖放在表中作爲圖像;
處理單擊TableItem。
這裏是複選框的例子:http://tom-eclipse-dev.blogspot.com/2007/01/tableviewers-and-nativelooking.html
12
給出的答案是很好用圖紙定做,或在表外,以實現自己的按鈕,一個很好的方式。但是,您可以將SWT控件放入JFace Tables中。
http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/PlacearbitrarycontrolsinaSWTtable.htm
用於構建表與含有組合框,文本框,並且通過鏈路提供的按鈕列的解決方案是:
Table table = new Table(shell, SWT.BORDER | SWT.MULTI);
table.setLinesVisible(true);
for (int i = 0; i < 3; i++) {
TableColumn column = new TableColumn(table, SWT.NONE);
column.setWidth(100);
}
for (int i = 0; i < 12; i++) {
new TableItem(table, SWT.NONE);
}
TableItem[] items = table.getItems();
for (int i = 0; i < items.length; i++) {
TableEditor editor = new TableEditor(table);
CCombo combo = new CCombo(table, SWT.NONE);
editor.grabHorizontal = true;
editor.setEditor(combo, items[i], 0);
editor = new TableEditor(table);
Text text = new Text(table, SWT.NONE);
editor.grabHorizontal = true;
editor.setEditor(text, items[i], 1);
editor = new TableEditor(table);
Button button = new Button(table, SWT.CHECK);
button.pack();
editor.minimumWidth = button.getSize().x;
editor.horizontalAlignment = SWT.LEFT;
editor.setEditor(button, items[i], 2);
}
相關問題
- 1. MutiText通過+按鈕使用JFACE輸入
- 2. 如何將按鈕添加到JFace ErrorDialog
- 3. 在PDF中插入一個按鈕
- 4. 在JFreeChart圖中插入一個按鈕
- 5. TableViewerColumn中的JFace按鈕
- 6. jface中的java單選按鈕自動將第一個按鈕設置爲true
- 7. 用一個按鈕選擇一個數據庫表,並用另一個按鈕插入到其中
- 8. jQuery按鈕淡入循環,直到按下另一個按鈕
- 9. 在python中插入一個按鈕到tkinter列表框中?
- 10. 我可以插入一個按鈕和進度條到RichTextBox中
- 11. 在JFace tableviewer列中放置一個按鈕
- 12. 如何覆蓋JFace嚮導的下一個按鈕事件
- 13. 在ScrollView下插入按鈕
- 14. 如何插入編號1 2 3 ,,,,, K的一個按鈕插入數字
- 15. 從點擊一個按鈕插入數據從一個GridView到數據庫
- 16. UIActionSheet按鈕插入到新的ViewController中
- 17. 將按鈕插入到Word文檔中
- 18. 按鈕插入標籤到textarea
- 19. C#插入按鈕到Hashtable中
- 20. 將按鈕插入到richtextblock中
- 21. 如何在輸入框中插入一個搜索按鈕
- 22. JFace對話框按鈕翻譯
- 23. SWT/JFace中的按鈕樣式
- 24. 插入到tableViewCell當按鈕在另一個視圖控制器按下
- 25. 插入/更新單個按鈕
- 26. Azure Table將行插入到TableServiceContext
- 27. 多少行插入到create table語句
- 28. 從單選按鈕獲取一個選定的值並將其插入到MySQL
- 29. 如何將新按鈕添加到JFace對話框的按鈕欄
- 30. 通過按下按鈕將值從一個表插入另一個表