SWT Problem: Wie kann man für jede TableColumn einen eigenen KeyListener registrieren.

bobymiller

Grünschnabel
Hallo alle zusammen !



Vielleicht kann mir jemand von Euch bei folgendem SWT Problem behilflich sein



Ich würde gerne für jede TableColumn einen eigenen KeyListener registrieren.

Geht dieses überhaupt oder muss dies über TableItem gemacht werden?

Bisher habe ich nur herausgefunden wie ich diese für die Table machen kann.



Hier einmal mein nacktes Grundgerücht wo ich es gerne drinnen hätte.


Code:
package de.sampex.swt;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ControlEditor;
import org.eclipse.swt.custom.TableCursor;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;

public class TableKeyListenerTest {

  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Table Column-KeyListiner-Test");

    shell.setLayout(new FillLayout());

    final Table table = new Table(shell, SWT.SINGLE | SWT.FULL_SELECTION);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    TableColumn column1 = new TableColumn(table, SWT.CENTER);
    column1.setText("Column 1");
    column1.pack();
       
    TableColumn column2 = new TableColumn(table, SWT.CENTER);
    column2.setText("Column 2");
    column2.pack();
   
    TableColumn column3 = new TableColumn(table, SWT.CENTER);
    column3.setText("Column 3");
    column3.pack();
   
    TableItem item1 = new TableItem(table, SWT.NONE);
    TableItem item2 = new TableItem(table, SWT.NONE);
    TableItem item3 = new TableItem(table, SWT.NONE);


    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    display.dispose();
  }
}


Für Eure Hilfe bedanke ich mich schon einmal.

so long...
boby
 

Neue Beiträge

Zurück