2016-04-04 22 views
1

Birden çok sütun içeren bir Tablom var. JFace kullanarak her bir sütun girişinde bir radyo düğmesi oluşturmak mümkün mü?Birden çok sütun içeren bir Tablom var. Jface kullanarak her sütun girişinde bir radyo düğmesi oluşturmak mümkün mü?

TableEditor numaralı telefonu kullanmayı denedim, ancak tüm sütunlara eklenmeyen bir sütuna yalnızca bir radyo düğmesi ekleyeceğim. Bana bu konuda daha fazla yol gösterebilirseniz, JFace için oldukça yeni bir şey olur.

doğrudan radyo düğmesi koymak olamaz

Example table

cevap

0

Sen çalışması gerekir

for (int i = 0; i < employeeCount; i++) 
{ 
    TableItem item; 
    Button radio; 
    TableEditor editor; 

    item = new TableItem(table, SWT.NO_FOCUS); 

    item.setText(0, employees[i]); //Let's assume you have an array of employees' names 

    radio = new Button(table, SWT.RADIO); 
    //TODO: setup your radiobutton here (text, behavior, etc.) 
    editor = new TableEditor(table); 
    editor.setEditor(radio, item, 1); //1 is the column index (excellent) 
    editor.layout(); 

    radio = new Button(table, SWT.RADIO); 
    //TODO: setup your radiobutton here (text, behavior, etc.) 
    editor = new TableEditor(table); 
    editor.setEditor(radio, item, 2); //2 is the column index (good) 
    editor.layout(); 

    radio = new Button(table, SWT.RADIO); 
    //TODO: setup your radiobutton here (name, text, behavior, etc.) 
    editor = new TableEditor(table); 
    editor.setEditor(radio, item, 3); //3 is the column index (average) 
    editor.layout(); 

    radio = new Button(table, SWT.RADIO); 
    //TODO: setup your radiobutton here (text, behavior, etc.) 
    editor = new TableEditor(table); 
    editor.setEditor(radio, item, 4); //4 is the column index (poor) 
    editor.layout(); 
} 

Sütun 0 hariç, tablonuzda sahip her sütun/satır için RadioButton eklemek gerekir.

+0

Yardımlarınız için teşekkürler! –

0

, resimleri kullanmak gerekecektir. Sütun için ColumnLabelProvider kullanın ve getImage yöntemini kullanın.

Bu tutorial üzerinden gidin. This, doğal görünüm ve kontrol hissi vermenize yardımcı olacaktır.

İlgili konular